Skip to content

Infinite loop when a video is deleted during download #30

@baesik

Description

@baesik

The Problem:
If the person is livestreaming and deletes it while the script is still downloading or finishing up, the script gets stuck in a permanent loop.

What happens:

  • It keeps trying to find the video even though it's gone.
  • It displays "Video unavailable" and then immediately restarts the search.
  • I cannot stop the process with Ctrl+C. I have to force-close the terminal window to make it stop.
  • It never finishes merging the parts it already downloaded.

Error messages seen in the loop:

[INFO] [**********] 2026-02-25 21:39:58 - Starting download of live fragments (140-2 - medium, WEB-S (ended))
**********: Audio: 153/2573 (Recording) ~3.52 MB downloaded[INFO] [**********] 2026-02-25 21:40:05 - Starting download of live fragments (399-2 - 1080p, WEB-S (ended))
**********: Video: 407/2573 (Recording) Audio: 1574/2573 (Recording) ~264.58 MB downloaded[WARNING] [**********] 2026-02-25 21:41:03 - (399-2) Unexpected error downloading segment 2574 file after 5 attempts peer closed connection without sending complete message body (incomplete chunked read)
**********: Video: 855/2573 (Recording) Audio: 2571/2573 (Recording) ~406.71 MB downloaded[WARNING] [**********] 2026-02-25 21:41:52 - (399-2) Unexpected error downloading segment 2574 file after 5 attempts peer closed connection without sending complete message body (incomplete chunked read)
**********: Video: 1488/2573 (Recording) Audio: 2571/2573 (Recording) ~560.72 MB downloaded[WARNING] [**********] 2026-02-25 21:42:42 - (399-2) Unexpected error downloading segment 2574 file after 5 attempts peer closed connection without sending complete message body (incomplete chunked read)
**********: Video: 1799/2573 (Recording) Audio: 2571/2573 (Recording) ~714.77 MB downloaded[INFO] [**********] 2026-02-25 21:43:16 - Starting background URL refresh for 140-2
[...]
**********: Video: 2569/2573 (Merged) Audio: 2571/2573 (Recording) ~944.48 MB downloaded[youtube] **********: Downloading tv downgraded player API JSON
[youtube] **********: Downloading web safari player API JSON
WARNING: [youtube] Video unavailable. This video has been removed by the uploader
WARNING: Video should already be available according to extracted info
[wait] Waiting for 00:00:00 - Press Ctrl+C to try now
[wait] Wait period ended; Re-extracting data
[youtube] Extracting URL: **********
[youtube] **********: Downloading webpage
[youtube] **********: Downloading tv downgraded player API JSON
[youtube] **********: Downloading web safari player API JSON
WARNING: [youtube] Video unavailable. This video has been removed by the uploader
WARNING: Video should already be available according to extracted info
[wait] Waiting for 00:00:00 - Press Ctrl+C to try now

Maybe a flag that tries to merge the remaining fragments into the final file, even if the stream is no longer available?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions