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 asscrape.mjs and run node scrape.mjs. It prints the page as Markdown, starting with # Example Domain.
scrape.mjs
scrape.mts, run npm install --save-dev tsx, then run npx tsx scrape.mts.
Look up a brand
Replace the request and theconsole.log line with this lookup. It prints the company name.
Notes
- Methods use
camelCase, such asclient.web.mapUrls. Request fields keep their API names, such assharedParams. - Set
timeoutin milliseconds andmaxRetrieson the client:new ContextDev({ timeout: 120_000, maxRetries: 0 }). - Each Scrape output has
success. Check it before you readdata.