Skip to content

videos

Sweeps video elements and their source children, returning each src as an absolute, deduped URL:
const videos = await microlink.videos('https://example.com')

Options

Override the default rule of selectorAll: ['video[src]', 'video source[src]'], attr: 'src', and type: 'url' with selectorAll, selector, attr, or type.

Examples

Only the videos inside the article body:
const videos = await microlink.videos('https://example.com/post', {
  selectorAll: 'article video source'
})
Poster images instead of the sources:
const posters = await microlink.videos('https://example.com', {
  selectorAll: 'video[poster]',
  attr: 'poster'
})
This sweeps the markup; a YouTube or Vimeo page has no video element with a direct source. For the primary video of such a page, resolved through the provider, use video.