Skip to content

Instantly share code, notes, and snippets.

@aont
Created June 22, 2024 09:39
Show Gist options
  • Save aont/da0fe5753cd3b4e0a2bd14ea9e33eec7 to your computer and use it in GitHub Desktop.
Save aont/da0fe5753cd3b4e0a2bd14ea9e33eec7 to your computer and use it in GitHub Desktop.
var contents = ytInitialData.contents.twoColumnWatchNextResults.playlist.playlist.contents;
var videoIdList = [];
for(var content of contents) {
try {
var videoId = content.playlistPanelVideoRenderer.navigationEndpoint.watchEndpoint.videoId
console.log(videoId);
videoIdList.push(videoId);
} catch(e) {
console.error(e);
}
}
JSON.stringify(videoIdList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment