youtube video downloader

Want to batch download a bunch of videos in one swoop?  Here's how.  This also works with individual videos :)

Step 1)  Install youtube-dl

# emerge -av youtube-dl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] net-misc/youtube-dl-2016.12.22::gentoo USE="offensive {-test}" PYTHON_TARGETS="python2_7 python3_4 (-python3_5)"

Step 2) Create a playlist on youtube

Step 3) Execute the command and sit back.

$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]' --merge-output-format 'mp4' https://www.youtube.com/playlist?list=PL6gx4Cwl9DGAcbMi1sH6oAMk4JHw91mC_ -o '%(title)s'

So this command takes the best mp4 video and the best m4a, merges them into mp4 and saves it as the title of the source from youtube.

Example output is:

[youtube:playlist] PL6gx4Cwl9DGAcbMi1sH6oAMk4JHw91mC_: Downloading webpage
[download] Downloading playlist: Python 3.4 Programming Tutorials
[youtube:playlist] playlist Python 3.4 Programming Tutorials: Downloading 56 videos
[download] Downloading video 1 of 56
[youtube] HBxCHonP6Ro: Downloading webpage
[youtube] HBxCHonP6Ro: Downloading video info webpage
[youtube] HBxCHonP6Ro: Extracting video information
[youtube] HBxCHonP6Ro: Downloading MPD manifest
[download] Python Programming Tutorial - 1 - Installing Python.f137 has already been downloaded
[download] 100% of 11.66MiB
[download] Destination: Python Programming Tutorial - 1 - Installing Python.f140
[download] 100% of 3.73MiB in 00:01
[ffmpeg] Merging formats into "Python Programming Tutorial - 1 - Installing Python.mp4"
Deleting original file Python Programming Tutorial - 1 - Installing Python.f137 (pass -k to keep)
Deleting original file Python Programming Tutorial - 1 - Installing Python.f140 (pass -k to keep)

You can get the official docs from here.