question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RegexMatchError: (\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]) had zero matches

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:44 (1 by maintainers)

github_iconTop GitHub Comments

45reactions
rrileycommented, Apr 24, 2019

It looks like comment out the related part in codes as a temploary solution works for me. # I'm not entirely sure whattrepresents. 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)), ])

Hi, Can you please elaborate on that? Thanks~

Go to extract.py line 116 and change the following to look like:

    else:
        # 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)),
        ])

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.

19reactions
nficanocommented, May 1, 2019

All fixed, fixed rating + views as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 ...
Read more >
pytube.exceptions.RegexMatchError: regex pattern had 0 ...
I've done this and got the warning WARNING: The script pytube.exe is installed in 'C:\Users\stemb\AppData\Local\Programs\Python\Python37\Scripts ...
Read more >
How to use the pytube.exceptions.RegexMatchError function ...
RegexMatchError examples, based on popular ways it is used in public projects. ... raise RegexMatchError( 'regex pattern ({pattern}) had zero matches' ...
Read more >
regex pattern ((?:v=|\/)([0-9A-Za-z_-]{11}).*) had zero matches
pytube.exceptions.RegexMatchError: regex pattern ((?:v=|\/)([0-9A-Za-z_-]{11}).*) had zero matches.
Read more >
Why do I get zero matches on Tinder? It's been a ... - Quora
Yes, there are some serious people on Tinder, but it has a reputation for a reason. When it comes to real profiles, men...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found