I like watching lots of conference talks but watching them on YouTube is not always ideal. You can use YouTube Premium (which I do) but it's limited to the official clients and sometimes I want to download one video, a playlist or a whole channel for research purposes π This all a breeze with youtube-dl.
Windows users can download an .exe file and place it in any location on their PATH except for %SYSTEMROOT%\System32 (e.g. do not put in C:\Windows\System32).
You can also use pip:
sudo -H pip install --upgrade youtube-dl
This command will update youtube-dl if you have already installed it. See the pypi page for more information.
youtube-dl is a nice tool for downloading videos from websites. Don't let the name fool you, it does work on lots of different sites but today we will only look at some of the YouTube bits. Below are examples of the most frequent variations of the command I use. I will be using the freeCodeCamp.org YouTube channel for all examples.
After opening up a playlist on the website, paste in the whole url that contains list=.
youtube-dl https://www.youtube.com/watch\?v\=jWdEM6XLKqI\&list\=PLWKjhJtqVAbkXQS12WiLsH1oaNZBSoWuV
[youtube:playlist] Downloading playlist PLWKjhJtqVAbkXQS12WiLsH1oaNZBSoWuV - add --no-playlist to just download video jWdEM6XLKqI
[youtube:playlist] PLWKjhJtqVAbkXQS12WiLsH1oaNZBSoWuV: Downloading webpage
[download] Downloading playlist: Serverless
[youtube:playlist] playlist Serverless: Downloading 7 videos
[download] Downloading video 1 of 7
[youtube] jWdEM6XLKqI: Downloading webpage
[download] Destination: Intro to Cloud Computing and AWS-jWdEM6XLKqI.f136.mp4
[download] 11.4% of 17.55MiB at 5.37MiB/s ETA 00:02^C
Downloading a Single Video
When you are watching a video on the YouTube website there is a parameter v=...h that you can use as the id with YouTube-dl
youtube-dl RBSGKlAvoiM
Downloading a Whole Channel
Now to the most important one option. You have to enter a plane or will be offline for a while (9-26 hours). Before departing is a great opportunity to download someone's channel.
This command might take a long time depending on the channel size. First, it gets the pages then, figures out how many videos there are before moving on to download.
Audio File From Video
Sometimes a technical talk is just more enjoyable as a podcast or you want to review it without all of the visual noise. For those, I download them as mp3 files and listen while taking a walk
Aborting youtube-dl is harmless. It can easily resume downloading after being stopped. To avoid any issues with the terminal you can escape your links or easier wrap them in double quotation marks "" when they contain special characters.
To be honest, I have not bothered reading the manual so there are probably lots of cool things I am not aware of. If you want to do something that is not mentioned here like getting the video in a specific resolution, then check out the various options from youtube-dl --help.
I hope you learned something new :) I personally use this great tool to learn better at my own time but please don't abuse it for other purposes and use at your own risk ππΎ