youtube-downloader-converter icon indicating copy to clipboard operation
youtube-downloader-converter copied to clipboard

Exception when downloading a single video

Open zanellig opened this issue 7 months ago • 0 comments

Expected Behavior

The script should download a youtube video by providing it's link.

Current Behavior

Throws an error:

$ python .\main.py
Welcome to NeuralNine YouTube Downloader and Converter v0.3

Loading modules...
Load Complete


Options
(1) Download YouTube Videos Manually
(2) Download a YouTube Playlist
(3) Download YouTube Videos and Convert Into MP3
Downloading copyrighted YouTube videos is illegal!
We are not responsible for your downloads! Go at your own risk!
Copyright - Free Use license


Choice: 3
Enter the links of the videos (end by entering 'stop' or 0):
video_url: https://www.youtube.com/watch?v=D8j5Fm94_CE
video_url: 0
Downloading...
Traceback (most recent call last):
  File "C:\Python312\Lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python312\Lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
             ^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
                           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\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 "C:\Users\user\yt-downloader\main.py", line 57, in <module>
    filename = download_video(link, 'low')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\yt-downloader\youtube_downloader.py", line 26, in download_video
    stream = video.streams.get_by_itag(itag)
             ^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
                       ^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\__main__.py", line 188, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "C:\Python312\Lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
             ^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
                           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 405, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\pytube\cipher.py", line 311, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\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

Steps to Reproduce

  1. Install dependencies pytube and moviepy
  2. Run python main.py
  3. Enter option 3
  4. Enter a link to a youtube video, submit, then type STOP and submit
  5. Get the error

Context (Environment)

  • Using Windows 11 Pro 23H2 build 22631.3880
  • Using Powershell 7 in the Microsoft Terminal with elevated privileges
  • Using Python 3.12.3
  • Using pip 24.1.1 from C:\Python312\Lib\site-packages\pip (python 3.12)

Detailed Description

I encounter this issue when trying to download a youtube video. I will try to provide more information as you need.

zanellig avatar Jul 27 '24 00:07 zanellig