If this blog helped you in any way (professionally), please donate a dollar here

Friday, January 8, 2016

One line youtube video downloader

Okay, so this might be illegal in certain places. I just decided to try this out for fun, and here we have it, download youtube videos with 1 line of shell script (and some perl)

The script looks like this:
curl -H 'Upgrade-insecure-requests: 1' -H 'Cache-control: max-age=0' -H 'Accept-language: en-US,en;q=0.8,bn;q=0.6' -H 'Accept-encoding: gzip, deflate, sdch' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36' "https://www.youtube.com/watch?v=II3L1noJlYQ" | gunzip | egrep -o 'https%3A%2F%2F[^\.]*\.googlevideo.com%2F[^,\]*' | perl -pe 's/\%(\w\w)/chr hex $1/ge' | head -n1  | xargs wget -O out.video
One line.

Get it here: