Add older content exploration: channel page + home feed Rediscover mode

Channel page:
- "Explore older videos" button fetches 100 videos at a time further back
  in the channel history using yt-dlp --playlist-start/--playlist-end
- "Fetch entire history" still available for full crawl
- Backend: /channels/{id}/explore?page=N endpoint + playlist offset support
  in fetch_channel_metadata(start_video=N)

Home feed:
- New "Rediscover" mode: older unwatched videos (90+ days old) from
  followed channels, randomly sampled then re-ranked by tag affinity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 22:17:20 +02:00
parent 0b482b5d49
commit aa91156bbc
6 changed files with 131 additions and 10 deletions

View File

@@ -287,7 +287,7 @@ def _rss_dates(uc_channel_id: str) -> dict[str, datetime]:
return {}
def fetch_channel_metadata(channel_id: str, max_videos: int = 30) -> dict | None:
def fetch_channel_metadata(channel_id: str, max_videos: int = 30, start_video: int = 1) -> dict | None:
"""Fetch channel info + recent videos.
Uses --dump-single-json --flat-playlist for speed, then enriches video dates
@@ -304,8 +304,11 @@ def fetch_channel_metadata(channel_id: str, max_videos: int = 30) -> dict | None
"--quiet",
*_cookie_args(),
]
if start_video > 1:
args += ["--playlist-start", str(start_video)]
if max_videos > 0:
args += ["--playlist-end", str(max_videos)]
end = (start_video - 1 + max_videos) if start_video > 1 else max_videos
args += ["--playlist-end", str(end)]
stdout, _, code = _run(args, timeout=60)
if not stdout.strip():