Skip to main content
The context.dev package works in JavaScript and TypeScript on Node.js 20 or later. SDKs covers the API key and the defaults all SDKs share.

Install

Scrape a page

Save this as scrape.mjs and run node scrape.mjs. It prints the page as Markdown, starting with # Example Domain.
scrape.mjs
For TypeScript, save the same code as scrape.mts, run npm install --save-dev tsx, then run npx tsx scrape.mts.

Look up a brand

Replace the request and the console.log line with this lookup. It prints the company name.

Notes

  • Methods use camelCase, such as client.web.mapUrls. Request fields keep their API names, such as sharedParams.
  • Set timeout in milliseconds and maxRetries on the client: new ContextDev({ timeout: 120_000, maxRetries: 0 }).
  • Each Scrape output has success. Check it before you read data.