fix: YouTube channel ID (UC...) handling + handle-to-channelId resolution

discover-channels: extractHandle('youtube') now detects UC* channel IDs
and returns them without @ prefix (previously @UC... caused verify fail)

verifyHandles: verifyYouTube uses cleanHandle for UC* check, requests
part=id,snippet for richer data

collect-channel-data: if channelId missing but handle present, resolves
via forHandle/forUsername lookup or direct UC* detection before skipping

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Opus 4.6 committed 2026-04-04 01:00:21 +09:00
1 parent 163751410f
commit df8f84c3b9
3 files changed
+21 -4

No files matched your search

@@ -221,6 +221,8 @@ Deno.serve(async (req) => {
h = h.replace(/^@/, '');
// Reject if it looks like a non-YouTube URL
if (h.includes('http') || h.includes('/') || h.includes('.com')) return null;
// Channel IDs start with UC — don't add @ prefix
if (/^UC[a-zA-Z0-9_-]{20,}$/.test(h)) return h;
if (/^[a-zA-Z0-9._-]+$/.test(h) && h.length >= 2) return `@${h}`;
return null;
}