Write, debug, and tune Playwright specs with locator strategy, trace diagnosis, and CI-aware timeouts.
Browser
Scrapfly SDK TypeScript
Try itWeb scraping from TypeScript or JavaScript with the Scrapfly SDK (`scrapfly-sdk`). Use when the user asks to scrape a URL, bypass anti-bot protection, render...
What it does
Use the package to scrape web pages from TypeScript/JavaScript with proxy rotation, anti-bot bypass (ASP), JavaScript rendering, screenshots, and AI extraction. Runs on Node.js, Deno, Bun, and edge runtimes (Cloudflare Workers, AWS Lambda).
The skill document
Scrapfly TypeScript SDK
Use the scrapfly-sdk package to scrape web pages from TypeScript/JavaScript
with proxy rotation, anti-bot bypass (ASP), JavaScript rendering, screenshots,
and AI extraction. Runs on Node.js, Deno, Bun, and edge runtimes
(Cloudflare Workers, AWS Lambda).
When to use
- Scraping web pages (HTML, JSON, text, markdown) from a TS/JS codebase
- Bypassing anti-bot protections (Cloudflare, DataDome, PerimeterX, Kasada)
- Rendering JavaScript-heavy pages with a headless browser
- Capturing screenshots or extracting structured data
- Concurrent scraping of many URLs
Setup
npm install scrapfly-sdk
# Deno / JSR: import from 'jsr:@scrapfly/scrapfly-sdk'
export SCRAPFLY_API_KEY="your-api-key"
Get your API key at scrapfly.io.
Basic scrape
import { ScrapflyClient, ScrapeConfig } from 'scrapfly-sdk';
const client = new ScrapflyClient({ key: process.env.SCRAPFLY_API_KEY });
const result = await client.scrape(
new ScrapeConfig({ url: 'https://web-scraping.dev/products' }),
);
console.log(result.result.content);
Anti-bot bypass, geo-targeting, JS rendering
ScrapeConfig uses snake_case option keys, matching the API.
const result = await client.scrape(
new ScrapeConfig({
url: 'https://web-scraping.dev/products',
asp: true, // bypass anti-bot
country: 'us', // proxy country (ISO 3166-1 alpha-2)
proxy_pool: 'public_residential_pool',
render_js: true, // headless browser rendering
wait_for_selector: 'div.product', // requires render_js
rendering_wait: 5000, // ms, requires render_js
format: 'markdown', // raw | clean_html | json | markdown | text
}),
);
Screenshots and extraction
import { ScreenshotConfig, ExtractionConfig } from 'scrapfly-sdk';
const shot = await client.screenshot(
new ScreenshotConfig({ url: 'https://web-scraping.dev/products' }),
);
// shot.image is the binary image data
const html = (await client.scrape(
new ScrapeConfig({ url: 'https://web-scraping.dev/reviews' }),
)).result.content;
const data = await client.extract(
new ExtractionConfig({
body: html,
content_type: 'text/html',
extraction_prompt: 'extract the reviews as JSON with fields: review, date, rating, author',
}),
);
console.log(data.data);
Concurrent scraping
const configs = [
new ScrapeConfig({ url: 'https://web-scraping.dev/products?page=1' }),
new ScrapeConfig({ url: 'https://web-scraping.dev/products?page=2' }),
];
for await (const result of client.concurrentScrape(configs)) {
console.log(result.result.content.slice(0, 100));
}
Important notes
render_js: trueis required forrendering_wait,wait_for_selector, and screenshotsproxy_pool: 'public_residential_pool'is recommended alongsideasp: true- Use
format: 'markdown'for clean, LLM-friendly content - The API key is read from the
keyconstructor option (passprocess.env.SCRAPFLY_API_KEY) - Read the page body via
result.result.content
Related skills
Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.
Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.
Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
More from scrapfly
Browse all skillsWeb scraping using the Scrapfly Scraper API with the Python SDK
Cross-tool golden rules for an autonomous Scrapfly web agent connected to the Scrapfly MCP server (web_scrape, screenshot, extract, classify_block, the Cloud...
Threshold-based alerting on Scrapfly account metrics. Wire up rules like "alert me when scrape success rate drops below 95% for 10 minutes" and receive notif...
Automate cloud browsers using the Scrapfly Cloud Browser API with Python Playwright
Use the Scrapfly CLI (`scrapfly`) to scrape web pages, capture screenshots, extract structured data with AI, crawl entire sites, and drive a cloud browser ov...
Crawl entire websites using the Scrapfly Crawler API with the Python SDK