pytube: RegexMatchError: (\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]) had zero matches
Tried adding the pattern into cipher.py to no effect… help please?
pytube==9.4.0, Python 3.7.1
Traceback (most recent call last):
File "filename.py", line 13, in <module>
yt = YouTube(link, on_progress_callback=progress_function)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytube/__main__.py", line 88, in __init__
self.prefetch_init()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytube/__main__.py", line 96, in prefetch_init
self.prefetch()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytube/__main__.py", line 170, in prefetch
age_restricted=self.age_restricted,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytube/extract.py", line 121, in video_info_url
group=0,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytube/helpers.py", line 65, in regex_search
.format(pattern=pattern),
pytube.exceptions.RegexMatchError: regex pattern (\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]) had zero matches
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 44 (1 by maintainers)
Commits related to this issue
- Patch to fix regex bug, see nficano/pytube#381 — committed to ndg63276/alexa-youtube by deleted user 5 years ago
- Update extract.py Temporary fix to issue #381. Updating pytube to handle Youtube's new, updated URLs. Simply commenting out the lines that throw an error when trying to download in video_info_url fun... — committed to WHalunen/pytube by deleted user 5 years ago
- Patch to fix regex bug, see nficano/pytube#381 — committed to ndg63276/alexa-youtube by deleted user 5 years ago
- Patch to fix regex bug, see nficano/pytube#381 — committed to ndg63276/alexa-youtube by deleted user 5 years ago
- Patch to fix regex bug, see nficano/pytube#381 — committed to ndg63276/alexa-youtube by deleted user 5 years ago
- Patch to fix regex bug, see nficano/pytube#381 — committed to ndg63276/alexa-youtube by deleted user 5 years ago
Go to
extract.py
line 116 and change the following to look like:Notice that we’re just commenting out the stuff related to
t
. I don’t know why this works, and I’m guessing there are other bad side-effects, but it got me through my needs for the day.All fixed, fixed rating + views as well
It looks like comment out the related part in codes as a temploary solution works for me.
# I'm not entirely sure what ``t`` represents. Looks to represent a # boolean. # t = regex_search( # r'\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]', watch_html, # group=0, # ) params = OrderedDict([ ('video_id', video_id), ('el', '$el'), ('ps', 'default'), ('eurl', quote(watch_url)), ('hl', 'en_US'), # ('t', quote(t)), ])
It is worked, but waiting for official fix
for me it was not that obvious, so I let it here just in case…
It’s already merged in master, so
pip install -U pytube
to get the corrected version (9.5.0)Thank you!
yay nick!
On Wed, 1 May 2019, 17:20 Nick Ficano, notifications@github.com wrote:
Hi folks, sorry for not being responsive here, I have become incredibly busy in recent months and haven’t been able to support the project as much as I would like. Let me look into this now. I’ll post an update for everyone shortly.
This solution is worked for some videos, others are not. Waiting for official fix.
Same issue here. Python 3.7.2 @nficano can we get a pip upgrade pushed for this until the root cause is identified and corrected?