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/\’)
do
echo \”Writing $i to youtube.urls file\”
echo \”http://www.youtube.com$i\” >> ~/youtube.urls
done

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

\"Reblog

Linux find command – Find file and directories faster and easier

 

This command is very powerfull when used with combination of filters and pipes and RE.

I will give some example:

find . -type f -->> List all files
find . -type f -exec rm {} \\\; -->> Delete all files
find . -type d -exec rm {} \\; -->> Will through some common errors 🙂
find . -name \"*name*\"  --> find files containing name in the filename
find . -atime 12 --> Find files accessed 12 days ago

Similarly there is ctime for file status change

find . -type d -depth 2 --> find all the directories in the depth 2 of the tree.
find . -tyde d -ok rm -rf {} \\; --> Delete all the directories but only after user confirmation

There could be numerous such examples so I will leave it to you do digg the man page for find and then experiment :))

\"Reblog
Enhanced by Zemanta

prepend to a file with sponge from moreutils

A few weeks I wrote about a tool, which helps you easily prepend to a file. I submitted prepend to moreutils and Joey was kind enough to point out this could be done with `sponge\’.? sponge reads standard input and when done, writes it to a file:
Probably the most general …

\"Reblog