Skip to content

Specialized

The specialized methods cover the deeper capabilities — remote code execution, search, media extraction, custom extraction rules, and tech detection.

Run

Execute your own JavaScript against a live page and get the value back. Code that never touches page runs faster and cheaper:
const { value } = await microlink.run('https://example.com', () => 40 + 2)
Ask for page to drive a real browser session:
const { value } = await microlink.run('https://example.com', async ({ page }) => {
  await page.waitForSelector('h1')
  return page.$eval('h1', el => el.textContent)
})
Extra options become named arguments, and the full result also exposes isFulfilled, logging, and profiling:
const { value, logging, profiling } = await microlink.run(
  'https://example.com',
  ({ page, selector }) => page.$eval(selector, el => el.textContent),
  { selector: 'h1' }
)
function is an alias of run. See the function guide for writing patterns, package dependencies, and profiling.
Google results as structured data. Unlike the other methods, search requires an apiKey on every request. The resolved page carries results, knowledgeGraph, peopleAlsoAsk, and relatedSearches:
const page = await microlink.search('Lotus Elise S2')

console.log(page.results)
Switch verticals with typenews, images, videos, places, maps, shopping, scholar, patents, or autocomplete — and refine with location, period, and limit:
const { results } = await microlink.search('open source llm', {
  type: 'news',
  period: 'week'
})
Every result can expand itself lazily — result.markdown(), result.html() — and pages paginate with page.next():
let page = await microlink.search('node.js frameworks')

while (page) {
  for (const result of page.results) console.log(result.title)
  page = await page.next()
}

Video

The primary video of the page as a direct, playable asset:
const { url, type } = await microlink.video('https://vimeo.com/76979871')

Audio

The primary audio track as a direct asset:
const { url } = await microlink.audio('https://open.spotify.com/track/3BovdzfaX4jb5KFQwoPfAw')

Extract

Typed values pulled with CSS selector rules, using the MQL rules grammar:
const { image } = await microlink.extract('https://microlink.io', {
  image: {
    selector: 'meta[property="og:image"]',
    attr: 'content',
    type: 'image'
  }
})

Technologies

The tech stack powering any site:
const technologies = await microlink.technologies('https://microlink.io')

Lighthouse

A full Lighthouse report for any URL:
const report = await microlink.lighthouse('https://example.com')