Wait for live streams to end before downloading

While a YouTube video is still a live stream (or upcoming), the static
formats bestaudio requests may not be available, so yt-dlp fails with
'Requested format is not available'. Once the stream ends, YouTube
converts it to a regular VOD that downloads normally.

Before downloading, probe the video's live_status via yt-dlp. If it is
still live, reschedule the job in 10-minute increments (live_wait_count)
without counting against the normal retry budget. After 24 consecutive
waits (~4h) the job falls back to a regular retry attempt with the
exponential backoff, so a video that never converts still fails
permanently instead of retrying forever. Live waits are reset on
success or any ordinary retry.
This commit is contained in:
gmp
2026-09-28 17:48:12 -04:00
parent bc26e73a90
commit e56d438506
3 changed files with 72 additions and 1 deletions
+1
View File
@@ -33,6 +33,7 @@ type Job struct {
NextAttemptAt *time.Time `json:"next_attempt_at,omitempty"` // nil means ready now
Error string `json:"error,omitempty"`
Duration float64 `json:"duration,omitempty"` // expected media duration in seconds (YouTube)
LiveWaitCount int `json:"live_wait_count,omitempty"` // consecutive 10-min waits while a video is still live (does not count against AttemptCount)
}
// JobStatus values.