--- import "lite-youtube-embed/src/lite-yt-embed.css"; import urlMatcher from "./matcher"; export interface Props extends astroHTML.JSX.HTMLAttributes { id: string; poster?: string; posterQuality?: "max" | "high" | "default" | "low"; params?: string; playlabel?: string; } const { id, poster, posterQuality = "max", title, ...attrs } = Astro.props as Props; const idRegExp = /^[A-Za-z0-9-_]+$/; function extractID(idOrUrl: string) { if (idRegExp.test(idOrUrl)) return idOrUrl; return urlMatcher(idOrUrl); } const videoid = extractID(id); const posterFile = { max: "maxresdefault", high: "sddefault", default: "hqdefault", low: "default", }[posterQuality] || "maxresdefault"; const posterURL = poster || `https://i.ytimg.com/vi/${videoid}/${posterFile}.jpg`; const href = `https://youtube.com/watch?v=${videoid}`; --- {attrs.playlabel}