Post date: Jan 30, 2018 4:13:23 AM
Once Youtube-dl installed, you can find out all available commands this way:
$ youtube-dl --h
Youtube-dl supports many many formats. To list the formats avaiable for a particular video (in this case the Baby Shark song), do this:
$ youtube-dl -F https://www.youtube.com/watch?v=XqZsoesa55w
You should see the format list as follows:
[youtube] XqZsoesa55w: Downloading webpage
[youtube] XqZsoesa55w: Downloading video info webpage
[youtube] XqZsoesa55w: Extracting video information
WARNING: unable to extract uploader nickname
[info] Available formats for XqZsoesa55w:
format code extension resolution note
249 webm audio only DASH audio 61k , opus @ 50k, 737.69KiB
250 webm audio only DASH audio 78k , opus @ 70k, 962.10KiB
140 m4a audio only DASH audio 127k , m4a_dash container, mp4a.40.2@128k, 2.06MiB
171 webm audio only DASH audio 129k , vorbis@128k, 1.71MiB
251 webm audio only DASH audio 149k , opus @160k, 1.82MiB
278 webm 256x144 144p 108k , webm container, vp9, 30fps, video only, 1.61MiB
160 mp4 256x144 144p 113k , avc1.4d400c, 30fps, video only, 1.68MiB
133 mp4 426x240 240p 245k , avc1.4d4015, 30fps, video only, 2.50MiB
242 webm 426x240 240p 270k , vp9, 30fps, video only, 3.66MiB
243 webm 640x360 360p 513k , vp9, 30fps, video only, 6.81MiB
134 mp4 640x360 360p 569k , avc1.4d401e, 30fps, video only, 4.66MiB
244 webm 854x480 480p 910k , vp9, 30fps, video only, 11.84MiB
135 mp4 854x480 480p 1159k , avc1.4d401f, 30fps, video only, 9.39MiB
247 webm 1280x720 720p 1784k , vp9, 30fps, video only, 22.52MiB
136 mp4 1280x720 720p 2153k , avc1.4d401f, 30fps, video only, 15.62MiB
248 webm 1920x1080 1080p 3118k , vp9, 30fps, video only, 39.37MiB
137 mp4 1920x1080 1080p 3680k , avc1.640028, 30fps, video only, 23.62MiB
17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k
36 3gp 320x180 small , mp4v.20.3, mp4a.40.2
43 webm 640x360 medium , vp8.0, vorbis@128k
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best)
Next, choose any format you want to download with the flag -f as shown below:
$ youtube-dl -f 18 https://www.youtube.com/watch?v=XqZsoesa55w
If you want to download the video in mp3 audio format, then give this command:
$ youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=XqZsoesa55w