Upon downloading a playlist, i get the regex error
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1487, in __call__
return self.func(*args)
File "C:/Users/nicto/PycharmProjects/idk/playlist activator/playlist downloader.py", line 40, in func
pl.download_all('C:\\pythonpractice\music')
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\contrib\playlist.py", line 150, in download_all
yt = YouTube(link)
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\__main__.py", line 88, in __init__
self.prefetch_init()
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\__main__.py", line 97, in prefetch_init
self.init()
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\cipher.py", line 69, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\cipher.py", line 45, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "C:\Users\nicto\PycharmProjects\idk\venv\lib\site-packages\pytube\helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
yeah, I am experiencing same error since few hours ago.
google may have changed their regex pattern again.
I downloaded the latest changes from this repo and have same error.
same problem, py3.5, re-installed with latest pytube, get this with valid code:
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 88, in __init__
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 97, in prefetch_init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 133, in init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/mixins.py", line 49, in apply_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 250, in get_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 69, in get_transform_plan
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 45, in get_initial_function_name
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/helpers.py", line 41, in regex_search
pytube.exceptions.RegexMatchError: regex pattern (yt.akamaized.net/)\s\|\|\s.?\sc\s&&\sd.set([^,]+\s,\s(?P
and can reproduce in python3 console:
import pytube
youtube = pytube.YouTube(some_url)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 88, in __init__
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 97, in prefetch_init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 133, in init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/mixins.py", line 49, in apply_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 250, in get_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 69, in get_transform_plan
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 45, in get_initial_function_name
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/helpers.py", line 41, in regex_search
pytube.exceptions.RegexMatchError: regex pattern (yt.akamaized.net/)\s\|\|\s.?\sc\s&&\sd.set([^,]+\s,\s(?P
File "/usr/local/lib/python3.5/site-packages/pytube/helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt.akamaized.net/)\s\|\|\s.?\sc\s&&\sd.set([^,]+\s,\s(?P
Same error but it occurs intermittently
yes, we have the same problem with this video https://youtu.be/zGpVuknnN78?t=60
Experienced same error. In cipher.py replace the regexs in pattern in get_initial_function_name with:
r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('.
Experienced same error. In
cipher.pyreplace the regexs inpatterninget_initial_function_namewith:
r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('.
This change seems working ok. Thanks!
Same error.

@yelosheng It doesn't look like you updated your regex. See my comment above or pull the most recent version of the lib.
FYI if you want to install the latest source directly from github using pip, type this in your command line:
pip install git+https://github.com/nficano/pytube.git
pip install git+https://github.com/nficano/pytube.git
This one is works fine
Thanks,
broke again. applied the fix, working since 2018NOV20 as of 3 Dec 09:54 AEST failed.
File "./py.py", line 57, in main
youtube = YouTube(url)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 88, in __init__
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 97, in prefetch_init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/__main__.py", line 133, in init
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/mixins.py", line 49, in apply_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 250, in get_signature
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 69, in get_transform_plan
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/cipher.py", line 45, in get_initial_function_name
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pytube-9.3.4-py3.5.egg/pytube/helpers.py", line 41, in regex_search
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
DEC05
Works again?
Just started getting this error again. Updated to v9.3.5 same thing.
Link: https://www.youtube.com/watch?v=0T4nSXULU-k
Traceback (most recent call last):
File "filename.py", line 10, in <module>
YouTube(link).streams.first().download()
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/cipher.py", line 69, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/cipher.py", line 45, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "/home/yeet/.local/lib/python3.6/site-packages/pytube/helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
Just installed. Getting regex fail:
C:\hiddenpathname>python -m pip install pytube
Collecting pytube
Downloading https://files.pythonhosted.org/packages/af/56/c9b484e93e1f3a4ef6aefbc1e68258121831007938556daf968ab4519c9c/pytube-9.3.5-py3-none-any.whl
Installing collected packages: pytube
The script pytube.exe is installed in 'C:\hiddenpathname\AppData\Local\Programs\Python\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pytube-9.3.5
Here's the regex fail:
>>> yt = YouTube('https://www.youtube.com/watch?v=-f1DNyngKVY')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
yt = YouTube('https://www.youtube.com/watch?v=-f1DNyngKVY')
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\__main__.py", line 88, in __init__
self.prefetch_init()
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\__main__.py", line 97, in prefetch_init
self.init()
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\cipher.py", line 69, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\cipher.py", line 45, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "C:\Users\bogusname\AppData\Local\Programs\Python\Python37\lib\site-packages\pytube\helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
Same problem here
yt = YouTube("https://www.youtube.com/watch?v=YkADj0TPrJA")
result:
Traceback (most recent call last):
File "main.py", line 34, in <module>
yt = YouTube("https://www.youtube.com/watch?v=YkADj0TPrJA")
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/cipher.py", line 69, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/cipher.py", line 45, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "/home/kusko/.local/lib/python3.6/site-packages/pytube/helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
pip install git+https://github.com/nficano/pytube.git
This one is works fine
Thanks,
Tested on Dec 19th . Works fine with python 2.7 .. Thanks :) :+1:
r'\bc\s&&\sd.set([^,]+\s,\s([^)])\s(\s*(?P
[a-zA-Z0-9$]+)('
Worked here! Thank you so much
Still not working, with pytube-9.3.5 and r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('
>>> yt = YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "/application/python/lib/python3.6/site-packages/pytube/mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 69, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 45, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "/application/python/lib/python3.6/site-packages/pytube/helpers.py", line 41, in regex_search
.format(pattern=p),
pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
Still not working, with pytube-9.3.5 and
r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('
>>> yt = YouTube('https://www.youtube.com/watch?v=9bZkp7q19f0') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 88, in __init__ self.prefetch_init() File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 97, in prefetch_init self.init() File "/application/python/lib/python3.6/site-packages/pytube/__main__.py", line 133, in init mixins.apply_signature(self.player_config_args, fmt, self.js) File "/application/python/lib/python3.6/site-packages/pytube/mixins.py", line 49, in apply_signature signature = cipher.get_signature(js, stream['s']) File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 250, in get_signature tplan = get_transform_plan(js) File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 69, in get_transform_plan name = re.escape(get_initial_function_name(js)) File "/application/python/lib/python3.6/site-packages/pytube/cipher.py", line 45, in get_initial_function_name return regex_search(pattern, js, group=1) File "/application/python/lib/python3.6/site-packages/pytube/helpers.py", line 41, in regex_search .format(pattern=p), pytube.exceptions.RegexMatchError: regex pattern (yt\.akamaized\.net/\)\s*\|\|\s*.*?\s*c\s*&&\s*d\.set\([^,]+\s*,\s*(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
I'm also using pytube 9.3.5 but with Python 3.7. I change in the cypher.py file and works great
I'll try 3.7. Thank you @JakLeg
I experienced the error in #336 and 9.3.6 solves this issue. Any idea when it is going to be available through pip without pointing to the git repo (although I know that you can have git repos in the requirements.txt)
I think this error appears in a copyrighted video.
I did what he said and I can download all the videos, even that you posted (Paint It Black Video). Check it out https://youtu.be/Ufw5KbcT3OU
I did what he said and I can download all the videos, even that you posted (Paint It Black Video). Check it out https://youtu.be/Ufw5KbcT3OU
It's actually working for me since I replaced the text in the Cypher file. I thought for sure I deleted my post, but somehow people are still seeing it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Experienced same error. In
cipher.pyreplace the regexs inpatterninget_initial_function_namewith:r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('.