diff --git a/CLAUDE.md b/CLAUDE.md index f3c4ed3..52450bd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -379,7 +379,7 @@ on their socials, one a day. Paid plans only (it spends minutes unattended). clips the back catalogue) and at most 3 days old; 1 automatic job per user per 24 h; `max_minutes` per video (default 30, sent as the partial-clip `max_minutes`); YouTube Shorts are skipped (`HEAD /shorts/` answers 200 - for a Short and 303 to `/watch` for a regular video, checked on prod IPs). + for a Short and 303 to `/watch` for a regular video; the SOCS consent cookie is required, from the EU servers every request is otherwise a 302 to consent.youtube.com). - **Dedupe across the deploy handover**: two containers poll at once during a rolling deploy, so a video is claimed by INSERTing its `autopilot_runs` row (unique `user_id, video_id`) before anything is submitted. A draining diff --git a/cloud/autopilot.py b/cloud/autopilot.py index 187285b..06cc559 100644 --- a/cloud/autopilot.py +++ b/cloud/autopilot.py @@ -265,11 +265,15 @@ async def is_youtube_short(video_id: str) -> bool: """True when YouTube serves this id as a Short. ``/shorts/`` answers 200 for a Short and redirects to ``/watch`` for a - regular video. Any other answer (a consent page, a bot check) reads as - "not a Short" and the normal pipeline's own too-short gate still applies. + regular video. From the prod servers (EU) YouTube first redirects every + request to consent.youtube.com, which read as "not a Short" and let a Short + through (22-sep-2026); the SOCS/CONSENT cookies skip that page. Any other + answer (a bot check) still reads as "not a Short" and the normal + pipeline's own too-short gate applies. """ try: - async with httpx.AsyncClient(timeout=10, follow_redirects=False) as client: + async with httpx.AsyncClient(timeout=10, follow_redirects=False, + cookies={"SOCS": "CAI", "CONSENT": "YES+"}) as client: resp = await client.head(f"https://www.youtube.com/shorts/{video_id}") return resp.status_code == 200 except Exception: