ScrapeGraph AI: the open source scraper that puts a fresh company list in front of you every morning. Install, script and automation
With ScrapeGraph AI you don't write CSS selectors, you say what you want in a plain sentence: "extract this company's name and contact email". It reads the page with AI and turns it into a clean list. It's MIT licensed, free, and can run fully on your own computer with a local model through Ollama. Below: the install I verified against the repo, a ready prompt to give GPT-6 Astra or any other agent, a script that appends results to one spreadsheet, scheduling so it runs on its own every morning, and the legal line you need to know when building lists, especially in the UK.
The tool itself
If you just want the repo, the link is below. It's MIT licensed, fully open source, with over 32 thousand stars on GitHub. What's extra on this page: the two places the install trips you up, a ready script for a lead list, what to tell Astra, running it automatically every morning, and whose contact details you're allowed to collect.
How it works
Four steps
- 1
Source
A website URL, a list of URLs or a directory page
- 2
Prompt
You write what you want extracted in a plain sentence
- 3
Model
A local model in Ollama or an API like OpenAI, Gemini or Groq reads the page
- 4
List
The result comes back as clean data with the fields you defined, written to CSV
The library has a few ready pipelines. SmartScraperGraph for a single page, SmartScraperMultiGraph to scan a list of URLs with one prompt, SearchGraph to find the top search results and read them. For a lead list the most practical setup combines them: first collect company websites from a directory page or a search, then pull the contact details from each site.
Where Astra comes in
ScrapeGraph AI is a Python library that runs on your computer. Astra is the brain of the job: you hand it the repo, describe who you want to find, and it writes and fixes the script for your needs. You can give the same prompt to an agent that can run commands on your machine, like Claude Code or Codex; the ScrapeGraph side stays the same.
Using this repo, write me a lead list script:
https://github.com/ScrapeGraphAI/Scrapegraph-ai
Target: e-commerce brands in the UK (500 for the first round).
First collect these brands' websites (a directory page or SearchGraph).
Then extract from each site: brand name, website, founder or owner name,
the business email and phone OPENLY published on the contact page.
Append the results to leads.csv and skip sites that were already added.
Use llama3.2 in Ollama as the LLM.
The script will run every morning via Windows Task Scheduler; resolve file paths relative to the script's folder.This is a workflow you build
Neither OpenAI nor ScrapeGraph offers a ready "lead list every morning" button. Astra writes the script, ScrapeGraph reads the pages, your computer handles the schedule. Once you wire the three together, the rest runs on its own.
Ready script: one row per company
If you want to see what comes out before having Astra write it, this script works as a skeleton. You put one company website per line in sites.txt; the script reads each site and appends it to leads.csv, skipping the ones already added. So every run adds only new companies to the list.
import csv
from pathlib import Path
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SmartScraperGraph
FOLDER = Path(__file__).parent # correct folder under the scheduler too
CSV = FOLDER / "leads.csv"
FIELDS = ["name", "site", "owner", "email", "phone"]
class Company(BaseModel):
name: str = Field(description="The brand's name")
site: str = Field(description="The website URL")
owner: str = Field(description="Founder or owner name, empty if missing")
email: str = Field(description="Business email openly published on the site, empty if missing")
phone: str = Field(description="Phone published on the site, empty if missing")
config = {
"llm": {"model": "ollama/llama3.2", "temperature": 0, "model_tokens": 8192},
"verbose": False,
"headless": True,
}
seen = set()
if CSV.exists():
with open(CSV, encoding="utf-8") as f:
seen = {row["site"] for row in csv.DictReader(f)}
sites = (FOLDER / "sites.txt").read_text(encoding="utf-8").split()
new_file = not CSV.exists()
with open(CSV, "a", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS, extrasaction="ignore", restval="")
if new_file:
writer.writeheader()
for site in sites:
if site in seen:
continue
result = SmartScraperGraph(
prompt="Extract this brand's name, founder, and the business email and phone openly published on its contact page",
source=site,
schema=Company,
config=config,
).run()
data = result.get("content", result)
data["site"] = site
writer.writerow(data)You can open leads.csv in Excel or import it into Google Sheets. If you want it to write straight into a Google Sheet, tell Astra separately; it takes a bit longer because it needs a Google API key.
Make it run on its own every morning
On Windows, Task Scheduler does this. The command below runs the script every morning at 08:00 with the Python from the virtual environment. Change the paths to your own folder.
schtasks /create /tn "LeadList" /sc daily /st 08:00 /tr "C:\leads\.venv\Scripts\python.exe C:\leads\leads.py"Where scheduling trips you up
A relative path like open("leads.csv") in the script
The scheduler starts the script in another folder; build paths from Path(__file__).parent
Plain python inside /tr
The full path to the virtual environment's python.exe, or scrapegraphai won't be found
Expecting it to run while the computer is off
At 08:00 the computer must be on and Ollama must be running
On Mac or Linux, cron does the same job; just tell Astra "run this every morning at 08:00 with cron".
Whose details you can collect
Public doesn't mean free to use
In the UK, UK GDPR and PECR apply. A company's general contact address (info@, hello@) is not the same as an email carrying a person's name: the second counts as personal data, and sending unsolicited marketing email to sole traders in particular can require consent. The safe route: collect only business contact details openly published on the site, say in your first message why you're writing and how to opt out, and respect the site's terms and robots.txt. This isn't legal advice; if you're doing it at scale, ask an expert.
Tools used
ScrapeGraph AI
An open source, AI-powered Python scraping library. It reads websites and local documents like HTML, JSON, XML and Markdown and extracts the information you ask for. Instead of writing selectors that break when the page layout changes, you say what you want; with a Pydantic schema you can also fix which fields the output contains. As the LLM it uses APIs like OpenAI, Gemini, Groq and Azure, or local models through Ollama. The library itself is free; if you use an API, your only cost is model tokens.
- pip install fails on Python 3.11 or older; the package requires 3.12 and up
- If you forget playwright install, the install looks fine but sites won't open
- If Activate.ps1 says running scripts is disabled, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once
# Python 3.12 or newer is required
winget install Python.Python.3.12
mkdir C:\leads; cd C:\leads
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1
pip install scrapegraphai
playwright install # downloads the browser used to open sites, don't skip itThe big banner at the top of the README points to scrapegraphai.com: that's the paid cloud API, which needs an SGAI_API_KEY and credits. The install on this page is the free open source library and needs no key. Know the difference: in the open source version, proxies and getting past bot protection are your job, so some sites behind Cloudflare may come back empty. Drop those from the list or fill them in by hand.
Ollama
A free app that runs open models on your computer. When you connect ScrapeGraph AI to Ollama, you don't pay a scraping platform or an API for every company; the model on your own machine reads the pages and the data never leaves it. Download and install it from ollama.com, then pull the model.
ollama pull llama3.2llama3.2 is a small, fast model, but it can miss fields on long, messy pages. If you see lots of empty emails in the list, check a few sites by hand first; the email may really not be published. If it's the model, switch to a bigger local model or point the config at an API (README example: "model": "openai/gpt-4o-mini" plus api_key). Local speed depends on your graphics card; 500 sites can take hours on the first round, so do your first test with 10 sites.
DOA: Yapay Zeka ve Otomasyon
Installing these tools on your own is one thing; actually building with them is another. The community has people using these daily and people building systems from scratch.
If you want a system that actually runs in your business, let's talk for 10 minutes; I'll look at what you're trying to build and tell you which path fits. Free, and not a sales pitch.
Book a 10-minute callIf you'd rather learn this alongside people doing the same work instead of on your own, the community is always open:
Join the communityThis is an affiliate link.