scraperapi-nodejs-sdklisted
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