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:
@@ -81,6 +81,7 @@ type VideoInfo struct {
|
||||
Title string
|
||||
Duration float64 // seconds, 0 if unknown
|
||||
UploadDate time.Time
|
||||
LiveStatus string // "not_live", "is_live", "was_live", "upcoming", or "" if unknown
|
||||
}
|
||||
|
||||
// Info resolves full metadata for a single video by ID.
|
||||
@@ -124,6 +125,7 @@ func Info(ctx context.Context, s Settings, videoID string) (VideoInfo, error) {
|
||||
info.UploadDate = t
|
||||
}
|
||||
}
|
||||
info.LiveStatus, _ = data["live_status"].(string)
|
||||
return info, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user