youtube.ts

Source

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.

View source

Parameters

  • videoId string
  • options Required
  • params Record

    optional

Returns

string
fncreateYouTubeElement(videoId: string, options: Required<YouTubeOptions>, title?: string, start?: string): ElementCreate YouTube embed element.

Create YouTube embed element.

View source

Parameters

  • videoId string
  • options Required
  • title string

    optional

  • start string

    optional

Returns

Element
fnextractVideoId(input: string): string | nullExtract YouTube video ID from various URL formats.

Extract YouTube video ID from various URL formats.

View source

Parameters

  • input string

Returns

string | literal
fngetAttribute(el: Element, name: string): string | undefinedGet element attribute value.

Get element attribute value.

View source

Parameters

  • el Element
  • name string

Returns

string | undefined
fnrehypeYouTube(options: Required<YouTubeOptions>)Rehype plugin to transform YouTube components.

Rehype plugin to transform YouTube components.

View source

Parameters

  • options Required
fntransformYouTube(html: string, options?: YouTubeOptions): Promise<string>Transform YouTube components in HTML.

Transform YouTube components in HTML.

View source

Parameters

  • html string
  • options YouTubeOptions

    optional

Returns

Promise