pytube.exceptions.CipherError: Couldn't cipher the signature.

Created on 23 Jun 2016  路  7Comments  路  Source: pytube/pytube

Py27, OSX & CentOS 6.5, latest pip, latest pytube.

Steps to recreate:

`>>> from pytube import YouTube

yt = YouTube()
yt.from_url("https://www.youtube.com/watch?v=162yTv8rOS8")
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/pytube/api.py", line 189, in from_url
signature = self._get_cipher(stream_map["s"][i], js_url)
File "/usr/local/lib/python2.7/site-packages/pytube/api.py", line 379, in _get_cipher
"issue on GitHub: {0}".format(e))
pytube.exceptions.CipherError: Couldn't cipher the signature. Maybe YouTube has changed the cipher algorithm. Notify this issue on GitHub: Could not find JS function u'ur'`

I've just noticed this as of today -- perhaps YT's changed their frontend junk again?

All 7 comments

Here's the fix in jsinterp.py:

def extract_function(self, funcname): func_m = re.search( r'''(?x) (?:function\s+%s|[{;,]\s*%s\s*=\s*function|var\s+%s\s*=\s*function)\s* \((?P<args>[^)]*)\)\s* \{(?P<code>[^}]+)\}''' % ( re.escape(funcname), re.escape(funcname), re.escape(funcname)), self.code)

At the offset origin: {;,]*%s, change the regex to match: {;,]\s*%s and it'll work.

Don't be lazy -- please merge this soon :)

I'd merge it quicker if it was a pull request :)

I'm lazy and balls-deep into some crap at work, else I'd have flown one up; thanks man! Sorry for the passive-aggressive bugreport; you're doing some great work here!

Hello wanted to ask if the problem had been solved.
I am continuing to experience.
I thank you for all the work you do.

@Vaaron @ebelliveau all fixed. pip install -U pytube

Thank u for all!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kpister picture kpister  路  23Comments

NeverAskWhy picture NeverAskWhy  路  62Comments

stdedos picture stdedos  路  24Comments

stephanemombuleau picture stephanemombuleau  路  19Comments

aklajnert picture aklajnert  路  23Comments