Skip YouTube Shorts in channel/playlist discovery
Spike's Car Radio is an active Shorts channel and its 60-second clips were being downloaded as podcast content. yt-dlp reports these as media_type 'short'; record such videos as skipped so they are neither downloaded nor re-resolved. Applies to all YouTube feeds.
This commit is contained in:
parent
4b5e48a26d
commit
22adb0f7e1
10
main.go
10
main.go
|
|
@ -195,6 +195,16 @@ func pollYouTube(feed config.Feed, sm *state.Manager, jobs chan<- downloader.Dow
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YouTube Shorts are not podcast content: record as skipped so they
|
||||||
|
// are never downloaded and never re-resolved.
|
||||||
|
if info.MediaType == "short" {
|
||||||
|
dp := computeYTDestPath(feed.OutputDir, info.UploadDate, info.Title, v.ID)
|
||||||
|
if sm.AddJobWithStatus(feed.URL, watchURL(v.ID), dp, state.StatusSkipped, info.Duration) {
|
||||||
|
skipped++
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Out of the start_date window. Record as skipped so it isn't
|
// Out of the start_date window. Record as skipped so it isn't
|
||||||
// re-resolved next poll. (Channel video order is not reliably
|
// re-resolved next poll. (Channel video order is not reliably
|
||||||
// newest-first — e.g. the Iron Culture channel lists recent episodes
|
// newest-first — e.g. the Iron Culture channel lists recent episodes
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ type VideoInfo struct {
|
||||||
Title string
|
Title string
|
||||||
Duration float64 // seconds, 0 if unknown
|
Duration float64 // seconds, 0 if unknown
|
||||||
UploadDate time.Time
|
UploadDate time.Time
|
||||||
|
// MediaType is "video", "short", or "livestream" ("" if unknown).
|
||||||
|
MediaType string
|
||||||
LiveStatus string // "not_live", "is_live", "was_live", "is_upcoming", or "" if unknown
|
LiveStatus string // "not_live", "is_live", "was_live", "is_upcoming", or "" if unknown
|
||||||
// ReleaseTimestamp is the scheduled start time of a live stream in unix
|
// ReleaseTimestamp is the scheduled start time of a live stream in unix
|
||||||
// seconds (from liveBroadcastDetails.startTimestamp); 0 if unknown.
|
// seconds (from liveBroadcastDetails.startTimestamp); 0 if unknown.
|
||||||
|
|
@ -129,6 +131,7 @@ func Info(ctx context.Context, s Settings, videoID string) (VideoInfo, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.LiveStatus, _ = data["live_status"].(string)
|
info.LiveStatus, _ = data["live_status"].(string)
|
||||||
|
info.MediaType, _ = data["media_type"].(string)
|
||||||
if ts, ok := num(data["release_timestamp"]); ok {
|
if ts, ok := num(data["release_timestamp"]); ok {
|
||||||
info.ReleaseTimestamp = int64(ts)
|
info.ReleaseTimestamp = int64(ts)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user