Downloading all related videos from youtube with youtube-dl

2010-05-16 312 words 2 mins read

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 <a class="zem_slink freebase/en/uploading_and_downloading" title="Uploading and downloading" rel="wikipedia" href="">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 <a class="zem_slink freebase/en/uniform_resource_locator" title="Uniform Resource Locator" rel="wikipedia" href="">URL&#8217;s in a <a class="zem_slink freebase/en/text_file" title="Text file" rel="wikipedia" href="">text file, and the simplest way to do this is :

press <a class="zem_slink freebase/en/control_key" title="Control key" rel="wikipedia" href="">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 <a class="zem_slink freebase/en/computer_file" title="Computer file" rel="wikipedia" href="">file 🙂

Now time to get all the URL&#8217;s from the html:

for i in $(<a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="">grep video-<a class="zem_slink freebase/en/html_element" title="HTML element" rel="wikipedia" href="">list-item |sed &#8217;s/&amp.*//&#8217;|sed &#8217;s/.*=&#8221;\(.*\)/\1/&#8217;)
echo &#8221;Writing $i to youtube.urls file&#8221;
echo &#8221;$i&#8221; » ~/youtube.urls

Just change the filename in the above with the file that you just saved and you will get all the URL&#8217;s in the file &#8221;~/youtube.urls&#8221;. Once this is done you can simply do

youtube-dl -a ~/youtube.urls<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">A New Way To Gather And Organize Your Online Content With ( <li class="zemanta-article-ul-li"><a href="">Counting blank lines in a large text file with C# and .NET ( <li class="zemanta-article-ul-li"><a href="">View Text Files Quickly in Linux ( <li class="zemanta-article-ul-li"><a href="">remove/replace text/path in config file. ( <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href=""><img class="zemanta-pixie-img" src="" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it