[Solved] pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
Article
Habibur Rhoman Joy
Problem:
I am using pytube and written to code to for downloading YouTube Videos -
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=aQNrG7ag2G4')
stream = yt.streams.
stream = yt.streams.filter(file_extension='mp4')
And getting this error -
Traceback (most recent call last):
raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W
Solution:
You have to go in the cipher.py file and replace the line 30:
var_regex = re.compile(r"^\w+\W")
to:
var_regex = re.compile(r"^\$*\w+\W")
Hope it will work.
Thank you for reading the article. If you face any problem, please comment below.