← ClaudeAtlas

scraperapi-nodejs-sdklisted

Best-practices reference for the ScraperAPI Node.js / JavaScript SDK (scraperapi-sdk npm package). Consult whenever the user is writing, debugging, or reviewing JavaScript or TypeScript code that calls ScraperAPI. Use when user asks: "scrape a website with Node.js and ScraperAPI", "ScraperAPI JavaScript example", "how do I use scraperapi-sdk in Node", "ScraperAPI TypeScript", "ScraperAPI async await Node.js", "ScraperAPI POST request JavaScript", "Node.js ScraperAPI render", "ScraperAPI account info Node". Covers both CommonJS and ESM import styles, Promises and async/await, all request parameters, POST/PUT requests, account info, error handling, and credit costs.
scraperapi/scraperapi-skills · ★ 9 · AI & Automation · score 78
Install: claude install-skill scraperapi/scraperapi-skills
# ScraperAPI — Node.js SDK Best Practices **Requires:** Node.js 14+, `npm install scraperapi-sdk`, `SCRAPERAPI_API_KEY` environment variable. ## Setup ```js // CommonJS const scraperapiClient = require('scraperapi-sdk')(process.env.SCRAPERAPI_API_KEY); // ES Modules / TypeScript import ScraperAPIClient from 'scraperapi-sdk'; const scraperapiClient = new ScraperAPIClient(process.env.SCRAPERAPI_API_KEY); ``` Never hardcode the API key. Read it from the environment every time. ## Decision Guide | Situation | Pattern | |-----------|---------| | Single URL, result needed now | `scraperapiClient.get(url)` | | 20+ URLs or batch work | Async Jobs API — `fetch/axios` to `async.scraperapi.com/jobs` | | Supported platform (Amazon, Google, Walmart, eBay, Redfin) | Structured Data endpoint — `api.scraperapi.com/structured/<vertical>` | | Page loads content via JavaScript | `.get(url, { render: true })` | | Site blocks datacenter proxies | `.get(url, { premium: true })` | | Need to POST a form or JSON body to the target | `.post(url, options)` | ## Basic Usage ```js // GET — returns HTML as a string (Promise-based) const html = await scraperapiClient.get('https://example.com/'); // With parameters const html = await scraperapiClient.get('https://example.com/', { render: true, country_code: 'us', }); // Without async/await (Promise chain) scraperapiClient.get('https://example.com/') .then(html => console.log(html)) .catch(err => console.error(err)); ``` ## POST and PUT R