MaZED-UP / bunny-cdn-drm-video-dl

A simple Python class to download Bunny CDN's "DRM" videos using yt-dlp
93 stars 27 forks source link

Issue with the final step (after downloading fragments) #35

Open Tharps22 opened 1 month ago

Tharps22 commented 1 month ago

Hello, I am looking for help. New to python, my apologies if I'm not doing correctly. I was able to download all 7980 fragments from the source video but there seems to be a issue with the final step. There is no MP4 yet in my downloaded folder. I've attached the script as a txt file. Thanks for any help!

b-cdn-drm-vod-dl.txt

=============================

and here is the error message I get:

[download] 100.0% of ~1002.53MiB at 12.28MiB/s ETA 00:00 (frag 7980/7980)ERROR: unable to download video data: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) Traceback (most recent call last): File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( conn, ...<10 lines>... **response_kw, ) File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 536, in _make_request response = conn.getresponse() File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connection.py", line 507, in getresponse httplib_response = super().getresponse() File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 1428, in getresponse response.begin()


  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 300, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
                             " response")
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
        method=request.method,
    ...<9 lines>...
        chunked=chunked,
    )
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
        method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
    )
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/util/retry.py", line 449, in increment
    raise reraise(type(error), error, _stacktrace)
          ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
        conn,
    ...<10 lines>...
        **response_kw,
    )
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connection.py", line 507, in getresponse
    httplib_response = super().getresponse()
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 1428, in getresponse
    response.begin()
    ~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/http/client.py", line 300, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
                             " response")
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/networking/_requests.py", line 328, in _send
    requests_res = session.request(
        method=request.method,
    ...<6 lines>...
        stream=True,
    )
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/requests/adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3483, in process_info
    success, real_download = self.dl(temp_filename, info_dict)
                             ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3203, in dl
    return fd.download(name, new_info, subtitle)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/downloader/common.py", line 466, in download
    ret = self.real_download(filename, info_dict)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/downloader/hls.py", line 381, in real_download
    return self.download_and_append_fragments(ctx, fragments, info_dict)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 501, in download_and_append_fragments
    if not append_fragment(decrypt_fragment(fragment, self._read_fragment(ctx)), frag_index, ctx):
                           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 358, in decrypt_fragment
    or _get_key(traverse_obj(info_dict, ('hls_aes', 'uri')) or decrypt_info['URI']))
       ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/downloader/fragment.py", line 347, in _get_key
    _key_cache[url] = self.ydl.urlopen(self._prepare_url(info_dict, url)).read()
                      ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 4172, in urlopen
    return self._request_director.send(req)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/networking/common.py", line 117, in send
    response = handler.send(request)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/networking/_helper.py", line 208, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/networking/common.py", line 340, in send
    return self._send(request)
           ~~~~~~~~~~^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/networking/_requests.py", line 352, in _send
    raise TransportError(cause=e) from e
yt_dlp.networking.exceptions.TransportError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/thomasharpole/Desktop/b-cdn-drm-vod-dl.py", line 213, in <module>
    video.download()
    ~~~~~~~~~~~~~~^^
  File "/Users/thomasharpole/Desktop/b-cdn-drm-vod-dl.py", line 177, in download
    ydl.download(url)
    ~~~~~~~~~~~~^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3609, in download
    self.__download_wrapper(self.extract_info)(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        url, force_generic_extractor=self.params.get('force_generic_extractor', False))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3582, in wrapper
    res = func(*args, **kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1615, in extract_info
    return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1626, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1782, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1841, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3015, in process_video_result
    self.process_info(new_info)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 179, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 3492, in process_info
    self.report_error(f'unable to download video data: {err}')
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1092, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/yt_dlp/YoutubeDL.py", line 1031, in trouble
    raise DownloadError(message, exc_info)
yt_dlp.utils.DownloadError: ERROR: unable to download video data: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
MaZED-UP commented 3 weeks ago

The reason doesn't seem to be clear but this often happens, if I recall correctly, when enabling the option of downloading the video using aria2c as an external downloader but this is not the case as demonstrated in the attached script. I have to guess that you may have to increase the ping time as shown in issue #11.

MechatronikMonkey commented 3 weeks ago

Traceback (most recent call last): File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( method=request.method, ...<9 lines>... chunked=chunked, ) File "/Users/thomasharpole/myenv/lib/python3.13/site-packages/urllib3/connectionpool.py", line 843, i)

image

There aren't many Thomas Harpoles, so I assume you recognize yourself here? Took me 30 seconds... maybe you'd like to remove your name from your logs :-D?