Capture YouTube titles from Discord's embed cache

This commit is contained in:
Fisto
2026-09-20 19:50:34 +02:00
parent f22ab5ea5f
commit cc3d62336c
9 changed files with 122 additions and 5 deletions
+8 -3
View File
@@ -34,6 +34,8 @@ export interface ExtractedMedia {
previewUrl: string | null;
/** Embed title, when Discord provides one (YouTube and friends). Null elsewhere. */
title: string | null;
/** Embed author (the YouTube channel Discord shows). Null elsewhere. */
titleAuthor: string | null;
}
/**
@@ -95,7 +97,8 @@ function extractEmbed(embed: CoreEmbed): ExtractedMedia | null {
width: embed.width ?? null,
height: embed.height ?? null,
durationSecs: null,
title: embed.title ?? null
title: embed.title ?? null,
titleAuthor: embed.authorName ?? null
};
if (embed.videoUrl) {
@@ -150,7 +153,8 @@ function extractSticker(sticker: CoreSticker): ExtractedMedia | null {
durationSecs: null,
downloaded: false,
previewUrl: null,
title: null
title: null,
titleAuthor: null
};
}
@@ -178,7 +182,8 @@ function extractFrom(message: MediaMessage): ExtractedMedia[] {
: null,
downloaded: false,
previewUrl: null,
title: null
title: null,
titleAuthor: null
});
}