How to Download Ebooks From First to Read You Tube
In this comprehensive Youtube-dl tutorial, we are going to learn what is Youtube-dl and the list of well-nigh normally used Youtube-dl commands with examples to download sound and video streams from Internet in Linux operating systems.
What is Youtube-dl?
Youtube-dl is a virtually popular command line YouTube downloader application. Youtube-dl can be able to download a single rail or the entire playlist in one go.
Youtube-dl is not just to download videos from Youtube, only too from a lot of other websites. You tin can view the consummate listing of supported sites here.
It is a gratuitous and open source program written in Python. It supports GNU/Linux, Mac Bone Ten and Microsoft Windows.
1. Install Youtube-dl On Linux
Youtube-dl can be installed in many ways. Let usa them all.
1.1. The officially recommended way to install Youtube-dl
The officially recommended manner to install Youtube-dl is just download it, save it in your $PATH
, go far executable and first using it correct away.
$ sudo ringlet -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
If y'all don't accept curl, use wget
instead:
$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
$ sudo chmod a+rx /usr/local/bin/youtube-dl
1.two. Install Youtube-dl using Pip
Alternatively, you can install it using Pip every bit shown below.
$ sudo -H pip install --upgrade youtube-dl
one.3. Install Youtube-dl using package manager
Youtube-dl is likewise bachelor in the official repositories of some Linux distributions.
To install Youtube-dl in Alpine Linux, run:
$ sudo apk add youtube-dl
Install Youtube-dl in Arch Linux, EndeavourOS, Manjaro Linux using command:
$ sudo pacman -Due south youtube-dl
On Debian, Ubuntu, Linux mint, Pop_OS!:
$ sudo apt install youtube-dl
On Fedora:
$ sudo dnf install youtube-dl
On openSUSE:
$ sudo zypper install youtube-dl
i.4. Install FFmpeg on Linux
Youtube-dl depends on FFmpeg to download 720p videos from YouTube and catechumen videos to other formats. To install FFmpeg on Linux, refer the following guide.
- How to install FFmpeg on Linux
1.5. Update Youtube-dl
If you've manually installed Youtube-dl using curl
or wget
, run the following control to update it:
$ sudo youtube-dl -U
If you installed information technology using pip
, do:
$ sudo pip install -U youtube-dl
Those who installed Youtube-dl using the distribution'southward parcel manager, just use the advisable update command. For instance, on Arch Linux, you lot tin update Youtube-dl by just running the following control:
$ sudo pacman -Syu
On Debian, Ubuntu:
$ sudo apt update
Now, let us see some examples to learn to apply Youtube-dl.
2. Youtube-dl Tutorial With Examples
Here, I have compiled nigh unremarkably used Youtube-dl commands to download a video or playlist from YouTube.
two.i. Download video or playlist
To download a video or the entire playlist from YouTube, only mention the URL like below:
$ youtube-dl https://www.youtube.com/sentinel?v=7E-cwdnsiow
If y'all desire to download video or playlist with a custom name of your choice, the command would be:
$ youtube-dl -o 'abdul kalam inspirational speech communication' https://www.youtube.com/watch?v=7E-cwdnsiow
Replace "abdul kalam inspirational speech" with your ain name.
Do you desire to save the video in another location? Use -o
flag followed by the target location like below.
$ youtube-dl -o '~/Downloads/abdul kalam speech' https://www.youtube.com/watch?v=7E-cwdnsiow
Here I am downloading the video to the Downloads
directory.
[youtube] 7E-cwdnsiow: Downloading webpage [download] Destination: /home/sk/Downloads/abdul kalam speech.f271 [download] 100% of 111.86MiB in 01:00 [download] Destination: /domicile/sk/Downloads/abdul kalam speech.f251 [download] 100% of 6.12MiB in 00:03 [ffmpeg] Merging formats into "/domicile/sk/Downloads/abdul kalam spoken language.webm" Deleting original file /abode/sk/Downloads/abdul kalam speech.f271 (laissez passer -k to continue) Deleting original file /home/sk/Downloads/abdul kalam voice communication.f251 (laissez passer -thou to proceed)
Yous can as well include additional details, such as the title, the uploader name (aqueduct proper name) and upload date etc., in the file name by using the following command:
$ youtube-dl -o '%(championship)due south past %(uploader)s on %(upload_date)due south in %(playlist)southward.%(ext)southward' https://www.youtube.com/watch?v=7E-cwdnsiow
2.2. Download multiple videos
Sometimes, yous might want to download multiple videos from or any other site. If and so, just mention the URL of the videos with space-separated like below:
$ youtube-dl <url1> <url2>
Alternatively, you can put them all in a text file and pass it to Youtube-dl as an statement like beneath.
$ youtube-dl -a url.txt
This control will download all videos mentioned in the url.txt file.
2.3. Download sound-just from a video
Youtube-dl allows us to download audio only from a YouTube video. If you e'er been in a state of affairs to download just the audio, run:
$ youtube-dl -x https://www.youtube.com/watch?v=7E-cwdnsiow
By default, Youtube-dl will save the sound in Ogg
(opus) format.
If yous prefer to download whatever other formats, for example mp3
, run:
$ youtube-dl -x --audio-format mp3 https://www.youtube.com/sentinel?v=7E-cwdnsiow
This command will download the audio from the given video/playlist, convert information technology to an MP3 and save information technology in the current directory. Please annotation that you should install either ffmpeg
or avconv
to convert the file to mp3 format.
2.4. Download video with clarification, metadata, annotations, subtitles and thumbnail
To download a video along with its other details such as description, metadata, annotations, subtitles, and thumbnail etc., apply the following command:
$ youtube-dl --write-description --write-info-json --write-annotations --write-sub --write-thumbnail https://www.youtube.com/lookout?v=7E-cwdnsiow
2.5. List all available formats of video or playlist
To list all available formats that a video or playlist is available in, use the following command:
$ youtube-dl --list-formats https://www.youtube.com/spotter?v=7E-cwdnsiow
Or,
$ youtube-dl -F https://www.youtube.com/watch?v=7E-cwdnsiow
Sample output:
As y'all can run across in the above screenshot, Youtube-dl lists all bachelor formats of the given video. From left to right, it displays the video format code, extension and resolution note of the respective video. This can be helpful when y'all desire to download a video at a specific quality or format.
2.half dozen. Display the size of Youtube videos
To retrieve the file size of a video, use -F
flag.
$ youtube-dl -F https://world wide web.youtube.com/lookout?v=7E-cwdnsiow
Y'all will see the file size at the finish of each file.
Sample output:
[youtube] 7E-cwdnsiow: Downloading webpage [info] Available formats for 7E-cwdnsiow: format code extension resolution note 249 webm audio only tiny 51k , opus @ 50k (48000Hz), 2.56MiB 250 webm audio only tiny 68k , opus @ 70k (48000Hz), 3.23MiB 140 m4a audio only tiny 128k , m4a_dash container, [email protected] (44100Hz), seven.59MiB 251 webm sound only tiny 137k , opus @160k (48000Hz), half-dozen.12MiB 160 mp4 192x144 144p 52k , avc1.4d400c, 30fps, video only, i.71MiB 278 webm 192x144 144p 73k , webm container, vp9, 30fps, video only, 3.73MiB 133 mp4 320x240 240p 89k , avc1.4d400d, 30fps, video merely, 3.12MiB 242 webm 320x240 240p 135k , vp9, 30fps, video just, 6.06MiB 134 mp4 480x360 360p 215k , avc1.4d401e, 30fps, video only, vii.53MiB 243 webm 480x360 360p 242k , vp9, 30fps, video only, 10.39MiB 135 mp4 640x480 480p 382k , avc1.4d401e, 30fps, video only, 14.13MiB 244 webm 640x480 480p 390k , vp9, 30fps, video merely, 16.44MiB 136 mp4 960x720 720p 737k , avc1.4d401f, 30fps, video only, 26.99MiB 247 webm 960x720 720p 770k , vp9, 30fps, video only, 31.12MiB 137 mp4 1440x1080 1080p 1391k , avc1.640028, 30fps, video only, 46.50MiB 248 webm 1440x1080 1080p 1421k , vp9, 30fps, video only, 52.19MiB 271 webm 1920x1440 1440p 3462k , vp9, 30fps, video only, 111.86MiB xviii mp4 480x360 360p 360k , avc1.42001E, [email protected] 96k (44100Hz), 21.55MiB 22 mp4 960x720 720p 578k , avc1.64001F, [email protected] (44100Hz) (best)
ii.vii. Download videos in certain quality and/or format
By default, Youtube-dl will download the best bachelor quality video. Still, it is too possible to download a video or playlist at a specific quality or format.
YouTube is capable of downloading videos in the following qualities:
- all-time - Select the best quality format of the given file with video and audio.
- worst - Select the worst quality format (both video and audio).
- bestvideo - Select the best quality video-simply format (east.m. DASH video). Delight note that it may not be available.
- worstvideo - Select the worst quality video-but format. May not be bachelor.
- bestaudio - Select the best quality sound only-format. May not be available.
- worstaudio - Select the worst quality sound merely-format. May not be available.
For example, if yous want to download best quality format (both sound and video), just use the following control:
$ youtube-dl -f best https://www.youtube.com/watch?5=7E-cwdnsiow
Similarly, to download audio-simply with best quality:
$ youtube-dl -f bestaudio https://www.youtube.com/watch?v=7E-cwdnsiow
To download worst quality video-simply format, use the following command:
$ youtube-dl -f worstvideo https://world wide web.youtube.com/watch?five=7E-cwdnsiow
You tin can likewise combine different format options similar beneath.
$ youtube-dl -f bestvideo+bestaudio https://www.youtube.com/watch?5=7E-cwdnsiow
The above command volition download best quality video-only and best quality sound-only formats and merge them together with ffmpeg
or avconv
. Make sure you have installed any one of these tools on your system.
If you don't want to merge, supercede +
(plus) operator with ,
(comma) similar below:
$ youtube-dl -f 'bestvideo,bestaudio' https://world wide web.youtube.com/watch?v=7E-cwdnsiow -o '%(championship)s.f%(format_id)s.%(ext)due south'
This command will download all-time quality video and best quality audio and volition not mix them. In this case, yous will go two files, one is audio and another is video. In this example, an output template ( -o
option) is recommended as bestvideo and bestaudio may have the same file name.
We can even download a video or playlist at a specific quality with specific resolution.
For instance, the post-obit command will download the best quality video in 480 pixel resolution (less than or equal to 480p).
$ youtube-dl -f "best[height<=480]" https://www.youtube.com/watch?v=7E-cwdnsiow
Like already said, we can group the format selectors to get a specific quality video. The following command will download best format available(both sound and video) but no better than 480p.
$ youtube-dl -f 'bestvideo[superlative<=480]+bestaudio/best[height<=480]' https://world wide web.youtube.com/sentinel?5=7E-cwdnsiow
2.eight. Download videos using format code
All videos have format codes which we can use to download a video at specific quality.
To find the format code, just list the available formats using any one of the post-obit commands:
$ youtube-dl --list-formats https://www.youtube.com/spotter?v=7E-cwdnsiow
Or
$ youtube-dl -F https://www.youtube.com/watch?v=7E-cwdnsiow
Equally you can see in the above screenshot, all format codes of the given video are listed in the first column. The best quality format is given at the end (the format code is 22
). Then, the command to download all-time quality format is:
$ youtube-dl -f 22 https://www.youtube.com/spotter?v=7E-cwdnsiow
Some videos may non have the same formats available while you download videos from playlist. In such cases, y'all can specify multiple format codes in any preferred order of your choice. Take a wait at the following case:
$ youtube-dl -f 22/17/18 <playlist_url>
As per the to a higher place example, Youtube-dl volition download the videos in format 22
if information technology is available.
If the format 22
is not available, it volition so download format 17
if information technology is available.
If both 22
and 17
formats are not available, it will finally try to download format eighteen
.
If none of the specified formats are bachelor, Youtube-dl will mutter that no suitable formats are bachelor for download.
Please notation that that slash is left-associative, i.e. formats on the left hand side are preferred.
2.9. Download videos past file extension
Download video(s) in your preferred format, say for example MP4, just run:
$ youtube-dl --format mp4 https://www.youtube.com/spotter?v=7E-cwdnsiow
Or,
$ youtube-dl -f mp4 https://www.youtube.com/sentinel?5=7E-cwdnsiow
Like I already mentioned in the previous section, some videos may not available in your preferred formats. In such cases, Youtube-dl volition download any other best bachelor formats.
For instance, the following command will download best quality MP4 format file. If MP4 format is non available, and so it will download any other best available format.
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' https://www.youtube.com/watch?v=7E-cwdnsiow
If yous desire to download them with custom filename, practise:
$ youtube-dl -f mp4 -o '%(title)s.f%(format_id)southward.%(ext)s' https://www.youtube.com/watch?5=7E-cwdnsiow
2.ten. Prepare size limit for videos
When you download multiple videos from a playlist, you lot might desire to download videos within a certain size but.
For example, this command volition not download any videos smaller than the given size, say 100MB:
$ youtube-dl --min-filesize 100M <playlist_url>
If you don't desire to download videos larger than the given size, exercise:
$ youtube-dl --max-filesize 100M <playlist_url>
We tin also combine format selection operators to download sure size videos.
The post-obit command will download best video-only format but not bigger than 100 MB.
$ youtube-dl -f 'all-time[filesize<100M]' https://www.youtube.com/watch?v=7E-cwdnsiow
2.11. Download videos by appointment-wise
Youtube-dl allows us to filter and download video or playlist by their upload date. This will be very helpful when you want to download videos from a playlist that contains 100s of videos.
For instance, to download videos uploaded at an exact date, for example October 01, 2018, the control would be:
$ youtube-dl --engagement 20181001 <URL>
Download videos uploaded on or earlier a specific date:
$ youtube-dl --datebefore 20180101 <URL>
Download videos uploaded on or after a specific appointment:
$ youtube-dl --dateafter 20180101 <URL>
Download simply the videos uploaded in the last 6 months:
$ youtube-dl --dateafter now-6months <URL>
To download videos between a specific date, for instance January 01, 2018 to January 01, 2019, use the following command:
$ youtube-dl --dateafter 20180101 --datebefore 20190101 <URL>
ii.12. Download specific videos from playlist
This is however another useful feature of Youtube-dl. It allows united states to download a specific vocal(due south) from a playlist that contains 100s of songs.
For instance, to download the tenth file from a playlist, run:
$ youtube-dl --playlist-items 10 <playlist_url>
You can also download and convert the file to other format at the same time. For the the following command will download the 1st file from the playlist and convert information technology to .mp3
format:
$ youtube-dl --playlist-items ane -x --audio-format mp3 <playlist_url>
Similarly, to download multiple random files, merely specify indices of the videos in the playlist separated past commas like below::
$ youtube-dl --playlist-items 2,iii,7,10 <playlist_url>
You can likewise specify the range of songs. To download a video playlist starting from a certain video, say 10, to cease:
$ youtube-dl --playlist-start x <playlist_url>
To download only the files starting from 2nd to 5th in a playlist, use:
$ youtube-dl --playlist-start two --playlist-end 5 <playlist_url>
2.13. Download but videos suitable for specific age
This is another notable feature of Youtube-dl. Information technology allows usa to download only videos suitable for the given age.
Say for case, to download all "Let's Play" videos that aren't marked "NSFW" or historic period-restricted for 7 year-olds from a playlist, run:
$ youtube-dl --friction match-title "let's play" --age-limit 7 --turn down-title "nsfw" <playlist_url>
2.fourteen. Ready download speed limit
You can use -r selection to limit the speed. For instance, the following control will limit the speed to 50K
.
$ youtube-dl -r 50K <URL>
Note that speed is specified in bytes per 2d.
ii.15. Resume downloads
By default, youtube-dl will automatically resume the download where you lot left it off. If information technology is doesn't resume the download for any reason, but strength the resume of partially downloaded files with -c
, --go on
flag:
$ youtube-dl -c <URL>
ii.xvi. Display Youtube-dl assistance
Youtube-dl has a lot more than options. I guess these examples are just enough to use Youtube-dl to download videos from online. For more details, refer Youtube-dl help section.
$ youtube-dl --help
iii. Youtube-dl Troubleshooting
Hither are some mutual errors that you might encounter from time to time. Most errors will get fixed themselves after updating the youtube-dl to its about recent version.
However, a few errors like below will not go stock-still even if you're using an updated youtube-dl version.
3.1. Fix "Unable to download video data: HTTP Mistake 403: Forbidden" Fault
When downloading videos from YouTube, sometimes you will go an error like below.
ERROR: unable to download video data: HTTP Error 403: Forbidden
To ready this error, refer the following guide.
- How To Fix "Unable to download video data: HTTP Error 403: Forbidden" Error
three.2. Warning: Requested formats are incompatible for merge and volition be merged into mkv
This is some other common fault. When you download a video, you will get an error like below:
[youtube] _XEgknKEBws: Downloading webpage WARNING: Requested formats are incompatible for merge and will be merged into mkv. Error: unable to open up for writing: [Errno 36] File name too long: '\xe0\xae\xa8\xe0\xaf\x8b\xe0\xae\xaf\xe0\xaf\x8d \xe0\xae\x8e\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xb0\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x81 \xe0\xae\x9a\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xaf\xe0\xaf\x88 \xe0\xae\x85\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\x95\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x81\xe0\xae\xae\xe0\xaf\x8d \xe0\xae\x87\xe0\xae\xaf\xe0\xae\xb1\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88 \xe0\xae\xaa\xe0\xae\xbe\xe0\xae\xa9\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d - \xe0\xae\xa8\xe0\xae\xbe\xe0\xae\xae\xe0\xaf\x87 \xe0\xae\xa4\xe0\xae\xaf\xe0\xae\xbe\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\xa4\xe0\xaf\x81 \xe0\xae\x8e\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\x9f\xe0\xae\xbf- \xe0\xae\xae\xe0\xae\xb0\xe0\xaf\x81\xe0\xae\xa4\xe0\xaf\x8d\xe0\xae\xa4\xe0\xaf\x81\xe0\xae\xb5\xe0\xae\xb0\xe0\xaf\x8d \xe0\xae\xa4\xe0\xaf\x80\xe0\xae\xaa\xe0\xae\xbe \xe0\xae\xb5\xe0\xae\xbf\xe0\xae\xb3\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d-_XEgknKEBws.f136.mp4.role'
This is actually not a trouble but an expected beliefs for youtube-dl.
By default, youtube-dl will download the highest quality audio and the highest quality video streams available and so join them into a uniform container like mkv, mp4 etc.
If these audio and video streams doesn't fit well in an mp4 container, youtube-dl will then pack them in mkv container and brandish the above warning bulletin.
In such cases, you lot can ignore the mkv warning and download the best quality video and the best quality sound but simply in an mp4 container by explicitly mentioning the desired best quality sound and video formats like below:
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' https://youtu.be/_XEgknKEBws
iii.3. ERROR: unable to open for writing: [Errno 36] File name as well long
When you endeavor to download a YouTube video that has long name, you will probably go this error:
[youtube] _XEgknKEBws: Downloading webpage ERROR: unable to open up for writing: [Errno 36] File name too long: '\xe0\xae\xa8\xe0\xaf\x8b\xe0\xae\xaf\xe0\xaf\x8d \xe0\xae\x8e\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xb0\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xaf\x81 \xe0\xae\x9a\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\xaf\xe0\xaf\x88 \xe0\xae\x85\xe0\xae\xa4\xe0\xae\xbf\xe0\xae\x95\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x81\xe0\xae\xae\xe0\xaf\x8d \xe0\xae\x87\xe0\xae\xaf\xe0\xae\xb1\xe0\xaf\x8d\xe0\xae\x95\xe0\xaf\x88 \xe0\xae\xaa\xe0\xae\xbe\xe0\xae\xa9\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d - \xe0\xae\xa8\xe0\xae\xbe\xe0\xae\xae\xe0\xaf\x87 \xe0\xae\xa4\xe0\xae\xaf\xe0\xae\xbe\xe0\xae\xb0\xe0\xae\xbf\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\xa4\xe0\xaf\x81 \xe0\xae\x8e\xe0\xae\xaa\xe0\xaf\x8d\xe0\xae\xaa\xe0\xae\x9f\xe0\xae\xbf- \xe0\xae\xae\xe0\xae\xb0\xe0\xaf\x81\xe0\xae\xa4\xe0\xaf\x8d\xe0\xae\xa4\xe0\xaf\x81\xe0\xae\xb5\xe0\xae\xb0\xe0\xaf\x8d \xe0\xae\xa4\xe0\xaf\x80\xe0\xae\xaa\xe0\xae\xbe \xe0\xae\xb5\xe0\xae\xbf\xe0\xae\xb3\xe0\xae\x95\xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d-_XEgknKEBws.f136.mp4.part
To fix this fault, merely download the video with shorter name of your choice with "-o" flag like below:
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' -o video.mp4 https://youtu.be/_XEgknKEBws
Conclusion
In my opinion, Youtube-dl is undoubtedly ane of the best downloader to download audio, video from online. You can utilize Youtube-dl to download audio and video from hundreds of websites.
I volition go on updating this Youtube-dl tutorial when I came beyond a new Youtube-dl tip. Bookmark and keep visiting it one time in a while.
If y'all think some important tip is missing, please allow me know in the comment section below. I will check and update this guide accordingly.
Resources:
- Youtube-dl website
- https://jonlabelle.com/snippets/view/trounce/youtube-dl-command
Source: https://ostechnix.com/youtube-dl-tutorial-with-examples-for-beginners/
0 Response to "How to Download Ebooks From First to Read You Tube"
Post a Comment