pytube.exceptions.RegexMatchError
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=DzowaU_KkPc")
print(yt.title)
Hi,
I get errors for most videos, too.
It started giving errors today, a few days ago everything worked as it should.
Maybe there was a change by YouTube?
Some kind of function renaming, so the regex doesn't find anything anymore?
Here the intersting part of my Stacktrace:
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/__main__.py", line 87, in __init__
self.prefetch_init()
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/__main__.py", line 96, in prefetch_init
self.init()
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/__main__.py", line 131, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/mixins.py", line 41, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/cipher.py", line 252, in get_signature
name, argument = parse_function(js_func)
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/cipher.py", line 228, in parse_function
return regex_search(r'\w+.(\w+)(\w,(\d+))', js_func, groups=True)
File "/home/sebi/.local/lib/python3.5/site-packages/pytube/helpers.py", line 39, in regex_search
.format(pattern=pattern),
pytube.exceptions.RegexMatchError: regex pattern (\w+.(\w+)(\w,(\d+))) had zero matches
I am using the current version available via pip on python 3.5.
Thanks for this great project, pytube is awesome :)
Hi @ajayrandhawa
Did you manage to fix it?
Can you share your solution with me, please?
Even the example in the README is now broken:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytube import YouTube
>>> YouTube('https://youtu.be/9bZkp7q19f0').streams.first().download()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "(...)/pytube-9.2.2-py3.5.egg/pytube/__main__.py", line 87, in __init__
File "(...)/pytube-9.2.2-py3.5.egg/pytube/__main__.py", line 96, in prefetch_init
File "(...)/pytube-9.2.2-py3.5.egg/pytube/__main__.py", line 131, in init
File "(...)/pytube-9.2.2-py3.5.egg/pytube/mixins.py", line 41, in apply_signature
File "(...)/pytube-9.2.2-py3.5.egg/pytube/cipher.py", line 252, in get_signature
File "(...)/pytube-9.2.2-py3.5.egg/pytube/cipher.py", line 228, in parse_function
File "(...)/pytube-9.2.2-py3.5.egg/pytube/helpers.py", line 39, in regex_search
pytube.exceptions.RegexMatchError: regex pattern (\w+\.(\w+)\(\w,(\d+)\)) had zero matches
I think it is from youtube side. now my project works properly.
With pytube-9.2.2 on Python 2.7.15 the READM example above from @CNugteren is failing for me as well.
Anybody know what it going on with this?
My pytube was downloading strong and suddenly no videos work.
Here are my errors:
yt = pytube.YouTube(str(line))File "build/bdist.linux-armv6l/egg/pytube/__main__.py", line 88, in __init__
File "build/bdist.linux-armv6l/egg/pytube/__main__.py", line 97, in prefetch_init
File "build/bdist.linux-armv6l/egg/pytube/__main__.py", line 133, in init
File "build/bdist.linux-armv6l/egg/pytube/mixins.py", line 48, in apply_signature
File "build/bdist.linux-armv6l/egg/pytube/cipher.py", line 245, in get_signature
File "build/bdist.linux-armv6l/egg/pytube/cipher.py", line 64, in get_transform_plan
File "build/bdist.linux-armv6l/egg/pytube/cipher.py", line 40, in get_initial_function_name
File "build/bdist.linux-armv6l/egg/pytube/helpers.py", line 39, in regex_search
pytube.exceptions.RegexMatchError: regex pattern ("signature",\s?([a-zA-Z0-9$]+)() had zero matches
Any help is appreciated.
I was just learning to use pytube and I sumbled upon the same issue.
It crashes also due to that same RegexMatchError, at the moment of retrieving the video from YouTube (yt = YouTube(...whatever...)).
I had the same issue. Upgrade to pytube 9.2.3 and it worked again.
pip install pytube --upgrade
Updated to pytube 9.3.5 and still have the problem:
from pytube import YouTube
yt=YouTube('https://www.youtube.com/watch?v=FeIUmACQGOo')
RegexMatchError: regex pattern (yt.akamaized.net/)\s\|\|\s.?\sc\s&&\sd.set([^,]+\s,\s(?P
[a-zA-Z0-9$]+)() had zero matches
Using also pytube 9.3.5 and python 3.6.6 and also have the error on multiple videos in a playlist:
Error on download : regex pattern (yt.akamaized.net/)\s\|\|\s.?\sc\s&&\sd.set([^,]+\s,\s(?P
I updated and mine worked. Although I got similar errors when I didn't
input a youtube video url in the correct format. Experiment with that.
On Thu, Nov 8, 2018, 12:22 PM Student333 <[email protected] wrote:
Using also pytube 9.3.5 and python 3.6.6 and also have the error on
multiple videos in a playlist:Error on download : regex pattern (yt.akamaized.net/)\s||\s.?\s
c\s&&\sd.set([^,]+\s,\s(?P[a-zA-Z0-9$]+)() had zero matches—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nficano/pytube/issues/310#issuecomment-437123818, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AI7R2YHk-jrEZINV4I687T1_UGV37Pzxks5utISOgaJpZM4WPQTL
.
What is the correct format? I'm trying to download a playlist and this is the pytube finds itself.
I updated and mine worked. Although I got similar errors when I didn't input a youtube video url in the correct format. Experiment with that.
…
On Thu, Nov 8, 2018, 12:22 PM Student333 @.* wrote: Using also pytube 9.3.5 and python 3.6.6 and also have the error on multiple videos in a playlist: Error on download : regex pattern (yt.akamaized.net/)\s||\s.?\s c\s&&\sd.set([^,]+\s,\s(?P[a-zA-Z0-9$]+)() had zero matches — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#310 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AI7R2YHk-jrEZINV4I687T1_UGV37Pzxks5utISOgaJpZM4WPQTL .
Can you maybe give a working URL as example?
Just to test if it works for others, too? Or recognize a pattern.
See that's probably your problem. Pytube is meant to work with one video
URL (to my understanding). So you cannot download an entire playlist.
Your input for youtube URL must be like:
https://www.youtube.com/watch?v=uQRIvXymJZI
I noticed that some links would throw an error if they were to one of those
live "radio" streaming channels, sometimes radio would be in the link. I
also tried using a link that I copied from my mobile app, and that didn't
work. I realized that the url was slightly different. So a playlist
probably would not work.
Experiment with it.
On Fri, Nov 9, 2018 at 2:41 PM meylone notifications@github.com wrote:
What is the correct format? I'm trying to download a playlist and this is
the pytube finds itself.I updated and mine worked. Although I got similar errors when I didn't
input a youtube video url in the correct format. Experiment with that.
… <#m_3412136805290653512_>
On Thu, Nov 8, 2018, 12:22 PM Student333 @.* wrote: Using also pytube
9.3.5 and python 3.6.6 and also have the error on multiple videos in a
playlist: Error on download : regex pattern (yt.akamaized.net/
http://yt.akamaized.net/)\s||\s.?\s c\s&&\sd.set([^,]+\s,\s(?P[a-zA-Z0-9$]+)()
had zero matches — You are receiving this because you commented. Reply to
this email directly, view it on GitHub <#310 (comment)
https://github.com/nficano/pytube/issues/310#issuecomment-437123818>,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AI7R2YHk-jrEZINV4I687T1_UGV37Pzxks5utISOgaJpZM4WPQTL
.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nficano/pytube/issues/310#issuecomment-437503967, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AI7R2ZYYOUWF6NhQAaMujaV8SU2NIhWGks5utfalgaJpZM4WPQTL
.
pytube is definitely meant for downloading playlists. You must only use
pl = Playlist("my_playlist_link")
instead of
yt = YouTube("my_vid_link")
for that
Your link is working, but for example this one:
https://www.youtube.com/watch?v=EKF6ghfcQic
does not. I honestly cannot see the difference.
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=EKF6ghfcQic")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dh/.local/lib/python3.6/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/home/dh/.local/lib/python3.6/site-packages/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/home/dh/.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/dh/.local/lib/python3.6/site-packages/pytube/mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
File "/home/dh/.local/lib/python3.6/site-packages/pytube/cipher.py", line 250, in get_signature
tplan = get_transform_plan(js)
File "/home/dh/.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/dh/.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/dh/.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
Hi. Weird as it sounds, after some trials with different videos it seems the error appears only with videos featuring copyrighted music. Like, Youtube has further protected those somehow within the code, and thus they give an error when pytube tries to search for them.
So videos featuring music from youtube creators instead of "real" album tracks are fine, since I guess it's the content id algorithm the one checking for all this stuff (it works for example with Jaime Altozano's "Trap del Terraplanismo", or with any non-music video you happen to find).
Yeah, this is Right this problem is not with all videos code works with genuine videos of all channels
Can you re-open the issue with a tag "feature request" to have a clean exception raised when it encounter this unusual case ?
Do you think it could be a good idea ?
I can look into it after work if I remember. Honestly the issue has been
resolved.
I updated my code to catch errors and handle them by logging them and
resuming. This way, if one video has errors associated with it, the whole
program won't crash.
In the event all videos give you an error, completely uninstall and purge
pytube and reinstall the latest version from github.
It's been working flawlessly for record time now.
Hope this helps anybody struggling!
On Fri, Mar 1, 2019, 3:11 AM oliviernguyenquoc notifications@github.com
wrote:
Can you re-open the issue with a tag "feature request" to have a clean
exception raised when it encounter this unusual case ?Do you think it could be a good idea ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nficano/pytube/issues/310#issuecomment-468614143, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AI7R2TnvB1Mjq12iOaBBE4JaJzflnrbyks5vSPzKgaJpZM4WPQTL
.
Trying to use Pytube. Same issue and it is not a music.
yt = YouTube('https://www.youtube.com/watch?v=Tad9Ya6XsXY')
Traceback (most recent call last):
File "
File "/usr/local/lib/python3.7/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/usr/local/lib/python3.7/site-packages/pytube/__main__.py", line 97, in prefetch_init
self.init()
File "/usr/local/lib/python3.7/site-packages/pytube/__main__.py", line 133, in init
mixins.apply_signature(self.player_config_args, fmt, self.js)
File "/usr/local/lib/python3.7/site-packages/pytube/mixins.py", line 49, in apply_signature
signature = cipher.get_signature(js, stream['s'])
KeyError: 's'
Python 3.7.2 (default, Feb 12 2019, 08:15:36)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Most helpful comment
Hi. Weird as it sounds, after some trials with different videos it seems the error appears only with videos featuring copyrighted music. Like, Youtube has further protected those somehow within the code, and thus they give an error when pytube tries to search for them.
So videos featuring music from youtube creators instead of "real" album tracks are fine, since I guess it's the content id algorithm the one checking for all this stuff (it works for example with Jaime Altozano's "Trap del Terraplanismo", or with any non-music video you happen to find).