Please confirm that you are on the latest version of pytube by installing from the source.
You can do this by running python -m pip install git+https://github.com/pytube/pytube.
Sometimes, the pypi library repository is not up to date, and your issue may have been fixed already!
Describe the bug
Regex Match Error in pytube.
To Reproduce
Please provide the following information:
The video or playlist url that is causing the error.
The code where the problem is occurring.
Everything is normal.
Expected behavior
A clear and concise description of what you expected to happen.
Output
If pytube raises an exception, please provide the full traceback for the exception.
Traceback (most recent call last):
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube__main__.py", line 181, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 43, in init
self.throttling_plan = get_throttling_plan(js)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
raw_code = get_throttling_function_code(js)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
name = re.escape(get_throttling_function_name(js))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\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 "D:\Python Projects\FileManagerProject\download_with_pytube.py", line 32, in
download_video_and_audio(youtube_video_url, 'final_output.mp4')
File "D:\Python Projects\FileManagerProject\download_with_pytube.py", line 10, in download_video_and_audio
video_stream = yt.streams.filter(adaptive=True, file_extension='mp4', only_video=True).first()
^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube__main.py", line 296, in streams
return StreamQuery(self.fmt_streams)
^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube__main__.py", line 188, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 43, in init__
self.throttling_plan = get_throttling_plan(js)
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
raw_code = get_throttling_function_code(js)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\Lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
name = re.escape(get_throttling_function_name(js))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python Projects\FileManagerProject.venv\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
System information
Please provide the following information:
Python version (run python --version)
3.12.1
Pytube version (run print(pytube.__version__) in python)
Before creating an issue
Please confirm that you are on the latest version of pytube by installing from the source. You can do this by running
python -m pip install git+https://github.com/pytube/pytube
. Sometimes, the pypi library repository is not up to date, and your issue may have been fixed already!Describe the bug
To Reproduce Please provide the following information:
Expected behavior A clear and concise description of what you expected to happen.
Output If pytube raises an exception, please provide the full traceback for the exception.
During handling of the above exception, another exception occurred:
System information Please provide the following information:
python --version
)print(pytube.__version__)
in python)