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');
}
});
Hi
Hi, how may I help?
hi
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?
Sure: https://youtu.be/RpPhWBhIMVA
Hello, sorry to bother you but i was wondering what v,i,a in function(v, i, a) stand for
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
thank you so much!!!, please keep up to update this info, greetings from MX…
is it possible also extract the number of comments and views?
thanks
THX for all : ) Im from turkey + (discord ? )
Thanks for the tutorial!
Is there any way to extract upload date too?
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.
No script this time, I’ll try and will publish it soon.
Thank you
Perfect, would also be interested in one for doing the same thing for page one youtube videos. If you could create for me let me know how much it would cost.
Hi, Please explain your question, I’m here to help. You can write me an email here: iamsoftexpert@gmail.com
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.
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?
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
Second code isn’t working as of 9-11-24. Just says console cleared and undefined, and there is nothing above undefined.
THANKS! worked perfect for pulling the titles of all of our livestreamed videos!