pkg install youtube_dl
- note '_' rather than '-'.Terminal based YouTube jukebox with playlist management.
Main features:
- Search and play audio/video from YouTube
- Search tracks of albums by album title
- Search and import YouTube playlists
- Create and save local playlists - Download audio/video
- Convert to mp3 & other formats (requires ffmpeg or avconv)
- View video comments
- Works with 3.x
- Works with Windows, Linux and Mac OS X
- Requires mplayer or mpv
youtube-dl https://www.youtube.com/watch?v=Ib7tFvw34DM
youtube-dl: No match.
Which shell do you use? I think e.g. zsh needs double quotes for the URL.Am I missing something obvious?
You need to put quotes around the URL due to the question mark in it.Am I missing something obvious?
Thank you. I confirm your observation. I first tried with my default shell sh, and youtube-dl() worked without issue. When changed to csh (I don't have zsh installed), got same error as balanga mentioned. Used quotes (both single and double) and it worked fine again.Which shell do you use? I think e.g. zsh needs double quotes for the URL.
Actually for YouTube you don't even need the entire URL. The video ID (e.g.Am I missing something obvious?
I have no problem using YouTube with this videoCode:youtube-dl https://www.youtube.com/watch?v=Ib7tFvw34DM youtube-dl: No match.
View: https://www.youtube.com/watch?v=Ib7tFvw34DMe
.
Same happens with every URL I've tried
$ youtube-dl Ib7tFvw34DMe
) will suffice. Yep, it is that great!$ youtube-dl.py -U
every few days. YouTube changes frequently and the script is changed accordingly. Changes in the ports tree may be too slow, so doing what I suggest will guarantee you it's always up to date and ready to go. Case in point, the tree has 2019.07.30 while I'm at 2019.08.13. Sometimes it may not be a big deal but oftentimes it will be completely broken.$ youtube-dl.py -f '160+worstaudio[ext=m4a]' -- vid_ID_1 vid_ID_2 vid_ID_3 vid_ID_4
. As you can see, you can be very creative with audio and video formats. The double dash is of course to tell the shell it's the end of command options because YouTube IDs will sometimes start with a dash and confuse the shell.$ youtube-dl.py --help
and have fun.#youtube-dl
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
alias yta-best="youtube-dl --extract-audio --audio-format best "
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
I often download entire playlists like BSDCan proceedings or MIT OpenCourseware lectures and it's handy to keep the downloaded videos in proper order by prepending the index and make it all look better by removing the no-longer needed IDs such as Ib7tFvw34DMe. I just put the appropriate command in a youtube-playlist shell script in my ~/bin directory.How do people save YouTube videos for watching them offline?
#!/bin/sh
url="$1"
shift
opts="$@"
youtube-dl $opts -o "%(playlist_index)s-%(title)s.%(ext)s" $url
sync
youtube-playlist 'https://www.youtube.com/playlist?list=PL0C2D950BA6965E22' -f bestvideo+bestaudio
I also used the Firefox extension, but now I'm using a video converter for downloading videos from YouTube, Instagram or even Facebook. The downloader that I have is free and I need no registration to use it. Also, it's quick and easy to download. Usually, I use it to convert videos from Facebook to mp4, but what I like the most is that the videos are of good quality, moreover, I can download them in HD format. However, there are many other platforms for downloading, I recommend the one that I use, you should check it.How do people save YouTube videos for watching them offline?
marietto@marietto:/usr/home/marietto/Desktop/TUTs $ youtube-dl -F https://www.youtube.com/watch?v=c9lylHK4jmo -f bestvideo+bestaudio
[youtube] c9lylHK4jmo: Downloading webpage
[info] Available formats for c9lylHK4jmo:
format code extension resolution note
249 webm audio only tiny 50k , webm_dash container, opus @ 50k (48000Hz), 9.96MiB
250 webm audio only tiny 65k , webm_dash container, opus @ 65k (48000Hz), 12.94MiB
251 webm audio only tiny 125k , webm_dash container, opus @125k (48000Hz), 24.83MiB
140 m4a audio only tiny 129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 25.60MiB
160 mp4 256x144 144p 74k , mp4_dash container, avc1.4d400c@ 74k, 30fps, video only, 14.68MiB
278 webm 256x144 144p 93k , webm_dash container, vp9@ 93k, 30fps, video only, 18.42MiB
133 mp4 426x240 240p 143k , mp4_dash container, avc1.4d4015@ 143k, 30fps, video only, 28.42MiB
242 webm 426x240 240p 181k , webm_dash container, vp9@ 181k, 30fps, video only, 35.95MiB
134 mp4 640x360 360p 300k , mp4_dash container, avc1.4d401e@ 300k, 30fps, video only, 59.42MiB
243 webm 640x360 360p 323k , webm_dash container, vp9@ 323k, 30fps, video only, 63.94MiB
135 mp4 854x480 480p 459k , mp4_dash container, avc1.4d401f@ 459k, 30fps, video only, 90.81MiB
244 webm 854x480 480p 467k , webm_dash container, vp9@ 467k, 30fps, video only, 92.50MiB
298 mp4 1280x720 720p60 741k , mp4_dash container, avc1.4d4020@ 741k, 60fps, video only, 146.65MiB
302 webm 1280x720 720p60 1136k , webm_dash container, vp9@1136k, 60fps, video only, 224.65MiB
247 webm 1280x720 720p 1289k , webm_dash container, vp9@1289k, 30fps, video only, 255.02MiB
136 mp4 1280x720 720p 1362k , mp4_dash container, avc1.4d401f@1362k, 30fps, video only, 269.43MiB
299 mp4 1920x1080 1080p60 2591k , mp4_dash container, avc1.64002a@2591k, 60fps, video only, 512.42MiB
303 webm 1920x1080 1080p60 3459k , webm_dash container, vp9@3459k, 60fps, video only, 683.94MiB
18 mp4 640x360 360p 656k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 129.79MiB
22 mp4 1280x720 720p 1491k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)
marietto@marietto:/usr/home/marietto/Desktop/TUTs $ youtube-dl -F https://www.youtube.com/watch?v=c9lylHK4jmo -f 22
[youtube] c9lylHK4jmo: Downloading webpage
[info] Available formats for c9lylHK4jmo:
format code extension resolution note
249 webm audio only tiny 50k , webm_dash container, opus @ 50k (48000Hz), 9.96MiB
250 webm audio only tiny 65k , webm_dash container, opus @ 65k (48000Hz), 12.94MiB
251 webm audio only tiny 125k , webm_dash container, opus @125k (48000Hz), 24.83MiB
140 m4a audio only tiny 129k , m4a_dash container, mp4a.40.2@129k (44100Hz), 25.60MiB
160 mp4 256x144 144p 74k , mp4_dash container, avc1.4d400c@ 74k, 30fps, video only, 14.68MiB
278 webm 256x144 144p 93k , webm_dash container, vp9@ 93k, 30fps, video only, 18.42MiB
133 mp4 426x240 240p 143k , mp4_dash container, avc1.4d4015@ 143k, 30fps, video only, 28.42MiB
242 webm 426x240 240p 181k , webm_dash container, vp9@ 181k, 30fps, video only, 35.95MiB
134 mp4 640x360 360p 300k , mp4_dash container, avc1.4d401e@ 300k, 30fps, video only, 59.42MiB
243 webm 640x360 360p 323k , webm_dash container, vp9@ 323k, 30fps, video only, 63.94MiB
135 mp4 854x480 480p 459k , mp4_dash container, avc1.4d401f@ 459k, 30fps, video only, 90.81MiB
244 webm 854x480 480p 467k , webm_dash container, vp9@ 467k, 30fps, video only, 92.50MiB
298 mp4 1280x720 720p60 741k , mp4_dash container, avc1.4d4020@ 741k, 60fps, video only, 146.65MiB
302 webm 1280x720 720p60 1136k , webm_dash container, vp9@1136k, 60fps, video only, 224.65MiB
247 webm 1280x720 720p 1289k , webm_dash container, vp9@1289k, 30fps, video only, 255.02MiB
136 mp4 1280x720 720p 1362k , mp4_dash container, avc1.4d401f@1362k, 30fps, video only, 269.43MiB
299 mp4 1920x1080 1080p60 2591k , mp4_dash container, avc1.64002a@2591k, 60fps, video only, 512.42MiB
303 webm 1920x1080 1080p60 3459k , webm_dash container, vp9@3459k, 60fps, video only, 683.94MiB
18 mp4 640x360 360p 656k , avc1.42001E, 30fps, mp4a.40.2 (44100Hz), 129.79MiB
22 mp4 1280x720 720p 1491k , avc1.64001F, 30fps, mp4a.40.2 (44100Hz) (best)
Have you seen the examples in the man page of youtube-dl?I didn't understand well how to get the best video and audio for a single video downloaded from youtube.
# Download best mp4 format available or any other best if no mp4 available
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'
# Download best format available but no better than 480p
$ youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[height<=480]'
# Download best video only format but no bigger than 50 MB
$ youtube-dl -f 'best[filesize<50M]'
# Download best format available via direct link over HTTP/HTTPS protocol
$ youtube-dl -f '(bestvideo+bestaudio/best)[protocol^=http]'
# Download the best video format and the best audio format without merging them
$ youtube-dl -f 'bestvideo,bestaudio' -o '%(title)s.f%(format_id)s.%(ext)s'
By default youtube-dl tries to download the best available quality, i.e. if you want the best quality you don't need to pass any special options, youtube-dl will guess it for you by default.
Yeah, you're doing it wrong. You mix up options and the url.
marietto@marietto:/usr/home/marietto/Desktop/TUTs $ youtube-dl wDox97l3fcQ
youtube-dl -f '(bestvideo+bestaudio/best)[protocol^=http]' http://youtubec9lylHK4jmo
I want the mp4 file with the maximum quality.
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' wDox97l3fcQ
Ok.But you know the saying "give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime"
Code:youtube-dl -f '(bestvideo+bestaudio/best)[protocol^=http]' http://youtubec9lylHK4jmo