youtube.ts
6 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
Reference
fnbuildEmbedUrl(videoId: string, options: Required<YouTubeOptions>, params?: Record<string, string>): stringBuild YouTube embed URL with parameters.
Build YouTube embed URL with parameters.
Parameters
-
videoIdstring -
optionsRequired -
paramsRecordoptional
Returns
string
fncreateYouTubeElement(videoId: string, options: Required<YouTubeOptions>, title?: string, start?: string): ElementCreate YouTube embed element.
Create YouTube embed element.
Parameters
-
videoIdstring -
optionsRequired -
titlestringoptional
-
startstringoptional
Returns
Element
fnextractVideoId(input: string): string | nullExtract YouTube video ID from various URL formats.
Extract YouTube video ID from various URL formats.
Parameters
-
inputstring
Returns
string | literal
fngetAttribute(el: Element, name: string): string | undefinedGet element attribute value.
Get element attribute value.
Parameters
-
elElement -
namestring
Returns
string | undefined
fnrehypeYouTube(options: Required<YouTubeOptions>)Rehype plugin to transform YouTube components.
fntransformYouTube(html: string, options?: YouTubeOptions): Promise<string>Transform YouTube components in HTML.
Transform YouTube components in HTML.
Parameters
-
htmlstring -
optionsYouTubeOptionsoptional
Returns
Promise