Have you ever wanted to save your favorite videos from the internet? Whether it's a funny cat video or a tutorial you want to watch later, Yt-dlp is here to help! In this comprehensive yt-dlp tutorial, we will explain what yt-dlp is, how to install it on Linux, and the most commonly used yt-dlp commands to download audio and video from YouTube and various other websites.
Disclaimer and Warning:
yt-dlp is a powerful tool for downloading videos and audio from a variety of websites. However, it is important to note that yt-dlp should not be used to download any illegal or pirated content. Downloading copyrighted material without the permission of the copyright holder is illegal and can result in serious legal consequences.
If you are unsure whether or not a video or audio file is copyrighted, it is best to err on the side of caution and not download it. There are many legitimate sources of free and copyrighted content available online.
Here are some tips for avoiding copyright infringement when using yt-dlp:
- Only download videos and audio files that you are authorized to download.
- Be aware of the copyright laws in your country.
- If you are unsure whether or not a video or audio file is copyrighted, do not download it.
- There are many legitimate sources of free and copyrighted content available online.
Please use yt-dlp responsibly and legally.
Neither the author nor the OSTechNix website bears responsibility for acts of piracy.
Table of Contents
1. What is yt-dlp?
yt-dlp is a free and open-source command-line tool that can be used to download videos from YouTube and other video hosting websites.
yt-dlp is a fork of the now-discontinued youtube-dlc, with the goal of adding new features and patches while also staying compatible with the original project.
It supports a wide range of video and audio formats, and it can also be used to download subtitles and metadata. yt-dlp is available for Windows, macOS, and Linux.
2. Key Differences Between yt-dlp and youtube-dl/youtube-dlc
Some of yt-dlp's default options differ from those of youtube-dl and youtube-dlc. Here are some of the key differences:
- Unlike youtube-dl and youtube-dlc, yt-dlp exclusively supports Python 3.7 and above. In contrast, youtube-dl extends its compatibility to Python 2.6+ and 3.2+.
- While ffmpeg is the recommended option for handling media,
avconv
is not endorsed as an alternative toffmpeg
within yt-dlp. - yt-dlp deviates slightly from youtube-dl in the storage of configuration files.
- The format of
-F
output in yt-dlp has changed. - The options
--auto-number
(-A
),--title
(-t
), and--literal
(-l
) have been deprecated and no longer function as expected. - By default, yt-dlp activates
--no-abort-on-error
. - The default output template in yt-dlp differs from that of youtube-dl. yt-dlp uses
%(title)s [%(id)s].%(ext)s
by default, while youtube-dl uses%(title)s-%(id)s.%(ext)s
. - yt-dlp's default format sorting prioritizes higher resolution and better codecs over higher bitrates, unlike youtube-dl.
- The default format selector in yt-dlp is
bv*+ba/b
, meaning combined video + audio formats that surpass video-only formats are preferred. - Unlike youtube-dlc, yt-dlp does not permit the merging of multiple audio/video streams into one file by default (to avoid conflicts with
-f bv*+ba
). - Metadata files, such as thumbnails, descriptions, or infojson, are written for playlists as well when using yt-dlp.
- yt-dlp lists unavailable videos for YouTube playlists.
- YouTube's upload dates extracted by yt-dlp are in UTC when available.
- yt-dlp excludes some internal metadata (e.g., filenames) from the infojson by default.
- yt-dlp's sanitization of invalid characters in filenames differs and is considered more intelligent compared to youtube-dl.
- yt-dlp attempts to parse external downloader outputs into standard progress output when possible, currently implemented for
aria2c
. To retain the downloader output as-is, use--compat-options no-external-downloader-progress
.
For more key differences, please visit the yt-dlp GitHub repository. The link is provided at the end of this guide.
3. Install yt-dlp in Linux
yt-dlp can be installed in multiple ways.
3.1. The Officially Recommended Way to Install yt-dlp
If you're using a UNIX-like operating system such as Linux, MacOS, or BSD, you can easily install yt-dlp by following one of these methods:
Method 1: Using Curl
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
Method 2: Using wget
sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
Method 3: Using aria2c
sudo aria2c https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp --dir /usr/local/bin -o yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
To keep yt-dlp up to date, simply run the following command:
sudo yt-dlp -U
3.2. Install yt-dlp using Pip
To get yt-dlp up and running, you can use Python's package manager, Pip. Here are various installation methods:
Method 1: Standard Installation
python3 -m pip install -U yt-dlp
This command will install yt-dlp and ensure it's up to date.
Method 2: Minimal Installation
If you prefer a lean installation without optional dependencies:
python3 -m pip install --no-deps -U yt-dlp
This command installs yt-dlp without any optional components.
Method 3: Cutting Edge (Master Branch)
For those who want the latest features and updates from the master branch:
python3 -m pip install -U pip setuptools wheel
python3 -m pip install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.tar.gz
Please note that on some systems, you might need to use py
or python
instead of python3
.
Updating yt-dlp:
To keep yt-dlp current, run the following command:
python3 -m pip install -U yt-dlp
3.3. Install Yt-dlp via Official Linux Repositories
For your convenience, some Linux distributions offer Yt-dlp in their official repositories, allowing you to install it using your default package manager. Below are yt-dlp installation instructions for different Linux distributions:
Alpine Linux:
doas apk -U add yt-dlp
Arch Linux, EndeavourOS, Manjaro Linux:
sudo pacman -S yt-dlp
Debian, Ubuntu, Linux Mint, Pop!_OS:
sudo apt install yt-dlp
Fedora:
sudo dnf install yt-dlp
openSUSE:
sudo zypper install yt-dlp
Please be aware that the version available in official repositories may sometimes be slightly outdated. For access to the latest features and updates, it's often recommended to use the officially recommend method involving curl
or wget
, as shown above. These methods ensure you get the most up-to-date version of yt-dlp.
3.4. Install FFmpeg on Linux
For Yt-dlp to smoothly download 720p videos from YouTube and perform video format conversions, it relies on FFmpeg. To set up FFmpeg on your Linux system, please consult the following guide.
3.5. Install yt-dlp on Android using Termux
We can install yt-dlp on an Android device via Termux.
First, install Termux on your Android phone.
Next, open Termux app and run the following command to grant permission for Termux to access your phone's storage, allowing file downloads.
termux-setup-storage
Update all the packages in Termux to ensure you have the latest versions.
pkg update && pkg upgrade
Install essential dependencies including Python, libexpat, and OpenSSL.
pkg install libexpat openssl python
Install yt-dlp and ensure it's up to date. Pip is Python's package manager and will handle the installation for you.
pip install -U yt-dlp
If you plan to work extensively with video operations, it's recommended to install FFmpeg. This step is optional but useful for video-related tasks.
pkg install ffmpeg
To keep yt-dlp up-to-date, run the following command periodically:
pip install -U yt-dlp
This ensures that you're always using the latest version of yt-dlp on your Android device through Termux. You can now enjoy downloading your favorite content on your Android with ease!
3.6. Updating yt-dlp
If you've manually installed yt-dlp using curl
or wget
or aria2c
, you can update it by executing the following command:
sudo yt-dlp -U
For those who installed yt-dlp using pip, use the following command to update:
python3 -m pip install -U yt-dlp
If you installed yt-dlp using your distribution's package manager, update yt-dlp according to your system's package manager. For example, on Arch Linux, update yt-dlp with:
sudo pacman -Syu
On Debian and Ubuntu systems, you can update yt-dlp using:
sudo apt update
Keeping yt-dlp up to date ensures you have access to the latest features and bug fixes.
4. yt-dlp Tutorial with Examples
yt-dlp usage is almost identical to youtube-dl's, with only a few minor differences. In this guide, we will learn some of the most commonly used yt-dlp commands to download videos and playlists from YouTube and other websites.
4.1. Download a Video or Playlist
To download a single video or an entire playlist from YouTube, simply enter the URL in the following format:
yt-dlp https://www.youtube.com/watch?v=t5b20oLaIaw
To download a video or playlist with a custom name, use the -o
flag followed by the desired name. For example:
yt-dlp -o 'Abdul Kalam Wings of Fire Autobiography' https://www.youtube.com/watch?v=t5b20oLaIaw
To download a video or playlist to a specific location, use the -o
flag followed by the target directory. For example:
yt-dlp -o '~/Downloads/Abdul Kalam Biography' https://www.youtube.com/watch?v=t5b20oLaIaw
To include additional details in the filename, such as the title, uploader name, upload date, and playlist name, use the following format:
yt-dlp -o '%(title)s by %(uploader)s on %(upload_date)s in %(playlist)s.%(ext)s' https://www.youtube.com/watch?v=t5b20oLaIaw
Here is a breakdown of the different options used in the above commands:
yt-dlp
: The name of the command-line tool used to download videos and playlists.-o
: The flag used to specify the output filename or directory.%(title)s
: The title of the video or playlist.%(uploader)s
: The name of the video or playlist uploader.%(upload_date)s
: The date on which the video or playlist was uploaded.%(playlist)s
: The name of the playlist, if the video is part of a playlist.%(ext)s
: The file extension of the downloaded video or audio file.
4.2. Download Multiple Videos in Parallel
There may be instances where you need to download multiple videos from a website or any other source. In such cases, you have a couple of convenient options:
Option 1: Download by Mentioning URLs
You can download multiple videos by specifying their URLs in the command, separated by spaces like so:
yt-dlp <url1> <url2>
This method allows you to fetch several videos in one go, simply by listing their URLs.
Option 2: Use a Text File
Alternatively, you can create a text file containing all the video URLs you want to download and then pass this file as an argument to Youtube-dl:
yt-dlp -a url.txt
By using this command, yt-dlp will automatically download all the videos listed in the url.txt
file. This approach is particularly handy when dealing with numerous videos, as it streamlines the process for you.
4.3. Download Audio-only from a Video
To download a video as Audio i.e. extract audio from a video, use -x
flag like below.
yt-dlp -x https://www.youtube.com/watch?v=t5b20oLaIaw
You can also specify the output audio format using the -x --audio-format
flag.
yt-dlp -x --audio-format mp3 https://www.youtube.com/watch?v=t5b20oLaIaw
This command extracts and downloads only the audio from the given video.
[youtube] Extracting URL: https://www.youtube.com/watch?v=t5b20oLaIaw [youtube] t5b20oLaIaw: Downloading webpage [youtube] t5b20oLaIaw: Downloading ios player API JSON [youtube] t5b20oLaIaw: Downloading android player API JSON [youtube] t5b20oLaIaw: Downloading m3u8 information [info] t5b20oLaIaw: Downloading 1 format(s): 251 [download] Destination: Dr. Apj Abdul Kalam | Wings of Fire | Autobiography | English | Inspiring Audio Story [t5b20oLaIaw].webm [download] 100% of 71.04MiB in 00:00:21 at 3.32MiB/s [ExtractAudio] Destination: Dr. Apj Abdul Kalam | Wings of Fire | Autobiography | English | Inspiring Audio Story [t5b20oLaIaw].mp3 Deleting original file Dr. Apj Abdul Kalam | Wings of Fire | Autobiography | English | Inspiring Audio Story [t5b20oLaIaw].webm (pass -k to keep)
4.4. Download a Video with Description, Metadata, Annotations, Subtitles, and Thumbnail
To download a video along with its accompanying details, including description, metadata, annotations, subtitles, and thumbnail, use the following command:
yt-dlp --write-description --write-info-json --write-annotations --write-sub --write-thumbnail <URL>
With this command, you can capture not only the video itself but also all the associated elements that enhance your viewing experience.
4.5. Display All Available Video or Playlist Formats
To view a comprehensive list of all the available formats for a video or playlist, utilize the following command:
yt-dlp --list-formats https://www.youtube.com/watch?v=t5b20oLaIaw
Alternatively, you can achieve the same result with -F
flag:
yt-dlp -F https://www.youtube.com/watch?v=t5b20oLaIaw
These commands provide you with an overview of the various formats in which the content is accessible, assisting you in making an informed selection.
As you see from the output, yt-dlp presents a comprehensive display of all the accessible video formats in an organized tabular column. Moving from left to right, this display includes essential details such as
- ID,
- Extension (EXT),
- Resolution,
- Frames Per Second (FPS),
- Channel (CH),
- Filesize,
- Total Bitrate (TBR),
- Protocol (PROTO),
- Video Codec (VCODEC),
- Video Bitrate (VBR),
- Audio Codec (ACODEC),
- Audio Bitrate (ABR),
- Audio Sampling Rate (ASR),
- and additional information.
This format proves especially useful when you need to download a video in a specific quality or format. It allows for quick and informed decisions when selecting the most suitable format for your needs.
4.6. View the Size of YouTube Videos
To obtain the file size of a video even before downloading it, use the -F
flag as follows:
yt-dlp -F https://www.youtube.com/watch?v=t5b20oLaIaw
In the output, the file size is displayed in the 6th column, allowing you to easily identify the video's storage requirements.
4.7. Download Videos in Specific Quality and Format
By default, yt-dlp will download videos in the best available quality if you don't pass any options. However, you have the flexibility to download a video or playlist in a specific quality or format as per your preferences.
YouTube offers the following quality options for video downloads:
- best: This selects the highest quality format available, including both video and audio.
- worst: It picks the lowest quality format for both video and audio.
- bestvideo: This option selects the best quality video-only format (e.g., DASH video).
- worstvideo: Similar to bestvideo but chooses the lowest quality video-only format.
- bestaudio: This selects the best quality audio-only format.
- worstaudio: Similar to bestaudio but chooses the lowest quality audio-only format.
For example, if you want to download the video in the best available quality for both audio and video, use this command:
yt-dlp -f best https://www.youtube.com/watch?v=t5b20oLaIaw
Similarly, to download audio-only with the best quality:
yt-dlp -f bestaudio <URL>
To download the lowest quality video-only format, use this command:
yt-dlp -f worstvideo <URL>
You can also combine different format options, like this:
yt-dlp -f bestvideo+bestaudio <URL>
This command downloads the best quality video-only and audio-only formats and merges them using ffmpeg
or avconv
. Ensure you have one of these tools installed on your system.
If you prefer not to merge the audio and video, replace the plus (+
) operator with a comma (,
) like this:
yt-dlp -f 'bestvideo,bestaudio' https://www.youtube.com/watch?v=t5b20oLaIaw -o '%(title)s.f%(format_id)s.%(ext)s'
This command downloads the best quality video and audio separately, resulting in two files. In this case, it's recommended to use an output template (-o
option) because bestvideo and bestaudio may have the same file name.
You can even download a video or playlist in a specific quality with a defined resolution. For example, to download the best quality video with a resolution of 480 pixels or lower (less than or equal to 480p), use this command:
yt-dlp -f "best[height<=480]" <URL>
As mentioned earlier, you can combine format selectors to target a specific video quality. The following command downloads the best available format (both audio and video) but no better than 480p:
yt-dlp -f 'bestvideo[height<=480]+bestaudio/best[height<=480]' <URL>
You can confirm whether yt-dlp has downloaded the video in the desired quality by examining the media file information with tools like mediainfo.
You also have the flexibility to use abbreviated flag names. For instance, instead of typing out "bestvideo
," you can use "bv
." Similarly, you can use "w
" for "worst
" and "wv
" for "worstvideo
."
Examples:
To download the best video-only format and best audio-only format or the best combined format if video-only is unavailable, run:
yt-dlp -f "bv+ba/b" https://www.youtube.com/watch?v=t5b20oLaIaw
Download the worst video quality available:
yt-dlp -f "wv*+wa/w" https://www.youtube.com/watch?v=t5b20oLaIaw
For more abbreviated flags examples, look at the Format Selection page.
This shorthand notation simplifies your commands for more efficient usage.
4.8. Download Videos Interactively
You can use the -f -
flag to interactively select the format for each video. This will prompt you with a list of available formats, along with their ID, extension, resolution, file size, and audio/video codec.
To download a specific format, type the ID of the file and press Enter.
To download the default selection, press Enter without typing anything. To exit the interactive format selection prompt, press Ctrl+C
.
4.9. Downloading Videos using Format IDs
If you wish to download multiple formats of the same video, you can use a comma as a separator. For example, using -f 22,17,18
will download all three of these formats, provided they are available.
The numbers 22, 17, and 18 correspond to the IDs of the respective video formats. These IDs are referred to as "Format codes" in youtube-dl's output.
You can discover these IDs by listing the available formats using either of the following commands:
yt-dlp --list-formats https://www.youtube.com/watch?v=t5b20oLaIaw
Or
yt-dlp -F https://www.youtube.com/watch?v=t5b20oLaIaw
The IDs for the available formats are listed in the first column. The best quality format is typically found towards the end, often with an ID like 247. Therefore, to download the best quality format, you can use the following command:
yt-dlp -f 247 https://www.youtube.com/watch?v=t5b20oLaIaw
If you intend to download multiple videos, and they do not share the same available formats, you can specify the order of preference using slashes. It's important to note that formats on the left-hand side are prioritized.
For instance, using -f 22/17/18
means it will attempt to download format 22 if available, then format 17 if format 22 is not available, and so on. If none of the specified formats are available, it will notify you that no suitable formats for download are found.
Please remember that the slash is left-associative, which means formats on the left-hand side are given preference during the selection process.
4.10. Download Videos by File Extension
To download video(s) in your preferred format, such as MP4, simply execute the following command:
yt-dlp --format mp4 https://www.youtube.com/watch?v=t5b20oLaIaw
Or, you can use the shorthand version:
yt-dlp -f mp4 https://www.youtube.com/watch?v=t5b20oLaIaw
As mentioned in the previous section, it's essential to note that not all videos may be available in your desired formats. In such cases, yt-dlp will automatically download the best available format.
For instance, the following command will download the best quality MP4 format file. If the MP4 format is unavailable for the given video, it will download the best alternative format:
yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' https://www.youtube.com/watch?v=t5b20oLaIaw
If you prefer to save these files with custom filenames, you can do so using the following command:
yt-dlp -f mp4 -o '%(title)s.f%(format_id)s.%(ext)s' https://www.youtube.com/watch?v=t5b20oLaIaw
4.11. Set Size Limits for Video Downloads
When downloading multiple videos from a playlist, you may have a preference for videos within a specific size range.
For instance, to ensure that no videos smaller than a specified size, say 100MB, are downloaded, use the following command:
yt-dlp --min-filesize 100M <playlist_url>
Conversely, if you wish to avoid downloading videos larger than a given size, you can use:
yt-dlp --max-filesize 100M <playlist_url>
You also have the option to combine format selection operators to download videos of a particular size. The subsequent command, for instance, will download the best video-only format, as long as it doesn't exceed 100MB:
yt-dlp -f 'best[filesize<100M]' https://www.youtube.com/watch?v=t5b20oLaIaw
4.12. Download Videos by Date
yt-dlp provides the capability to filter and download videos or playlists based on their upload date, which proves incredibly useful when dealing with extensive playlists containing hundreds of videos.
For example, to download videos uploaded on an exact date, say September 30, 2023, you can use the following command:
yt-dlp --date 20230930 <URL>
To download videos uploaded on or before a specific date:
yt-dlp --datebefore 20230930 <URL>
If you want to fetch videos uploaded on or after a particular date:
yt-dlp --dateafter 20230930 <URL>
For downloading only the videos uploaded in the last 6 months:
$ yt-dlp --dateafter now-6months <URL>
To download videos within a specified date range, such as from September 30, 2022, to September 30, 2023, use the following command:
yt-dlp --dateafter 20220930 --datebefore 20230930 <URL>
4.13. Download Specific Videos from a Playlist
This is another valuable feature offered by yt-dlp, allowing you to download specific songs or videos from a playlist that might contain hundreds of entries.
For instance, to download the 20th video from a playlist, execute the following command:
yt-dlp --playlist-items 20 <playlist_url>
You can also simultaneously download and convert the video to another format. In the following example, the command will download the first video from the playlist and convert it to .mp3
format:
yt-dlp --playlist-items 1 -x --audio-format mp3 <playlist_url>
Likewise, to download multiple random videos, simply specify the indices of the videos in the playlist separated by commas, as shown below:
yt-dlp --playlist-items 2,3,7,10 <playlist_url>
You can also define a range of videos to download. To download a video playlist starting from a specific video, say the 10th one, and continuing until the end:
yt-dlp --playlist-start 10 <playlist_url>
To download only the videos ranging from the 2nd to the 5th position in a playlist, use:
yt-dlp --playlist-start 2 --playlist-end 5 <playlist_url>
4.14. Downloading Videos Based on Age Suitability
yt-dlp offers another valuable feature that allows you to download videos suitable for a specific age group.
For example, if you want to download all "Let's Play" videos that are not marked as "NSFW" or age-restricted for 7-year-olds from a playlist, you can use the following command:
yt-dlp --match-title "let's play" --age-limit 7 --reject-title "nsfw" <playlist_url>
This command ensures that only videos appropriate for a 7-year-old audience will be downloaded, filtering out any "NSFW" or age-restricted content.
4.15. Setting Download Speed Limits
To control the download speed, you can utilize the -r
option. For instance, the command below will restrict the speed to 50 kilobytes per second:
yt-dlp -r 50K <URL>
Keep in mind that the speed is specified in bytes per second.
4.16. Resuming Downloads
Yt-dlp typically automatically resumes downloads from where they were previously interrupted. However, if for any reason it doesn't resume a download, you can forcefully continue downloading partially completed files using the -c
or --continue
flag:
yt-dlp -c <URL>
This flag ensures that the download picks up from where it left off, even if it was interrupted earlier.
4.17. Download YouTube Thumbnail Images
To download thumbnail image of a given Youtube video, run:
yt-dlp --ignore-errors --write-thumbnail --skip-download $1 $2 $3 https://www.youtube.com/watch?v=t5b20oLaIaw
Here's what each part of the command does:
yt-dlp
: This invokes the yt-dlp program.--ignore-errors
: This option tells yt-dlp to continue downloading even if some errors occur.--write-thumbnail
: This option instructs yt-dlp to download the thumbnail image for the video and save it to a file.--skip-download
: This option tells yt-dlp to skip downloading the actual video file.$1 $2 $3
: These are positional parameters that can be used to pass additional options or arguments to yt-dlp. However, in this command, they are not being used.https://www.youtube.com/watch?v=t5b20oLaIaw
: This is the URL of the YouTube video for which you want to download the thumbnail.
So, when you run this command, yt-dlp will attempt to download the thumbnail image for the specified YouTube video and save it to a file in the current directory. It will skip downloading the actual video file, and it will continue even if some errors occur during the process.
This command can be useful if you only need the thumbnail image of a YouTube video and don't want to download the entire video file, which can save time and disk space.
4.18. Stream Videos Directly to a Media Player
To stream media directly to your media player, you need to instruct yt-dlp to stream to stdout using the '-o -
' option. Additionally, your media player should be capable of reading from stdin.
You can achieve this by piping the output of yt-dlp to your media player. For example, to stream to VLC, you can use the following command:
yt-dlp -o - "https://www.youtube.com/watch?v=t5b20oLaIaw" | vlc -
If you have ffmpeg installed, you can use the '-o - --downloader ffmpeg -f "bv*+ba/b"
' options when streaming to stdout to get the best available quality."
4.19. Access Youtube-dl Help
While these examples should suffice for using yt-dlp to download online videos, it's worth noting that yt-dlp offers a wide array of additional options. For in-depth information, you can consult the yt-dlp help section by executing:
yt-dlp --help
5. Troubleshooting yt-dlp
Below, you'll find a list of common errors that you may encounter occasionally. The majority of these issues can be resolved by updating yt-dlp to the latest version.
However, there are a few errors, like the ones listed below, that may persist even when using an updated version of Youtube-dl.
5.1. Fix "Unable to download video data: HTTP Error 403: Forbidden" Error
When downloading videos from YouTube, sometimes you will get an error like below.
ERROR: unable to download video data: HTTP Error 403: Forbidden
To fix this error, simply clear the yt-dlp cache using the following command:
$ yt-dlp --rm-cache-dir
Removing cache dir /home/ostechnix/.cache/yt-dlp …
5.2. Error: Unable to Open for Writing: [Errno 36] File Name Too Long
If you encounter this error while attempting to download a YouTube video with a lengthy name, follow these steps to resolve it:
You will likely see an error message similar to this one:
[youtube] _XEgknKEBws: Downloading webpage ERROR: unable to open for writing: [Errno 36] File name too long: '\xe0\xae\xa8\xe0\xaf\x8b [...] \xe0\xaf\x8d\xe0\xae\x95\xe0\xae\xae\xe0\xaf\x8d-_XEgknKEBws.f136.mp4.part
To resolve this error, simply download the video with a shorter name of your choice using the "-o
" flag. For example:
yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]' -o video.mp4 <URL>
In this command, the "-o
" flag allows you to specify a custom name for the downloaded video, ensuring it has a shorter filename.
6. yt-dlp Cheat Sheet
This cheatsheet provides you with some essential yt-dlp commands to get you started on downloading videos and playlists efficiently.
Basic Download:
Download a Video:
yt-dlp <video_url>
Download a Playlist:
yt-dlp <playlist_url>
Format Selection:
Select Best Quality:
yt-dlp -f best <video_url>
Select Specific Format:
yt-dlp -f <format_id> <video_url>
Audio-Only Format:
yt-dlp -f bestaudio <video_url>
Download Options:
Limit Download Speed:
yt-dlp -r 50K <video_url>
Resume Download:
yt-dlp -c <video_url>
Filtering:
Filter by Date:
yt-dlp --date 20230101 <video_url>
Filter by Age Limit:
yt-dlp --age-limit 18 <video_url>
Filter by Title:
yt-dlp --match-title "keyword" <playlist_url>
Advanced:
Download by Format Codes:
yt-dlp -f 22,17,18 <video_url>
Download by File Extension:
yt-dlp --format mp4 <video_url>
Set Size Limit:
yt-dlp --min-filesize 100M <playlist_url>
Download Specific Videos from Playlist:
yt-dlp --playlist-items 1,3,5 <playlist_url>
Download Thumbnails:
yt-dlp --ignore-errors --write-thumbnail --skip-download $1 $2 $3 <video_url>
Remember to replace <video_url>
and <playlist_url>
with the actual URLs you want to download from.
7. Yt-dlp Commands Cheatsheet Image
If you often use yt-dlp to download media, you can use this cheatsheet for a quick reference.
8. Frequently Asked Questions
The following are Frequently Asked Questions (FAQ) for yt-dlp.
A: yt-dlp is a command-line program used to download videos and playlists from various websites, including YouTube. It is a fork of youtube-dl with additional features and improvements.
A: You can install yt-dlp on Linux, macOS, and Windows using wget
or curl
or pip
. On Linux, you can also use package managers like apt
or dnf
on Debian/Ubuntu or Fedora, respectively. For detailed installation instructions, refer to the Install yt-dlp section above.
A: Yes, you can use yt-dlp on Android by installing it through the Termux app. Refer to the documentation for specific instructions on setting up yt-dlp on Android.
A: You can update yt-dlp by running this command: yt-dlp -U
This will fetch and install the latest version of yt-dlp.
A: yt-dlp offers a range of options to specify the format or quality of downloaded videos. You can use the -f
or --format
flag followed by format codes to select a specific format or quality.
A: Yes, you can download only the audio of a video using yt-dlp. Use the -x
flag to extract audio, and specify the desired audio format with --audio-format
. For example:yt-dlp -x --audio-format mp3
A: To limit the download speed, use the -r
flag followed by the desired speed in bytes per second. For example, to limit the speed to 50KB/s:yt-dlp -r 50K <video_url>
A: yt-dlp allows you to filter videos by their upload date. Use --date
, --datebefore
, or --dateafter
flags followed by the date in the format YYYYMMDD to specify your filter criteria.
A: Yes, yt-dlp can be integrated into scripts and automated workflows. You can use it with various scripting languages to perform batch downloads, schedule downloads, and more.
A: Yes, yt-dlp supports a wide range of websites, not just YouTube. You can use it to download videos and playlists from various online platforms.
A: yt-dlp itself is a legal tool for downloading publicly available videos. However, it's important to respect copyright and intellectual property rights when using yt-dlp, and avoid downloading content without proper authorization.
Conclusion
In this tutorial, we have learned some of the most commonly used yt-dlp commands to download videos and audio from YouTube and various other websites.
yt-dlp is one of my favorite downloader program for Linux. It offers a versatile and comprehensive set of features for downloading videos and playlists from hundreds of websites.
If you're looking for a best audio/video downloader for Linux, yt-dlp is worth trying!
Resource:
Suggested read:
2 comments
Best tutorial on the whole web!! THANK YOU!!
great! thanx!