fix: use predictable YouTube thumbnail URL as fallback for embed poster
YouTube may block og:image extraction via BackspaceBot user-agent.
Use img.youtube.com/vi/{ID}/hqdefault.jpg as a guaranteed thumbnail
that doesn't require metadata fetching. If og:image is successfully
fetched, it overwrites the fallback.
This commit is contained in:
@@ -78,6 +78,12 @@ export async function resolveEmbeds(
|
||||
// Track the effective embed type (may be overridden by Content-Type detection)
|
||||
let effectiveEmbedType = classification.embedType;
|
||||
|
||||
// For YouTube/Vimeo, use predictable thumbnail URLs as fallback
|
||||
if (classification.provider === 'youtube' && classification.embedUrl) {
|
||||
const ytId = classification.embedUrl.split('/').pop()?.split('?')[0];
|
||||
if (ytId) image = `https://img.youtube.com/vi/${ytId}/hqdefault.jpg`;
|
||||
}
|
||||
|
||||
if (classification.embedType === 'image') {
|
||||
// Direct image URL — no fetch needed, use the URL as the image source
|
||||
image = url;
|
||||
|
||||
Reference in New Issue
Block a user