Git Product home page Git Product logo

python-download-youtube-video's Introduction

Python-Download-Youtube-Video

⬇️ Install pytube

pip install pytube # python2
pip3 install pytube # python3
pip install pytube3 # if not work with pytube.

▶️ How to run

  • Clone the repository:
    git clone https://github.com/ForestCrazy/Python-Download-Youtube-Video.git

  • cd into directory into your command prompt:
    cd Python-Download-Youtube-Video

  • Run the download_video.py file:
    python download_video.py --url "url_youtube_video"

  • If you want to download the playlist then run the download_playlist.py:
    python download_playlist.py --url "url_youtube_playlist"

❗ Fix Error

Traceback (most recent call last):
  File "C:\Python36-64\lib\site-packages\pytube\extract.py", line 297, in apply_descrambler
    for format_item in formats
  File "C:\Python36-64\lib\site-packages\pytube\extract.py", line 297, in <listcomp>
    for format_item in formats
KeyError: 'url'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "download_video.py", line 10, in <module>
    youtube = YouTube(args.url)
  File "C:\Python36-64\lib\site-packages\pytube\__main__.py", line 92, in __init__
    self.descramble()
  File "C:\Python36-64\lib\site-packages\pytube\__main__.py", line 132, in descramble
    apply_descrambler(self.player_config_args, fmt)
  File "C:\Python36-64\lib\site-packages\pytube\extract.py", line 301, in apply_descrambler
    parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
  File "C:\Python36-64\lib\site-packages\pytube\extract.py", line 301, in <listcomp>
    parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
KeyError: 'cipher'
  1. Go to the location where the package was installed. If you don't know where, run the command
    pip show pytube3
    And it'll give you something like this:
    pip show pytube3
    We can see Location: c:\python36-64\lib\site-packages

  2. Go to that location, open the folder pytube and the file extract.py
    folder pytube

  3. In the file, line no. 306 or 301, you will find parse_qs(formats[i]["cipher"]). If yes, then change "cipher" to "signatureCipher"

So, you'll initially have

cipher_url = [
                parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
            ]

but it should be

cipher_url = [
                parse_qs(formats[i]["signatureCipher"]) for i, data in enumerate(formats)
            ]

python-download-youtube-video's People

Contributors

forestcrazy avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

neipol-online

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.