Closed 7a35090f closed 4 years ago
no, i'm getting the same error
Did you use "pip install pytube" or "pip install pytube3" ? if it's the first then uninstall it then install the latter
pytube 3.
pytube alone gave me other errors which can be seen in #672
Videos that require to extract js player broken
Traceback (most recent call last): File "pytube/main.py", line 92, in init self.descramble() File "pytube/main.py", line 136, in descramble apply_signature(self.player_config_args, fmt, self.js) File "pytube/extract.py", line 225, in applysignature cipher = Cipher(js=js) File "pytube/cipher.py", line 32, in init var, = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
check the value of js in Cipher/init_ class Cipher: def init(self, js: str):
It is changed to:
['var b=[-1215677809,null,-1744521562,833462946,694270393,function(c,d){d=(d%c', 'length+c', 'length)%c', 'length']
no more:
['DE.AJ(a,15)', 'DE.VR(a,3)', 'DE.AJ(a,51)', 'DE.VR(a,3)', 'DE.kT(a,51)', 'DE.kT(a,8)', 'DE.VR(a,3)', 'DE.kT(a,21)']
Videos that require to extract js player broken
Traceback (most recent call last): File "pytube/main.py", line 92, in init self.descramble() File "pytube/main.py", line 136, in descramble apply_signature(self.player_config_args, fmt, self.js) File "pytube/extract.py", line 225, in applysignature cipher = Cipher(js=js) File "pytube/cipher.py", line 32, in init var, = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
check the value of js in Cipher/init_ class Cipher: def init(self, js: str):
It is changed to:
['var b=[-1215677809,null,-1744521562,833462946,694270393,function(c,d){d=(d%c', 'length+c', 'length)%c', 'length']
no more:
['DE.AJ(a,15)', 'DE.VR(a,3)', 'DE.AJ(a,51)', 'DE.VR(a,3)', 'DE.kT(a,51)', 'DE.kT(a,8)', 'DE.VR(a,3)', 'DE.kT(a,21)']
Can you elaborate further?
i've been getting the same problem. It's weird cause I didn't have this problem earlier today...
i've been getting the same problem. It's weird cause I didn't have this problem earlier today...
Yea exactly the same for me. Youtube changed something, now we need the fix for the code.
I'm also getting the same problem.
i have the same problem as well. pytube3==9.6.4 python3.7.6
Same problem here
@ZippyDoodah123 would appreciate a PR (and I can merge ๐ ) to fix this issue
Youtube probably changed something.
I tried to change this line (cipher.py line 31):
var, _ = self.transform_plan[0].split(".")
To this:
var = self.transform_plan[0].split(".")[0]
But now getting this error:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 92, in __init__
self.descramble()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 140, in descramble
apply_signature(self.player_config_args, fmt, self.js)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/extract.py", line 225, in apply_signature
cipher = Cipher(js=js)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 33, in __init__
self.transform_map = get_transform_map(js, var)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 198, in get_transform_map
transform_object = get_transform_object(js, var)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 180, in get_transform_object
raise RegexMatchError(caller="get_transform_object", pattern=pattern)
pytube.exceptions.RegexMatchError: get_transform_object: could not find match for var var\ b=\[\-1215677809,null,\-1744521562,833462946,694270393,function\(c,d\)\{d=\(d%c={(.*?)};
Welp, doesn't need to take a full week to have another cipher problem. :(
@light42 sorry about the frustration - is there something I can do to help
@RONNCC I'm cool, just give me good alternatives to scrap youtube videos while this issue is being resolved.
you can use youtube-dl maenwhile ๐คจ
I use this workaround until bug is fixed:
import os
def download_video(self, video_id):
url = "https://www.youtube.com/watch?v={}".format(video_id)
os.system('youtube-dl "{}" --no-check-certificate'.format(url))
You need to install Youtube-DL for that
@zuntah thank you.
Facing the same error from today morning.(28.07.2020) "ValueError: too many values to unpack (expected 2)"
Ran into this error in my main file i was using.
So i made the most basic version i could and still got that error. Running in python 3.8 64 bit
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=jNQXAC9IVRw')
Error thrown:
Traceback (most recent call last): File "c:\Users\user\Documents\My scripting projects\yt download testr\test.py", line 4, in <module> yt = YouTube('https://www.youtube.com/watch?v=jNQXAC9IVRw') File "C:\Python38\lib\site-packages\pytube\__main__.py", line 92, in __init__ self.descramble() File "C:\Python38\lib\site-packages\pytube\__main__.py", line 140, in descramble apply_signature(self.player_config_args, fmt, self.js) File "C:\Python38\lib\site-packages\pytube\extract.py", line 225, in apply_signature cipher = Cipher(js=js) File "C:\Python38\lib\site-packages\pytube\cipher.py", line 31, in __init__ var, _ = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
Is it just me or are you guys getting this error also?
Yes I'm facing same problem today. My program run 20 hour's ago perfectly but now its showing me this problem
The problem is most probably youtube changed the js file and the regular expressions are no longer working:
pytube.cipher.get_initial_function_name
I don't have time to fix this, hopefully someone can pick it up.
Great fix @belthaZornv !
the fix doesnt work for me :/
the fix doesnt work for me :/
Are you using pytube or pytube3?
pytube3 python 3.7 ubuntu 18.04
I have the same issue starting today on my telegram chatbot
Weird since #701 fixed it for me.
Hmm. I suggest using youtube-dl anyway it can do everything pytube can and more. Try it til theres a fix that works for you!
having the same error in pytube3. Tried manually applying this fix into pytube3, and didn't work, got a cipher error. Maybe I was doing it wrong?
Will give it a try, thanks
@partriv I had trouble getting it to work too, what worked at the end was uninstalling, pytube3, installing pytubeX and replacing ALL the function patterns (not just the one changed) in cipher.py with the ones in #701 and obviously changing from extract.py in the line 301 the key from "cipher" to "signatureCipher"
Hope this helps ๐
PR Open: #701
thank you very much, i can down the youtube video now
@partriv
You can try to directly install the pull request version.
pip install git+https://github.com/nficano/pytube.git@refs/pull/701/head
ran pip install git+https://github.com/nficano/pytube.git@refs/pull/701/head
, still getting error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
video = YouTube("https://www.youtube.com/watch?v=3FSmZQ3LwG0")
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 92, in __init__
self.descramble()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 140, in descramble
apply_signature(self.player_config_args, fmt, self.js)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/extract.py", line 225, in apply_signature
cipher = Cipher(js=js)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 31, in __init__
var, _ = self.transform_plan[0].split(".")
ValueError: too many values to unpack (expected 2)
ran
pip install git+https://github.com/nficano/pytube.git@refs/pull/701/head
, still getting error:Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> video = YouTube("https://www.youtube.com/watch?v=3FSmZQ3LwG0") File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 92, in __init__ self.descramble() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 140, in descramble apply_signature(self.player_config_args, fmt, self.js) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/extract.py", line 225, in apply_signature cipher = Cipher(js=js) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 31, in __init__ var, _ = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
for me, I had to uninstall pytube3 and then only ran: pip install git+https://github.com/nficano/pytube.git@refs/pull/701/h
ran
pip install git+https://github.com/nficano/pytube.git@refs/pull/701/head
, still getting error:Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> video = YouTube("https://www.youtube.com/watch?v=3FSmZQ3LwG0") File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 92, in __init__ self.descramble() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/__main__.py", line 140, in descramble apply_signature(self.player_config_args, fmt, self.js) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/extract.py", line 225, in apply_signature cipher = Cipher(js=js) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pytube/cipher.py", line 31, in __init__ var, _ = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
for me, I had to uninstall pytube3 and then only ran: pip install git+https://github.com/nficano/pytube.git@refs/pull/701/h
Yeah, but this fix probably won't worked anymore now. I got this new error when trying to download video.
@light42 change key 'cipher' to 'signatureCipher' in extract.py
@light42 change key 'cipher' to 'signatureCipher' in extract.py
got it, but I think it would be better if the change is made directly on the pull request.
I patched and hosted this again. Looks like there was a merge conflict between this PR and #643
You can install directly from my repo like this:
pip install git+https://gitlab.com/obuilds/public/pytube@ob-v2
or add the following to your requirements.txt
git+https://gitlab.com/obuilds/public/pytube@ob-v2
@kbuilds if you could contribute a PR to fix this in main - I can help to get it merged ๐
Just merged #701 which should fix this -- please reopen if issue still persists!
Ran into this error in my main file i was using.
So i made the most basic version i could and still got that error. Running in python 3.8 64 bit
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=jNQXAC9IVRw')
Error thrown:
Traceback (most recent call last): File "c:\Users\user\Documents\My scripting projects\yt download testr\test.py", line 4, in <module> yt = YouTube('https://www.youtube.com/watch?v=jNQXAC9IVRw') File "C:\Python38\lib\site-packages\pytube\__main__.py", line 92, in __init__ self.descramble() File "C:\Python38\lib\site-packages\pytube\__main__.py", line 140, in descramble apply_signature(self.player_config_args, fmt, self.js) File "C:\Python38\lib\site-packages\pytube\extract.py", line 225, in apply_signature cipher = Cipher(js=js) File "C:\Python38\lib\site-packages\pytube\cipher.py", line 31, in __init__ var, _ = self.transform_plan[0].split(".") ValueError: too many values to unpack (expected 2)
Is it just me or are you guys getting this error also?