The scraper broke at two in the morning because someone renamed .price to .product-price. One line of CSS, forty sites, twelve fields: the maintenance tax of scraping is not writing the scraper, it is re-reading the DOM every time a designer sneezes. ScrapeGraphAI starts from a different premise: stop telling the machine where the data is. Tell it what you want, and let a language model read the page.
ScrapeGraphAI is a Python library — MIT, past thirty-two thousand stars, version 2.3.1 released in early October — that turns extraction into a graph of small steps: fetch, parse, answer. SmartScraperGraph takes a prompt and a URL and returns a dictionary. SearchGraph starts from search results, SmartScraperMultiGraph fans out over a list of pages, ScriptCreatorGraph writes a Python scraper instead of extracting once, and SpeechGraph turns a page into audio. There are variants for CSV, JSON, XML, Markdown and local documents too; the multi versions run their graph instances concurrently, with a semaphore to keep the model calls under control.
Under the hood it is less magic than the tagline — You Only Scrape Once — suggests. A custom graph engine of nodes and edges runs a FetchNode (requests for static pages, Playwright/Chromium for JavaScript-heavy ones, with optional proxies and third-party fetchers such as Scrape.do), a ParseNode (HTML to text, chunked by token budget with semchunk), and a GenerateAnswerNode that sends the content and the prompt to a LangChain-compatible model: OpenAI, Bedrock, Mistral, Gemini, DeepSeek, xAI, MiniMax or a local Ollama model. Long pages are split into chunks and answered in parallel; a tolerant JSON parser and an optional Pydantic schema hold the shape; reattempt retries when the answer comes back empty or "NA"; reasoning inserts a step before the final answer. Optional Burr tracing, and telemetry on by default — opt out with SCRAPEGRAPHAI_TELEMETRY_ENABLED=false.
pip install scrapegraphai
playwright install
from scrapegraphai.graphs import SmartScraperGraph
graph = SmartScraperGraph(
prompt="List each product with name, price and availability",
source="https://example.com/shop",
config={
"llm": {"model": "ollama/llama3.2", "format": "json"},
"headless": True,
"reattempt": True,
},
)
print(graph.run())
The interesting part is what a prompt buys. A selector encodes structure: it assumes the price lives in .price, today and next month. A prompt encodes intent: “list each product with name, price and availability”. When the layout changes, the selector breaks; the prompt has a chance of still working. That makes the library good for the long tail — a handful of sites that keep changing, documents in XML or Markdown, a one-off extraction where writing a parser costs more than a few thousand tokens. It is also why ScriptCreatorGraph exists: use the model to discover the structure once, then generate a Python script you can inspect and run without the model.
flowchart LR U[URL or local document] --> F[Fetch + render] F --> P[Parse + chunk] P --> G[LLM answer] G --> S[Schema / JSON] G -. reattempt .-> G
Then the bill. Every page is at least one model call; long pages become several, and the multi graphs multiply them. Latency is seconds, not milliseconds; cost is tokens per page; output is probabilistic. A schema and retries reduce drift, but they do not make the model deterministic. The open-source library also leaves the hostile web to you: Playwright helps, proxies are bring-your-own, and the README’s own comparison puts managed stealth, crawling and monitoring in the paid API. And in 2.3.1 the RobotsNode exists but is not instantiated by any graph, so robots.txt and the site’s terms are entirely your call; the repo is explicit that it is meant for research and exploration, not as a licence to ignore either.
None of that makes it a bad tool; it makes it a different one. For ten thousand stable product pages, a parser is cheaper, faster and exact. For forty changing sites where the shape of the data matters more than the markup, a prompt is a reasonable bet. ScrapeGraphAI’s contribution is to make that trade explicit — and to give you a graph to hang it on. The selector was never the point; the data was.
The tagline says You Only Scrape Once. Read it as a promise about selectors, not about bills: you write the intent once, and then you pay the model on every page. Whether that is a bargain depends on how often your pages change — and how much you trust a JSON object you did not parse yourself.
Fuentes
- ScrapeGraphAI/Scrapegraph-ai (repo)
- docs.scrapegraphai.com (docs)

Deja una respuesta