Credentials. Hosted models need an API key in the config; keep it in an environment variable rather than in the script.
Who it is forAn analyst who needs company descriptions, founders or links from many sites without writing selectors.
The problemSelector-based scrapers break whenever a site changes and take time to write for every new layout.
The outcomeA JSON result with exactly the information your prompt asked for.
What you need first
- Python, ideally in a virtual environment
- Playwright browsers, installed with playwright install
- An LLM: a local model through Ollama, or an API key for OpenAI, Groq, Azure, Gemini or another provider
Steps
- Run
pip install scrapegraphaiinside a virtual environment - Run
playwright installso the library can fetch website content - Set graph_config with an llm block, for example the ollama/llama3.2 model, or an api_key and openai/gpt-4o-mini
- Create a SmartScraperGraph with your prompt, the source URL and the config
- Call
smart_scraper_graph.run()and print or save the dictionary it returns
Prompt for your agent
Using ScrapeGraphAI/Scrapegraph-ai with <ollama/llama3.2 or my OpenAI key from the environment>, build a SmartScraperGraph that visits each URL in <list> and extracts <fields>. Save all results to one JSON file and flag any page where a field came back empty.
Caveat. LLM extraction can miss or invent fields, so spot check results; also respect each site's terms and robots rules.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for ScrapeGraphAI/Scrapegraph-ai and "Scrape a web page by describing what you want"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer