From c131913b8ad070cc9b1022bb3604723501ca246f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20=C4=B0pek?= Date: Mon, 6 Oct 2025 00:02:02 +0300 Subject: [PATCH] feat: add YouTube channel ID to chat message data model --- backend/src/ingestion/youtubei.ts | 4 ++++ shared/chat.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/backend/src/ingestion/youtubei.ts b/backend/src/ingestion/youtubei.ts index c1edbda..f921c45 100644 --- a/backend/src/ingestion/youtubei.ts +++ b/backend/src/ingestion/youtubei.ts @@ -306,10 +306,14 @@ function normalizeAction(action: any): ChatMessage | null { } } + // Extract channel ID from author object (item.author.id contains the YouTube channel ID) + const authorChannelId = item.author?.id; + return { id: String(item.id ?? item.timestamp_usec ?? Date.now()), author: String(item.author?.name ?? 'Unknown'), authorPhoto: item.author?.thumbnails?.[0]?.url, + authorChannelId: authorChannelId ? String(authorChannelId) : undefined, text: resolveMessageText(item), publishedAt: resolveTimestamp(item.timestamp ?? item.timestamp_usec), badges: badges.length > 0 ? badges : undefined, diff --git a/shared/chat.ts b/shared/chat.ts index 77e1cef..597e692 100644 --- a/shared/chat.ts +++ b/shared/chat.ts @@ -14,6 +14,7 @@ export type ChatMessage = { id: string; author: string; authorPhoto?: string; + authorChannelId?: string; text: string; publishedAt: string; badges?: Badge[];