Skip to content

Commit

Permalink
Add YT thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Dec 2, 2024
1 parent 4160bfb commit baf3a2c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ export const metadata = async (url) => {
if (result.twitterImage && result.twitterImage.length >= 1) {
image = result.twitterImage[0].url;
}
if (hostname === "youtu.be" || hostname.endsWith("youtube.com")) {
const id = getYTId(url);
if (id) {
image = `https://i.ytimg.com/vi/${id}/maxresdefault.jpg`;
}
}

const { ogTitle } = result;
let { ogDescription } = result;

Expand Down

0 comments on commit baf3a2c

Please sign in to comment.