Skip to content

Instantly share code, notes, and snippets.

@senthilmpro
Created September 15, 2024 04:25
Show Gist options
  • Save senthilmpro/8157ba38b480c5c203fbb6f018557d7e to your computer and use it in GitHub Desktop.
Save senthilmpro/8157ba38b480c5c203fbb6f018557d7e to your computer and use it in GitHub Desktop.
youtube channel all videos as playlist
// go to channel home page (not any other subtab)
// open developer tools - console.
// paste the following.
let scripts = Array.from(document.querySelectorAll('script'));
let script = scripts.filter(x => x.innerHTML?.includes('externalId'))
let channelId = script[0]?.innerHTML.split("externalId")[1].split(",")[0]?.replace(":", '')?.replaceAll('"', '');
let playlistUrl = null;
if(channelId.substring(0, 2) === 'UC') {
newChannelId = 'UU' + channelId.substring(2);
playlistUrl = `https://www.youtube.com/playlist?list=${newChannelId}`;
console.log(playlistUrl);
} else {
console.log("INVALID channelId");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment