agentleFS
manypicommanypicom/sales-skills/skills/web-scraping-lead-data/SKILL.md

web-scraping-lead-data

Skill1 starsChanged 2 months agoMITView on GitHub

Extract structured lead and company data from websites reliably, and handle the legal and technical constraints. Use whenever the user mentions web scraping, data extraction, crawling sites for leads, parsing HTML, building a scraper, extracting company data, rate limiting, anti-bot measures, or turning a directory into a list. Also use when the data needed for an ICP doesn't exist in any database.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When an ICP is defined by something no database has a field for — companies present on a marketplace, running a particular integration, …

    line 8
  2. Distinctive:

    Check: field lengths within plausible ranges, no navigation or cookie-banner text captured as content, no placeholder values, and no …

    line 81
  3. Distinctive:

    Spot-check 20 records against their source URLs by hand: before using a scraper's output for anything.

    line 83
  4. Distinctive:

    Cache aggressively: Never fetch the same URL twice in a run.

    line 93
  5. Distinctive:

    Never scrape anything behind a login you'd be violating terms to use.

    line 111
  6. Distinctive:

    Don't build a fragile scraper for a one-off list: If it's needed once, research it once.

    line 144

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Scraping for Lead Data

When an ICP is defined by something no database has a field for — companies present on a marketplace, running a particular integration, publishing a certain kind of page — the data has to come off the web directly.

Two things decide whether this works: extracting into a schema rather than free text, and staying within limits that keep you unblocked and defensible.

Extract into a schema

The most common failure is scraping page text and trying to parse meaning out of it later. Decide the shape first, then extract into it.

{
  "company_name":   "string, required",
  "domain":         "string, required, registrable domain only",
  "category":       "string | null",
  "location":       "string | null",
  "employee_hint":  "string | null",
  "contact_name":   "string | null",
  "contact_title":  "string | null",
  "email":          "string | null",
  "signal":         "string | null, the qualifying fact",
  "source_url":     "string, required",
  "extracted_at":   "ISO 8601, required"
}

Three fields are non-negotiable and routinely missing:

  • source_url — where each fact came from. It makes claims checkable, it's how you catch fabrication, and it's what makes "where did you get my details" answerable in one sentence.
  • extracted_at — data has a shelf life. Without a timestamp you can't tell fresh from stale.
  • Nullable everything optional — a scraper that must fill every field will produce garbage for the pages where the data isn't there. Null is a valid, informative answer.

Selectors that survive

Sites change. Brittle selectors break silently and you find out when the list is empty or, worse, full of nonsense.

FragileDurable
div.css-1x9f8b > span:nth-child(3)[itemprop="name"], h1
Position-based indexingAttribute and semantic selectors
Generated class namesdata-* attributes, ARIA roles
Scraping the rendered DOMJSON-LD in the page, or an underlying JSON endpoint

Look for structured data before writing any selector. Many sites already publish exactly what you want:

# JSON-LD is often the whole record, cleanly
curl -s https://example.com/company/acme \
  | grep -oPz '(?s)<script type="application/ld\+json">.*?</script>' \
  | sed -e 's/<[^>]*>//g'

# Meta tags
curl -s https://example.com | grep -oE '<meta[^>]*(og:|description)[^>]*>'

# Sitemaps: the site telling you its own URL structure
curl -s https://example.com/sitemap.xml | grep -oP '(?<=<loc>)[^<]+' | head -20

Many sites also back their listing pages with a JSON API the front end calls. Finding it turns a fragile scrape into a clean, paginated data source. Check the network requests.

Validate every field

Scraped data is wrong often enough that unvalidated output will render into an email in front of a prospect.

# Domains that aren't domains
grep -vE '^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z]{2,})+$' domains.txt

# Boilerplate that got captured instead of the real value
grep -icE 'lorem|example\.com|your company here|click here|cookie|accept all'

# Truncated or absurd values
awk 'length($0) < 2 || length($0) > 200' companies.txt

Check: field lengths within plausible ranges, no navigation or cookie-banner text captured as content, no placeholder values, and no repeated identical values across records (a strong sign the selector matched a static element rather than the row's data).

Spot-check 20 records against their source URLs by hand before using a scraper's output for anything. Every run, not just the first — sites change and the failure is silent.

Rate limiting and politeness

Being aggressive gets you blocked and it also loads someone else's server at their cost.

  • 1 to 2 requests per second maximum to any single host, slower for small sites.
  • Honour robots.txt. It's a stated preference and ignoring it is evidence of intent if anything is ever disputed.
  • Set a real User-Agent identifying who you are with a contact URL. Anonymous scraping is what gets blocked.
  • Back off on 429 and 5xx. Exponential, and stop entirely on repeated 429s.
  • Cache aggressively. Never fetch the same URL twice in a run.
  • Run off-peak for the target's timezone.
while read -r url; do
  curl -s --max-time 20 \
    -A "AcmeResearchBot/1.0 (+https://acme.com/bot)" \
    "$url" > "cache/$(printf '%s' "$url" | md5sum | cut -c1-32).html"
  sleep 1
done < urls.txt

Anti-bot measures, and knowing when to stop

Sites protect themselves with rate limiting, fingerprinting, CAPTCHAs, JavaScript challenges and login walls.

The judgement call: rate limiting and simple blocks are signals to slow down. CAPTCHAs, login walls and active challenges are signals to stop. Circumventing an access control is a materially different act from reading a public page politely, and it's where both the legal exposure and the ethical line sit.

Never scrape anything behind a login you'd be violating terms to use. That includes using an account to extract data at volume from a platform whose terms prohibit it — the account gets terminated and, for some platforms, that's a business-critical loss.

The legal picture

Two separate questions, routinely conflated. Neither of these is legal advice, and anything at scale warrants a real review.

Terms of service. Automated access typically violates the terms of most large platforms. That's contractual, not criminal, and the practical consequence is account and IP termination. It's real exposure and it belongs to the client, not to the tool.

Data protection. Scraping public pages is not automatically lawful. A named person's work email is personal data under GDPR even when it's published. You need a lawful basis, a proportionate purpose, transparency, and you must honour objections. Scraping personal rather than business data raises the bar considerably. See outbound-compliance.

Practical position: prefer official APIs and licensed data where they exist, keep collection proportionate to a genuine B2B purpose, record the source of every record, honour opt-outs immediately, and be honest with the user about the exposure rather than either ignoring it or refusing the work.

Maintenance

Scrapers rot. Plan for it or the pipeline fails quietly.

  • Alert on volume anomalies. A run returning 3 records instead of 300 is a broken selector, not a shrinking market.
  • Alert on null rate. A field that goes from 5% null to 90% null means the site changed.
  • Version the schema so downstream consumers don't break.
  • Keep raw HTML for a while so a re-parse doesn't need a re-crawl.
  • Re-validate against source on a sample after every site redesign.

Silent failure is the real risk. A scraper returning wrong data is worse than one returning none, because the wrong data goes into emails.

Don't do these

  • Don't scrape behind a login you'd be violating terms to use.
  • Don't solve CAPTCHAs to get past access controls.
  • Don't hammer a host. 1 to 2 requests per second, and back off.
  • Don't store personal data you have no basis to process.
  • Don't skip source_url and extracted_at.
  • Don't force every field to be non-null.
  • Don't use scraped output without a 20-record manual check.
  • Don't build a fragile scraper for a one-off list. If it's needed once, research it once.

The alternative to building scrapers

For most lead work, building and maintaining scrapers is overhead that doesn't pay back. The site changes, the selector breaks, and the list was needed once.

ManyPI covers both ends of this. For one-off and recurring lead work, its agent researches the live web against a brief and returns structured leads with source_url on every record, so no scraper is written at all. For genuinely repeated extraction from a specific site, its scrapers are reusable and schema-validated, can be run from the dashboard, the API or on a schedule, and can be published as a typed REST endpoint at app.manypi.com/v1/e/{slug} and called like any other API. Over MCP:

claude mcp add --transport http manypi https://mcp.manypi.com/mcp -s user

The validation discipline above applies either way. Check twenty records against their sources before anything reaches an email.

Related skills

lead-sourcing, lead-enrichment, technographic-signals, google-maps-lead-scraping, ecommerce-store-prospecting, crm-data-hygiene, outbound-compliance

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.