[BUG - RegexMatchError in `cypher.py`]
Author: posfr2Created Nov 6, 2025Updated Nov 7, 2025
Labelsbug
RegexMatchError in cypher.py
Both a very simple Python script and the command line utility give the same error; namely:
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 209, in get_initial_function_name raise RegexMatchError(caller="get_initial_function_name", pattern="multiple") pytube.exceptions.RegexMatchError: get_initial_function_name: could not find match for multiple
The error appears to occur in file cipher.py.
Below is the Powershell log of the run via the command line. As shown at the top of the log, the versions are:
Python 3.14.0 pytube 15.0.16
The PowerShell Log now follows:
PS Thu 06/11 15:48 C:\Users\Home\tmp > python --version
Python 3.14.0
PS Thu 06/11 15:48 C:\Users\Home\tmp > pytube --version
python.exe C:\Users\Home\AppData\Local\Programs\Python\Python314\Scripts\pytube 15.0.16
PS Thu 06/11 15:48 C:\Users\Home\tmp > pytube https://youtube.com/watch?v=2lAe1cqCOXo
Loading video...
Traceback (most recent call last):
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\__main__.py", line 184, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\extract.py", line 401, in apply_signature
cipher = Cipher(js=js)
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 30, in __init__
self.transform_plan: List[str] = get_transform_plan(js)
~~~~~~~~~~~~~~~~~~^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 232, in get_transform_plan
name = re.escape(get_initial_function_name(js))
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 209, in get_initial_function_name
raise RegexMatchError(caller="get_initial_function_name", pattern="multiple")
pytube.exceptions.RegexMatchError: get_initial_function_name: could not find match for multiple
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Scripts\pytube.exe\__main__.py", line 6, in <module>
sys.exit(main())
~~~~^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cli.py", line 53, in main
_perform_args_on_youtube(youtube, args)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cli.py", line 60, in _perform_args_on_youtube
download_highest_resolution_progressive(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
youtube=youtube, resolution="highest", target=args.target
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cli.py", line 474, in download_highest_resolution_progressive
stream = youtube.streams.get_highest_resolution()
^^^^^^^^^^^^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\__main__.py", line 312, in streams
return StreamQuery(self.fmt_streams)
^^^^^^^^^^^^^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\__main__.py", line 191, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\extract.py", line 401, in apply_signature
cipher = Cipher(js=js)
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 30, in __init__
self.transform_plan: List[str] = get_transform_plan(js)
~~~~~~~~~~~~~~~~~~^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 232, in get_transform_plan
name = re.escape(get_initial_function_name(js))
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
File "C:\Users\Home\AppData\Local\Programs\Python\Python314\Lib\site-packages\pytube\cipher.py", line 209, in get_initial_function_name
raise RegexMatchError(caller="get_initial_function_name", pattern="multiple")
pytube.exceptions.RegexMatchError: get_initial_function_name: could not find match for multiple
PS Thu 06/11 15:49 C:\Users\Home\tmp >Source: pytube/pytube