Files
youclonedl/backend/routers/videos.py
Mattias Thall 1179b53f2e Fix hidden yt-dlp calls on video page causing cookie invalidation
Two background yt-dlp processes were firing every time a video page loaded:

1. importChapters (called unconditionally via useEffect on mount) was calling
   _upsert_video_from_yt with polite=False when chapters=NULL — no rate
   limiter, no download-pause check, runs concurrently with active downloads.
   Fix: return [] immediately when chapters=NULL and let the normal enrichment
   pipeline (already polite=True) fill them in.

2. get_video_by_yt_id schedules a background _enrich task whenever description
   or chapters are NULL. The frontend polls every 3 s while description is
   null, so dozens of enrichment tasks would pile up for the same video.
   Fix: deduplicate with _enriching set — only one background fetch per
   video_id at a time; the set entry is cleared when the task finishes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 02:43:45 +02:00

47 KiB