Youtube Channel Urls

How to Copy All The Titles And URLs From YouTube Channel

If you have a youtube channel and you want to get / copy all the videos URLs and titles, you can do it easily by watching this video.

This is very useful if you want to keep a record of all of your videos. You can also use this for adding some videos in video descriptions, as related videos for getting more videos and growing your youtube channel.

Codes Used in this video:

✔ First code:
var scroll = setInterval(function(){ window.scrollBy(0, 1000)}, 1000);

✔ Second code (Updated):
window.clearInterval(scroll); console.clear(); urls = $$('a'); urls.forEach(function(v,i,a){if (v.id=="video-title-link"){console.log('\t'+v.title+'\t'+v.href+'\t')}});

For Youtube Shorts:

window.clearInterval(scroll); 
console.clear(); 
shorts = $$('ytd-rich-item-renderer');
shorts.forEach(function(short, i, shorts) {
  const title = short.querySelector('#video-title').textContent;
  const url = 'https://www.youtube.com' + short.querySelector('#thumbnail').href;
  console.log('\t'+title+'\t'+url+'\t');
});

Updated code for shorts:

window.clearInterval(scroll);
console.clear();

// Collect all anchor ('a') tags on the page
urls = $$('a');

// Loop through each anchor tag and filter for YouTube Shorts
urls.forEach(function(v) {
    // Shorts have '/shorts/' in their href
    if (v.href.includes('/shorts/')) {
        console.log('\t' + v.title + '\t' + v.href + '\t');
    }
});

20 Comments

  1. Hi, thank you for the update! Do you know if there is a similar code to use for the “Shorts” page as well or for a playlist?

  2. Hi
    thanks for this valuable info I’m wondering if I can also get the date and duration of the video as well.please if i can add to this code to get that let me know
    thank you

  3. Hey, great tutorial. Do you have a script for this? I’d love to be able to automate this by inputting a list of keywords then having the tool grab page one channels for a particular keyword, extract all the channel urls, eliminate duplicates then format in an excel file.

  4. Is there a way to get a code like this but to get a list of all podcast episodes from Spotify? Asking for a friend.

  5. Hey, for the shorts code, I cannot get the number of views, can you update the code such that we get the number of views too?

  6. tried using the above code for shorts but getting the below error

    VM2277:5 Uncaught TypeError: Cannot read properties of null (reading ‘textContent’)
    at :5:52
    at Array.forEach ()
    at :4:8

Leave a Reply

Your email address will not be published. Required fields are marked *