SDKs
SDKs for TypeScript, Python and Go
Typed clients for every endpoint: one method per route, typed parameters, retries on temporary failures, paging helpers and clear errors.
Not published yet
The packages are ready and will be published on npm, PyPI, Go modules and Homebrew shortly. Until then, call the HTTP API directly: every endpoint page has cURL, Python and Node.js examples.
01Install
npm install scrapesocial # or: pnpm add scrapesocial
02Quick start
Every route is client.<platform>.<action>, with the platform and action names of these docs. Each endpoint page shows its own call in every SDK.
import { ScrapeSocial } from 'scrapesocial';
const client = new ScrapeSocial({ apiKey: process.env.SCRAPESOCIAL_API_KEY });
const profile = await client.instagram.profile({ handle: 'nasa' });
console.log(profile.credits_charged, profile.credits_remaining);
const channel = await client.youtube.channel({ handle: 'NASA' });03Errors and retries
A failed call raises a typed error with the HTTP status, the error code and the message from the API; nothing is charged for it. Temporary failures (503, 429, network errors) are retried with backoff before they reach you.
import { ForbiddenError, NotFoundError } from 'scrapesocial';
try {
await client.instagram.userPosts({ handle: 'someone' });
} catch (error) {
if (error instanceof NotFoundError) console.log('no such account');
else if (error instanceof ForbiddenError) console.log('private account');
else throw error;
}04Paging
List routes return a cursor for the next page. Pass it back yourself, or let the paging helper follow it.
for await (const page of client.instagram.userPostsPages({ handle: 'nasa' }, { maxPages: 5 })) {
for (const post of page.items ?? []) console.log(post);
}