pytube.exceptions.RegexMatchError: regex pattern
See original GitHub issueWhile the downloads work fine for many videos it fails on some like this video:
https://www.youtube.com/watch?v=tOMPGQP1G8o
the error is :
File "/usr/local/lib/python2.7/dist-packages/pytube/cipher.py", line 252, in get_signature
tplan = get_transform_plan(js)
File "/usr/local/lib/python2.7/dist-packages/pytube/cipher.py", line 71, in get_transform_plan
name = re.escape(get_initial_function_name(js))
File "/usr/local/lib/python2.7/dist-packages/pytube/cipher.py", line 47, in get_initial_function_name
return regex_search(pattern, js, group=1)
File "/usr/local/lib/python2.7/dist-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*(?:encodeURIComponent\s*\()?(?P<sig>[a-zA-Z0-9$]+)\() had zero matches
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Receiving "pytube.exceptions.RegexMatchError: regex pattern ...
Here is the code that I am using which is providing the error above. import sys import pytube link = input('Enter url: ')...
Read more >[BUG] RegexMatchError ? · Issue #1199 · pytube ... - GitHub
Looking through the js that the regex is searching is some giant obfuscated mess that I am in no way qualified to deal...
Read more >How to use the pytube.exceptions.RegexMatchError function ...
To help you get started, we've selected a few pytube.exceptions. ... if not results: raise RegexMatchError( 'regex pattern ({pattern}) had zero matches' ...
Read more >pytube.exceptions — pytube 12.1.2 documentation
[docs]class RegexMatchError(ExtractError): """Regex pattern did not return any matches.""" def __init__(self, caller: str, pattern: Union[str, Pattern]): ...
Read more >pytube.exceptions.RegexMatchError: __init__: could not find ...
RegexMatchError : __init__: could not find match for ^\w+\W. RegexMatchError python version: 3.8.10 pytube version: 11.0.2. Code: from pytube import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Based on what @Elite posted, I changed cipher.py line 40 to:
r'.*?\s*c\s*&&\s*d|a\.set\([^,]+\s*,\s*(?:encodeURIComponent'
and line 43 to:
r'\bc\s*&&\s*d|a\.set\([^,]+\s*,\s*(?:encodeURIComponent'
and this resolved the problem for at least one video. No time to test properly and make a pull request right now, though.
Well … it is maintained. Just slowly.
If you try the latest version
pip install git+https://github.com/nficano/pytube.git --upgrade
, your video works for me