pytube: [BUG] pytube.exceptions.regexmatcherror: __init__: could not find match for ^\w+\w
While lunching usual code in my bot, got an exception.
My code:
yt.streams.get_audio_only()
Exception:
File "...\pytube\__main__.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "...\pytube\__main__.py", line 188, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "...\pytube\extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
File "...\pytube\cipher.py", line 33, in __init__
raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
Python 3.10.5 Pytube version 15.0.0
Please help!
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 17
Coincidentally, I also encountered the same problem。 Try this,ediit file \pytube\cipher.py line 30.
var_regex = re.compile(r"^\$*\w+\W")
This fixed the issue for me. Might be worth looking into for others facing the issue.
Here is the original line in case that solution doesn’t work and you need to revert the code.
var_regex = re.compile(r"^\w+\W")