Pytube: ImportError: cannot import name 'quote' from 'pytube.compat'

Created on 17 Mar 2020  路  18Comments  路  Source: pytube/pytube

When I try to run

from pytube import Youtube

It crashes and emits this error

ImportError: cannot import name 'quote' from 'pytube.compat'

Most helpful comment

pip install pytube3 worked for me

All 18 comments

pip install pytube3 worked for me

Yes you can try pip install pytube3, it also worked for me

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3

it will work out

Thanks all!!

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3

it will work out

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3

it will work out

It is still showing error

from pytube import YouTube
YouTube("http://youtube.com/watch?v=9bZkp7q19f0").streams.first()

Traceback (most recent call last):
File "C:/Users/Lenovo/Desktop/Folder/Projects/python/YTDownloder/downloder.py", line 1, in
from pytube import YouTube
ImportError: cannot import name 'YouTube'

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3
it will work out

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3
it will work out

It is still showing error

from pytube import YouTube
YouTube("http://youtube.com/watch?v=9bZkp7q19f0").streams.first()

Traceback (most recent call last):
File "C:/Users/Lenovo/Desktop/Folder/Projects/python/YTDownloder/downloder.py", line 1, in
from pytube import YouTube
ImportError: cannot import name 'YouTube'

try this:
pytube.YouTube("http://youtube.com/watch?v=9bZkp7q19f0").streams.first()

remove yuor current python ver..
Install python 3.7.7
will work like a charm

-> install library:
pip uninstall pytube
pip install pytube3
-> inside:
pip/pytube/extract.py
-> find:
parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
-> change it to:
parse_qs(formats[i]["signatureCipher"]) for i, data in enumerate(formats)
-> use pytube:

from pytube import YouTube
import os
def downloadYoutube(vid_url, path):
yt = YouTube(vid_url)
yt = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
if not os.path.exists(path):
os.makedirs(path)

yt.download(path)

url = input('Input url:\n')
path = input('Path to store file:\n')
downloadYoutube(url, path)

pip uninstall pytube successfully uninstall
run command >> pip install pytube3

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3
it will work out

try using pip install pytube3
Note: make sure to uninstall the formal version of pytube
then reinstall pytube3
it will work out

It is still showing error

from pytube import YouTube
YouTube("http://youtube.com/watch?v=9bZkp7q19f0").streams.first()

Traceback (most recent call last):
File "C:/Users/Lenovo/Desktop/Folder/Projects/python/YTDownloder/downloder.py", line 1, in
from pytube import YouTube
ImportError: cannot import name 'YouTube'

hey are you making a youtube video downloader?is it completed? do tell me cuz i need help too.

@Dhruv200329, have you uninstalled the previous version of pytube on your machine?, if not you'll keep getting the error message, after this re-install pytube3 and it will work, cheers.

pip install pytube3.........it's working

Hello I face the same problem with pytube
I tried to uninstall it but the compiler give me the following
any
pip uninstall
help please

Hello I face the same problem with pytube
I tried to uninstall it but the compiler give me the following
any
pip uninstall
help please

try.
pip install pytube3

@kiloActual thanks bro I tried but no solution

  1. Uninstall any previous pytube versions (either pytube/pytube3)

  2. Perform a clean start in conda/python environment as "pip install pytube3"

  3. Go to the package location of pytube and look for file pytube/extract.py

  4. Look for the line "parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)"

  5. Change "cipher" ---> "signatureCipher"

It will eventually work. I am using python version 3.7.7

pip install pytube3 worked for me

It good working..........

pip install pytube3 worked with me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JMIdeaMaker picture JMIdeaMaker  路  20Comments

RONNCC picture RONNCC  路  29Comments

stephanemombuleau picture stephanemombuleau  路  19Comments

SnoopiACK picture SnoopiACK  路  28Comments

waterholic picture waterholic  路  24Comments