Created
February 15, 2025 15:42
-
-
Save dnicolson/521e67deb823e2954ee09ecc21a457da to your computer and use it in GitHub Desktop.
Like favorite YouTube videos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const playlistId = ''; | |
let playlist = await youtube.getPlaylist(playlistId); | |
let videos = playlist.items; | |
while (playlist.has_continuation) { | |
playlist = await playlist.getContinuation(); | |
videos = videos.concat(playlist.items); | |
} | |
for (const video of videos) { | |
const videoInfo = await youtube.getInfo(video.id); | |
if (videoInfo.basic_info.is_liked) { | |
console.log(`Video already liked: ${videoInfo.basic_info.title}`); | |
} else { | |
console.log(`Liking video: ${videoInfo.basic_info.title}`); | |
await videoInfo.like(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment