Search code examples
pythonpytube

I was making a youtube video downloader but pytube is giving error


from pytube import YouTube

yt = YouTube('https://www.youtube.com/watch?v=yVcjVsk29XQ')

streams = yt.streams.filter(adaptive=True)

I am getting this error:

Traceback (most recent call last):
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\__main__.py", line 170, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 387, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 293, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 278, 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 "C:\Users\Sanskar\PythonProjects\YtDownload\yt.py", line 5, in <module>
    streams = yt.streams.filter(adaptive=True)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\__main__.py", line 285, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\__main__.py", line 177, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 387, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 293, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "C:\Users\Sanskar\PythonProjects\venv\lib\site-packages\pytube\cipher.py", line 278, in get_throttling_function_name
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple

Solution

  • this issue have been solved in the latest version so upgrade to the latest version like this

    python3 -m pip install --upgrade pytube
    

    or on windows

    python -m pip install --upgrade pytube