pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple in pytube version 12.0.0

I'm trying to use pytube but every time I run the code this RegexError appears. I'm using pytube version 12.0.0 which is the latest. Does anyone have any solution?

Upvotes: 2

Views: 1037

Answers (1)

Peter Guan
Peter Guan

Reputation: 56

It's because YouTube's updates. Try to change pytube's "cipher.py" file, function_patterns(should be around line 264) to:

r'a\.[a-zA-Z]\s*&&\s*\([a-z]\s*=\s*a\.get\("n"\)\)\s*&&\s*'
r'\([a-z]\s*=\s*([a-zA-Z0-9$]{2,3})(\[\d+\])?\([a-z]\)'

and also change line 288 to:

nfunc=re.escape(function_match.group(1))),

I believe pytube will release a official fix soon as well.

Upvotes: 4

Related Questions