Skip to content

[BUG] Error partially downloading video #655

Description

@ChristineTham

🛑 DO NOT REMOVE OR SKIP THIS ISSUE TEMPLATE 🛑

Issues with incomplete or missing information will be closed automatically.


🐞 Bug Description

Provide a clear and concise description of the bug.

pytubefix has error after partially downloading video

🔢 Code Snippet

Include the minimal code snippet that reproduces the issue.

# Insert your code here n/a

🎯 Expected Behavior

Describe what you expected to happen instead of the observed behavior.

Complete downloading without error


📸 Screenshots or Logs

pytubefix https://www.youtube.com/watch\?v\=mIlpTOX3lMk -f /Users/xxx/.local/bin/ffmpeg
Loading video...
GTA 5 PS5 All Cutscenes Full Movie (2022) 4K ULTRA HD_video_0 | 18657 MB
Traceback (most recent call last): | 4.1%
File "/Users/xxx/.local/bin/pytubefix", line 10, in
sys.exit(main())
~~~~^^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/cli.py", line 352, in main
_perform_args_on_youtube(youtube, args)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/cli.py", line 305, in _perform_args_on_youtube
ffmpeg_process(youtube=youtube, resolution=args.resolution, target=args.target)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/cli.py", line 153, in ffmpeg_process
_download(video_stream, target=target, filename=video_file_name)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/cli.py", line 88, in _download
stream.download(output_path=target, filename=filename)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/streams.py", line 398, in download
for chunk in request.stream(
~~~~~~~~~~~~~~^
self.url,
^^^^^^^^^
timeout=timeout,
^^^^^^^^^^^^^^^^
max_retries=max_retries
^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/request.py", line 154, in stream
response = _execute_request(
f"{url}&range={downloaded}-{stop_pos}",
method="GET",
timeout=timeout
)
File "/Users/xxx/.local/share/uv/tools/pytubefix/lib/python3.13/site-packages/pytubefix/request.py", line 35, in _execute_request
return urlopen(request, timeout=timeout) # nosec
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 189, in urlopen
return opener.open(url, data, timeout)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 495, in open
response = meth(req, response)
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 604, in http_response
response = self.parent.error(
'http', request, response, code, msg, hdrs)
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 533, in error
return self._call_chain(*args)
~~~~~~~~~~~~~~~~^^^^^^^
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 466, in _call_chain
result = func(*args)
File "/Users/xxx/.local/share/uv/python/cpython-3.13.13-macos-aarch64-none/lib/python3.13/urllib/request.py", line 613, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error


🖥️ Environment Details

Fill in the details below about your setup:

  • Operating System: [e.g., Windows 10, macOS Monterey] macOS
  • Python Version: [e.g., 3.9.7] 3.13.13
  • Pytubefix Version: [e.g., 1.2.3] 10.10

📋 Additional Context

Add any additional information or context that might help us resolve the issue.

pytubefix installed via uv tool install pytubefix


🚀 Next Steps

Once submitted, we will triage the issue. Make sure to respond to follow-up questions to keep the process smooth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGSomething isn't working

    Projects

    Status
    waiting

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions