From 856f14824fdaba4fe8dd1e6c7c11b23767cf2c41 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Wed, 17 Jun 2026 22:21:12 -0700 Subject: [PATCH] Playlist/channel extraction: stop pinning a static user_agent for yt-dlp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correcting the cookies theory — ytdl-sub is just CLI yt-dlp (no browser). The real differentiators are a CURRENT yt-dlp + not fighting YouTube's client identity. We were pinning a static user_agent in the yt-dlp opts, which yt-dlp recommends against (it trips YouTube's heuristics and truncates large-playlist pagination). Dropped it so yt-dlp manages its own (current) client — the lever that lets a fresh ytdl-sub page further than us. (_UA is still used for the InnerTube requests.) Softened the partial-playlist note to just 'Showing N of TOTAL videos.' --- core/video/youtube.py | 4 +++- webui/static/video/video-detail.js | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/video/youtube.py b/core/video/youtube.py index d1acba08..9f51181e 100644 --- a/core/video/youtube.py +++ b/core/video/youtube.py @@ -182,7 +182,9 @@ def _ydl_opts(limit, db=None): "extract_flat": True, # fast: enumerate uploads without per-video format probing "skip_download": True, "playlistend": int(limit), - "user_agent": _UA, + # NB: do NOT pin user_agent here — yt-dlp manages its own (current) client + # identity; a static UA trips YouTube's heuristics and truncates large + # playlist pagination (the reason a fresh ytdl-sub pages further than us). } opts.update(_cookie_opts()) return opts diff --git a/webui/static/video/video-detail.js b/webui/static/video/video-detail.js index 6fb344b6..826e1a00 100644 --- a/webui/static/video/video-detail.js +++ b/webui/static/video/video-detail.js @@ -1571,10 +1571,8 @@ ytVideoMap = {}; vids.forEach(function (v) { ytVideoMap[v.youtube_id] = v; }); var total = pl.video_count || vids.length; - // Anonymous, YouTube throttles us to ~100-200; with YouTube cookies set in - // Settings, yt-dlp pages the whole playlist (like ytdl-sub). Be honest when partial. - var note = total > vids.length - ? 'Showing ' + vids.length + ' of ' + total + ' videos — add YouTube cookies in Settings to load the full playlist.' : ''; + // YouTube throttles large-playlist listing for our client — be honest when partial. + var note = total > vids.length ? 'Showing ' + vids.length + ' of ' + total + ' videos.' : ''; var season = { season_number: 1, title: 'Videos', poster_url: ytProx(pl.thumbnail_url), episode_owned: 0, episode_total: vids.length, episodes: vids.map(ytEpisodeOf) }; return { kind: 'playlist', source: 'youtube', id: pl.playlist_id, title: pl.title || 'Playlist',