TL;DR
The fastest way to scrape a modern web app into CSV or JSON is to call the JSON API behind it instead of rendering pages. Find the app's backend requests in the network tab, call them directly, and the data arrives already structured. When no API is reachable, schema-based AI extraction turns rendered pages into typed records.
Fastest Path: Skip the Rendering
A single-page web app (React, Vue, Angular) loads its data from a backend API and draws it in the browser. Rendering that app with a headless browser just to read the result is the slow way. The fast way is to call the same API the app calls, covered in scraping a JS site without a headless browser. The response is usually JSON already, so you are one step from your output file:
import csv, requests
rows = requests.get("https://app.example.com/api/items",
params={"page": 1, "limit": 100}, timeout=(5, 30)).json()["items"]
with open("out.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=rows[0].keys())
writer.writeheader()
writer.writerows(rows)Getting to CSV vs JSON
JSON is the natural output when the source is an API: dump the response, optionally reshaping fields. CSV needs one more decision, flattening. Nested JSON (an object with a list of tags) does not map cleanly to rows, so you pick the fields that make a flat table and expand or join the nested parts. For deeply nested data, JSON preserves the shape; CSV forces a flattening choice.
When There Is No Callable API
Some apps sign their API requests or gate them behind tokens you cannot reproduce. Then you render the page and extract. The fast, resilient way to get structured output from a rendered page is schema-based AI extraction: define the fields, get typed JSON back, write it to CSV or JSON. This avoids brittle per-app selectors.
Key Takeaways
- The fastest route is calling the app's own JSON API, not rendering pages.
- JSON maps directly from API responses; CSV needs a flattening decision for nested data.
- When the API is not reachable, schema-based extraction yields typed records to export.
How ScrapeGraphAI Handles This
ScrapeGraphAI returns structured JSON directly from the extract endpoint, whether the data comes from an API-backed app or a rendered page, so you go from URL to typed records to CSV or JSON without inspecting network traffic or writing selectors.