--- name: scraperapi-scraper-builder description: > Build a new, complete web scraper that uses ScraperAPI. Use this skill whenever the user wants runnable scraper code written from scratch for a site. Trigger on: "build me a scraper for [website]", "write a scraper that fetches product pages from [ecommerce site]", "I need to scrape [data] from [website]", "create a script that extracts [fields] from [URL]", "write code to scrape [website]", "implement a scraper for [URL]". Probes the site, decides structured endpoint vs. raw HTML, JS rendering, proxy tier and sync vs. async batch, then generates a Python or Node.js script with retries, error handling, pagination and credit estimates. Not for questions about the SDK in existing code (use the language's SDK skill, e.g. scraperapi-python-sdk), shell one-liners with the sapi tool (use scraperapi-cli), or no-code automations (use scraperapi-n8n or scraperapi-zapier). Note: Transmits user-supplied queries, URLs, and content to ScraperAPI. metadata: openclaw: requires: env: - SCRAPERAPI_API_KEY anyBins: - python - node emoji: "🛠️" homepage: https://docs.scraperapi.com/ --- # ScraperAPI Scraper Builder Build production-quality scrapers using ScraperAPI. Work through four phases: gather requirements, probe the target site, make architecture decisions, then generate a complete runnable script. ## Phase 1 — Gather Requirements Before writing code, collect the following. Pull from the user's prompt; ask only what is missing. | Info | Default if not specified | |------|--------------------------| | Target URL or website | Required — ask if missing | | Data fields to extract | Ask if vague ("product info" → which fields exactly?) | | Volume | Infer: single URL / paginated / bulk list of URLs | | Language | Ask if not clear from context; Python is a reasonable default | | Output format | stdout JSON | | Geo-targeting needed? | Infer from site type; confirm for e-commerce pricing | --- ## Phase 2 — Site Reconnaissance **Before making any architecture decisions, fetch 1–2 sample pages from the target site using ScraperAPI** to observe actual behavior. This replaces guesswork with evidence and costs 1–2 requests at the site's rate (1 credit on a normal site, 5 on Amazon, 25 on Google, 10 behind Cloudflare and similar). ### What to fetch Fetch at most two pages: 1. **A listing or category page** (the main target) — e.g., a product grid, search results, or article index 2. **A detail page** (only if the user needs data from individual items) — e.g., a single product, article, or profile Always start with a **standard request** (no `render`, no `premium`) — the cheapest probe: ``` GET https://api.scraperapi.com/?api_key=YOUR_API_KEY&url= ``` ### What to observe **1. Response status** | Status | Meaning | |--------|---------| | 200 | Proceed to content analysis | | 200 + body has "Just a moment", `cf-ray`, or "Cloudflare" | Cloudflare challenge page got through | | 200 + body has "DataDome", "PerimeterX", or "Akamai" | Bot manager detected | | 500 | ScraperAPI retried for 70s and still failed (not charged); anti-bot protection likely, premium proxies likely needed | | 403 | Account is out of credits; says nothing about the site. Stop and tell the user | | 429 | Rate limited; note for architecture phase | **2. Content completeness** (for 200 responses) Signals that `render=true` will be needed: - Empty SPA containers: `
`, `
`, `
` with no children - Framework markers in `