Youtube-dl cheatsheet
Hello fellow coders…
Today I am going to post something different. Its about a command-line based youtube downloader called youtube-dl
.
If you dont know about it, please go and check their homepage. This gives you instructions to install it correctly.
So today I am going to post some cheats you will need to download best youtube videos quickly.
One more important thing, there are no configuration settings to be done before or after installing youtube-dl
.
Downloading a single video
When you need to download a single youtube video, you just type :
youtube-dl youtube-video-url
This will download the best quality video available. But if you can select specific video quality. I will describe it later.
Downloading a playlist
When you are interested about a certain youtube play list and want to download, youtube-dl
gives an easy way to do it. You just have to use :
youtube-dl -cit youtube-playlist-url
Download specific videos from a playlist
When you just need some certain videos to download from a play list, you can use. As an example, if you just need to download from 5th to 10th video. you can use :
youtube-dl --playlist-items 5-10 youtube-playlist-url
Download different quality videos
If you no need to have the best quality video to be downloaded, you can easily select the best quality you want to have using following commands.
- First find what are the available qualities for a video:
youtube-dl -F youtube-video-url
This will give you similar output like this :
[youtube] CRlGDDprdOQ: Downloading webpage
[youtube] CRlGDDprdOQ: Downloading video info webpage
[info] Available formats for CRlGDDprdOQ:
format code extension resolution note
249 webm audio only DASH audio 51k , opus @ 50k, 5.87MiB
250 webm audio only DASH audio 80k , opus @ 70k, 8.53MiB
140 m4a audio only DASH audio 131k , m4a_dash container, mp4a.40.2@128k, 14.99MiB
251 webm audio only DASH audio 144k , opus @160k, 15.32MiB
242 webm 426x240 240p 112k , vp9, 30fps, video only, 4.96MiB
135 mp4 854x480 480p 130k , avc1.4d401f, 30fps, video only, 6.47MiB
136 mp4 1280x720 720p 227k , avc1.4d401f, 30fps, video only, 10.71MiB
243 webm 640x360 360p 236k , vp9, 30fps, video only, 7.56MiB
244 webm 854x480 480p 358k , vp9, 30fps, video only, 10.64MiB
137 mp4 1920x1080 1080p 576k , avc1.640028, 30fps, video only, 30.06MiB
247 webm 1280x720 720p 668k , vp9, 30fps, video only, 17.77MiB
248 webm 1920x1080 1080p 1445k , vp9, 30fps, video only, 48.80MiB
43 webm 640x360 medium , vp8.0, vorbis@128k, 31.06MiB
18 mp4 640x360 medium 309k , avc1.42001E, mp4a.40.2@ 96k (44100Hz), 35.83MiB
22 mp4 1280x720 hd720 221k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
Here you have to be careful, as you can see
248 webm 1920x1080 1080p 1445k , vp9, 30fps, video only, 48.80MiB
if you select this format, it will only download video only, without sound.
- Downloading the video format you want
youtube-dl -f 18 youtube-video-url
Here I will download medium quality video.360p
as I remember.
Downloading as mp3
- If you are a mp3 audio fan, you can easily download just
mp3
format. You can use two ways, first as I explained above, using-F
and finding audio only format. Using above sample output :
251 webm audio only DASH audio 144k , opus @160k, 15.32MiB
so you just have to use youtube-dl -f 251 youtube-video-url
- If you just need mp3 audio only, then you have to use
youtube-dl --extract-audio --audio-format mp3 youtube-video-url
Here are some useful threads :
How to download an MP3 track from a YouTube video
Can I directly download audio using youtube-dl?
Written with StackEdit.
Comments
Post a Comment