youtube-dl | Command-line program to download videos from YouTubecom and other video sites | Machine Learning library

 by   ytdl-org Python Version: 2021.12.17 License: Unlicense

kandi X-RAY | youtube-dl Summary

kandi X-RAY | youtube-dl Summary

youtube-dl is a Python library typically used in Telecommunications, Media, Media, Entertainment, Artificial Intelligence, Machine Learning applications. youtube-dl has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install youtube-dl' or download it from GitHub, PyPI.

youtube-dl is a command-line program to download videos from and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on macOS. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.

            kandi-support Support

              youtube-dl has a highly active ecosystem.
              It has 121085 star(s) with 9048 fork(s). There are 2206 watchers for this library.
              It had no major release in the last 12 months.
              There are 3822 open issues and 22277 have been closed. On average issues are closed in 100 days. There are 909 open pull requests and 0 closed requests.
              It has a negative sentiment in the developer community.
              The latest version of youtube-dl is 2021.12.17

            kandi-Quality Quality

              youtube-dl has 0 bugs and 0 code smells.

            kandi-Security Security

              youtube-dl has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              youtube-dl code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              youtube-dl is licensed under the Unlicense License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              youtube-dl releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 129798 lines of code, 3522 functions and 888 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed youtube-dl and discovered the below as its top functions. This is intended to give you an instant insight into youtube-dl implemented functionality, and help decide if they suit your requirements.
            • Return random user agent .
            • Parse options .
            • Main function .
            • Parse an expression .
            • Extract video data from url .
            • Process info_dict .
            • Parse MPD format .
            • Extract mvpd auth data .
            • Login .
            • Get information about a video .
            Get all kandi verified functions for this library.

            youtube-dl Key Features

            No Key Features are available at this moment for youtube-dl.

            youtube-dl Examples and Code Snippets

            OPTIONS-Video Selection:
            Pythondot img1Lines of Code : 64dot img1License : Permissive (Unlicense)
            copy iconCopy
            --playlist-start NUMBER              Playlist video to start at (default is
            --playlist-end NUMBER                Playlist video to end at (default is
            OPTIONS-Post-processing Options:
            Pythondot img2Lines of Code : 60dot img2License : Permissive (Unlicense)
            copy iconCopy
            -x, --extract-audio                  Convert video files to audio-only files
                                                 (requires ffmpeg/avconv and
            --audio-format FORMAT                Specify audio for  
            OPTIONS-Filesystem Options:
            Pythondot img3Lines of Code : 46dot img3License : Permissive (Unlicense)
            copy iconCopy
            -a, --batch-file FILE                File containing URLs to download ('-'
                                                 for stdin), one URL per line. Lines
                                                 starting with '#', ';' or ']' are
            discord.ext.commands.errors.CommandNotFound: Command "play" is not found
            Pythondot img4Lines of Code : 12dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            async def setup():
                await bot.wait_until_ready()
            # Cog declaration
            Get video from Youtube-DL is not working properly
            Pythondot img5Lines of Code : 29dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from youtube_dl import YoutubeDL
            link = ""
            with YoutubeDL({}) as ydl:
                info = ydl.extract_info(link, download=False)
                for i, format in enumerate(info['formats']):
                    print(f"[{i}] {fo
            Passing configs from `.txt` file into argparse? (Similar to youtube-dl's `--config-location`)
            Pythondot img6Lines of Code : 11dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            parser = ArgumentParser(fromfile_prefix_chars='@')
            This is the first config
            2nd Config
            AttributeError: 'tuple' object has no attribute 'add_cog'
            Pythondot img7Lines of Code : 4dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            client = discord.Client(), commands.Bot(command_prefix='please ', intents = discord.Intents.all())
            client = commands.Bot(command_prefix='please ', intents = discord.Intents.all())
            FFmpeg Minimize memory usage or add timeout to youtube-dl
            Pythondot img8Lines of Code : 7dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            ffmpeg -y -loglevel verbose -headers 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.67 Safari/537.36\
            Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\
            Accept: text/html,applica
            Commands inside a Cog not working
            Pythondot img9Lines of Code : 7dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import os
            import re
            for filename in os.listdir('./cogs'):
              if filename.endswith('.py'):
            youtube_dl.utils.SameFileError | python, youtube_dl
            Pythondot img10Lines of Code : 2dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy

            Community Discussions


            python modules ffmpeg and ffprobe are installed but youtube-dl not able to find
            Asked 2022-Mar-31 at 23:30

            I'm using python 3.8 on MacOS Big Sur

            I installed python module package for youtube-dl with



            Answered 2021-Dec-31 at 04:07

            Check the Path environment variable. It should contain an entry for the folder that ffprobe and ffmpeg are in.

            EDIT: My bad, check this Reddit thread.

            It seems you might have to install the command-line tool.



            Passing configs from `.txt` file into argparse? (Similar to youtube-dl's `--config-location`)
            Asked 2022-Mar-25 at 18:04

            I have a program with ~20 configs, which I would like to be accessed from the command-line via argparse, either by something like --config_1 'This is the first config' or --config-location , where the path to the config file would be a .txt of form:



            Answered 2022-Mar-25 at 18:04

            argparse supports something similar out of the box.



            mpv doesn't recognise ytdl_path as a key
            Asked 2022-Feb-19 at 18:05

            I'm trying to use yt-dlp rather than youtube-dl due to the bottlenecking on download speeds in youtube-dl but I can't get it to work.

            My mpv.conf file looks like:


            When trying to get mpv to run I get this warning:

            [ytdl_hook] script-opts: unknown key ytdl_path, ignoring

            Does anyone know what the problem is? I've read through the mpv docs and it says this should work.

            mpv is version 0.27.2



            Answered 2022-Feb-19 at 18:05

            I had the same problem as you, on mpv version 0.32.0. The problem is that the ytdl-hook settings category is not an option in these older versions. Your solutions are to update your mpv version or to create a link from youtube-dl to yt-dlp. Hope this helps.



            Change name of audio file downloaded from youtube-dl
            Asked 2022-Feb-12 at 13:22

            I am writing a shell script to download audio.

            I used youtube-dl -f 'bestaudio[ext=m4a]' The resulting file is the title along with-mSc76Q90C4.m4a where m4a is the format

            I would like to set the filename during download and also have it in .wav format

            PS: To covert to .wav, I tried youtube-dl -f 'bestaudio[ext=wav]' but it did not seem to work. Error thrown is basically - cannot use specified format.

            Here is the relavent part of my shell script



            Answered 2022-Feb-12 at 13:22

            In the documentation of youtube-dl you'll find a --output option that lets you set the filename directly:



            FFmpeg Minimize memory usage or add timeout to youtube-dl
            Asked 2022-Feb-09 at 12:01

            So I am using FFmpeg to download an m3u8 stream. For optimization, I tried running the FFmpeg directly instead of using youtube-dl with it. But for some reason, the ffmpeg.exe uses 140 MB of memory while ffmpeg.exe via youtube-dl uses only 14 MB of memory.

            So I have two questions:

            • Is there a way to minimize the direction FFmpeg memory usage
            • Add a timer (custom command) to FFmpeg via youtube-dl. FFmpeg has a build-in command -t (seconds). Is there a way to use it via youtube-dl?

            FFmpeg directly (140MB in memory):



            Answered 2022-Jan-07 at 20:48

            youtube-dl on linux with the link you provided seems to launch ffmpeg with theses arguments:



            Pafy Youtube Error 403 when converting video
            Asked 2022-Feb-05 at 18:52

            I'm getting this error when converting a video using pafy



            Answered 2022-Feb-05 at 18:52

            You have done too many API actions in YouTube. If you reach 10.000 points per day you are limited. Read about it here:

            And you can read about similar things in another StackOverflow Question.



            Convert variable string to time object
            Asked 2022-Feb-02 at 11:40

            I'm working with youtube-dl (subprocess), it gives the video duration like this:

            • if it's 00:00:08, it gives: 8.
            • 00:03:42 > 3:42.
            • 00:03:08 > 3:08.
            • 01:02:06 > 1:02:06.

            I want to convert the code formats to the bold!
            Tried this but it gives error:



            Answered 2022-Feb-02 at 11:30


            How to check if programm installed with cmd
            Asked 2021-Dec-02 at 13:49
            @echo off 
            color 06
            title created by AAIE
            @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
            choco install youtube-dl
            set /p input="Enter Link For Playlist:" 
            set /p index="Enter Index For videos Seprated by ',':"
            mkdir playlist_videos
            cd playlist_videos
            youtube-dl --playlist-items %index% %input%


            Answered 2021-Dec-02 at 13:49

            Here are some examples using where to locate and perform actions based on the result:



            Django PIPE youtube-dl to view for download
            Asked 2021-Nov-11 at 08:47

            TL;DR: I want to pipe the output of youtube-dl to the user's browser on a button click, without having to save the video on my server's disk.

            So I'm trying to have a "download" button on a page (django backend) where the user is able to download the video they're watching. I am using the latest version of youtube-dl. In my download view I have this piece of code:



            Answered 2021-Nov-11 at 08:47

            I did a workaround. I download the file with a specific name, I return the view with HttpResponse, with force-download content-type, and then delete the file using python. It's not what I originally had in mind, but it's the second best solution that I could come up with. I will select this answer as accepted solution until a Python wizard gives a solution to the original question. The code that I have right now:



            Python buffered IO ending early streaming with multiple pipes [BOUNTY]
            Asked 2021-Nov-07 at 18:06

            I'm trying to make a continuous livestream of videos downloaded via yt-dlp. I need to port this (working) bash command into Python.



            Answered 2021-Nov-07 at 18:06

            Closing the stdin pipe is required for "pushing" the sub-process remaining (buffered) data to stdout pipe.

            For example, add encoder_p.stdin.close() after finish writing all data to encoder_p.stdin.

            I don't understand how your code is working.
            In my machine, it gets stack at encoder_buf =

            I solved the problem using a "writer thread".
            The "writer thread" reads data from yt_dlp_p and write it to encoder_p.stdin.

            Note: In your specific case, it could work without a thread (because the data is just passed through FFmpeg, and not being encoded), but usually, the encoded data is not ready right after writing the input to FFmpeg.

            My code sample uses FFplay sub-process for playing the video (we need the video player because the RTMP streaming requires a "listener" in order to keep streaming).

            Here is a complete code sample:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install youtube-dl

            To install it right away for all UNIX users (Linux, macOS, etc.), type:.


            As a matter of policy (as well as legality), youtube-dl does not include support for services that specialize in infringing copyright. As a rule of thumb, if you cannot easily find a video that the service is quite obviously allowed to distribute (i.e. that has been uploaded by the creator, the creator's distributor, or is published under a free license), the service is probably unfit for inclusion to youtube-dl. A note on the service that they don't host the infringing content, but just link to those who do, is evidence that the service should not be included into youtube-dl. The same goes for any DMCA note when the whole front page of the service is filled with videos they are not allowed to distribute. A "fair use" note is equally unconvincing if the service shows copyright-protected videos in full without authorization. Support requests for services that do purchase the rights to distribute their content are perfectly fine though. If in doubt, you can simply include a source that mentions the legitimate purchase of content.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries