pytube: [BUG] RegexMatchError get_throttling_function_name: could not find match for multiple
Hello, I have problem with streams of YouTube wideo. I have tried everything I found on the net! I will be grateful for help!
My code:
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=JLXBvVh8-2A")
yt.streams
My fucking error:
Traceback (most recent call last):
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 296, in get_throttling_function_name
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\__main__.py", line 188, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "C:\Users\kacpe\.pyenv\pyenv-win\versions\3.9.6\lib\site-packages\pytube\cipher.py", line 296, in get_throttling_function_name
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple
About this issue
- Original URL
 - State: closed
 - Created 2 years ago
 - Reactions: 19
 - Comments: 26
 
This fix by eroc1234 resolved it for me.
As noted by gangmax in the responses to that post, function_patterns is defined on line 264 of cipher.py The actual expressions to modify are on lines 272~273
pytube 12.0.0 python 3.8 Windows 7
same here
This was the fork https://github.com/kinshuk-h/pytube uninstall pytube and pip install git+https://github.com/kinshuk-h/pytube
how to handle it ?
It works to me as well, thanks for the support! pytube 12.0.0 python 3.9.4 Windows 10
This workaround doesnt work anymore atleast for me
This worked for me. When will this be released as an official version?
Yeah it works
same here