How do I install ScrapeGraphAI in n8n?
Three steps. About 15 minutes.
Step 1: Install ScrapeGraphAI
bash
pip install scrapegraphai
playwright install
The official repo is github.com/ScrapeGraphAI/Scrapegraph-ai — MIT licensed, 24.5k stars.
Step 2: Pick your LLM provider
ScrapeGraphAI works with OpenAI, Groq, Azure, Gemini, and local models via Ollama. For free local-first scraping, install Ollama and pull a small model:
bash
ollama pull llama3.1:8b
Step 3: Wire it into n8n via the Execute Command node
In n8n, drop in an "Execute Command" node and call a Python script that runs ScrapeGraphAI. Capture stdout and pipe to the rest of your workflow.
Step 4: Write your first SmartScraperGraph
python
from scrapegraphai.graphs import SmartScraperGraph
graph_config = {
"llm": {
"model": "ollama/llama3.1:8b",
"temperature": 0,
"format": "json",
"base_url": "http://localhost:11434",
},
}
smart_scraper = SmartScraperGraph(
prompt="Extract every product name, price, and link from this page",
source="https://example-shop.com/products",
config=graph_config,
)
result = smart_scraper.run()
print(result)
That is the entire scraper. No selectors, no XPath, no manual page parsing.
Step 5: Use the right pipeline for the job
ScrapeGraphAI ships multiple pipelines:
| Pipeline | Use case |
|---|---|
| SmartScraperGraph | Single-page extraction |
| SmartScraperMultiGraph | Many pages at once |
| SearchGraph | Multi-page search results |
| ScriptCreatorGraph | Generates Python scripts you can keep |
| SpeechGraph | Generates audio from extracted data |
Step 6: Hand off to n8n for the workflow
Once ScrapeGraphAI returns clean JSON, n8n takes over: dedupe in a Function node → push to Google Sheets → notify Slack. Five-step workflow, all free.
What is ScrapeGraphAI?
ScrapeGraphAI is an open-source Python library for AI-powered web scraping. The README's own description: "a web scraping python library that uses LLM and direct graph logic to create scraping pipelines for websites and local documents".
The killer feature is natural-language extraction. Instead of writing CSS selectors or XPath, you write a sentence: "Extract every job title, salary, and posted date." The model walks the DOM and pulls the data.
The repo has 24.5k GitHub stars and 2.2k forks as of May 2026.
Is ScrapeGraphAI really free?
Yes — MIT licensed including commercial use. The library is free. You only pay for the LLM calls, and if you use Ollama or NVIDIA Build's free credits, you can run scraping for $0.
Compare with Apify's tiers:
| Apify tier | Monthly cost | Compute |
|---|---|---|
| Free | $0 | $5 prepaid credits, 1 GB Actor RAM |
| Starter | $29 | $29 credits, 8 GB RAM |
| Scale | $199 | $199 credits, 32 GB RAM |
| Business | $999 | $999 credits, 128 GB RAM |
ScrapeGraphAI on a self-hosted Ollama runs unlimited at zero per-request cost.
How is ScrapeGraphAI different from Apify?
Three differences:
- No selectors. Apify Actors are typically hand-written scrapers tied to specific sites. ScrapeGraphAI infers structure from natural-language prompts.
- Self-hosted vs SaaS. ScrapeGraphAI runs in your own process. Apify charges by compute units.
- Drop-in to any pipeline. ScrapeGraphAI is a Python library — wire it into n8n, FastAPI, a cron job, or Airflow. Apify is a platform you stay inside.
The trade: Apify has thousands of pre-built actors ready to go. ScrapeGraphAI is one library that works on anything but you build the wiring.
What's the catch?
- LLM costs add up if you use OpenAI. A heavy scraping run on GPT-4o can cost $5-20. Use Ollama or NVIDIA Build to keep costs at $0.
- Sites with heavy JavaScript or anti-bot can still block you. ScrapeGraphAI uses Playwright, which helps, but some sites still need rotating proxies. For those, an Apify Actor is sometimes pragmatic.
- Determinism is lower than hand-written scrapers. The LLM sometimes restructures output. Add a JSON schema check in your n8n flow.
Bottom line
For 80% of scraping jobs — extracting structured data from any site without writing selectors — ScrapeGraphAI replaces Apify entirely. Self-host it, point it at a free local model, wire it into n8n, and your scraping bill drops to zero.
Related Nanoflow guides
Want a hand?
Book a 30-min call.
Walk through your stack with us. We'll find the bottleneck and map out the exact wiring you need — free.