Downloading all related videos from youtube with youtube-dl

How many time did you want to see all the videos (related) to the one you were watching on youtube but decided otherwise as the downloaded was not fast enough. Or has it happened to you that you wanted to download all the related videos, in either case you can use the youtube-dl utility I blogged about some times back. First you need to get all the URL\’s in a text file, and the simplest way to do this is :

press Ctrl+u

copy the html and paste it in a text file and save it.

Note: Ctrl+u in most browsers is for viewing the source. If you do not want to do this then you can simply do a save as and save the html file 🙂

Now time to get all the URL\’s from the html:

for i in $(grep video-list-item <filename> |sed \’s/&amp.*//\’|sed \’s/.*=\”\\(.*\\)/\\1/\’)
echo \”Writing $i to youtube.urls file\”
echo \”$i\” >> ~/youtube.urls

Just change the filename in the above with the file that you just saved and you will get all the URL\’s in the file \”~/youtube.urls\”. Once this is done you can simply do

youtube-dl -a ~/youtube.urls


2 thoughts on “Downloading all related videos from youtube with youtube-dl”