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:
1 parent
163751410f
commit
df8f84c3b9
3 files changed
+21
-4
No files matched your search
@@ -66,11 +66,11 @@ async function verifyYouTube(handle: string, apiKey: string): Promise<VerifiedCh
|
||||
}
|
||||
|
||||
// Try as channel ID directly (starts with UC)
|
||||
if (handle.startsWith('UC')) {
|
||||
const res = await fetch(`${YT_BASE}/channels?part=id&id=${handle}&key=${apiKey}`);
|
||||
if (cleanHandle.startsWith('UC')) {
|
||||
const res = await fetch(`${YT_BASE}/channels?part=id,snippet&id=${cleanHandle}&key=${apiKey}`);
|
||||
const data = await res.json();
|
||||
if (data.items?.[0]) {
|
||||
return { handle, verified: true, channelId: handle, url: `https://youtube.com/channel/${handle}` };
|
||||
return { handle: cleanHandle, verified: true, channelId: cleanHandle, url: `https://youtube.com/channel/${cleanHandle}` };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user