Skip to content
ankitzmPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🕸️ Spinneret

Scrapers that repair their own webs. A self-healing data pipeline that runs in CI, tells a broken scraper apart from a changed world, heals the first, and never ships silent garbage.

Built for the Into the Scrape-Verse hackathon (WeMakeDevs × Bright Data) on Bright Data Scraper Studio.

A spider repairs its web every day. Your scrapers should too.


The problem

You build a scraper. It works. Next week the site ships a redesign and your selectors point at nothing — the scraper returns empty or garbage, silently, and whatever it feeds (an app, a RAG index, an AI agent) is now confidently wrong.

Two failures look identical from outside:

What happened Right response
Scraper broke site restructured, selectors dead heal the scraper
World changed price dropped, item sold out nothing — that's real data

Heal blindly and you "fix" real price changes into oblivion. Spinneret classifies the two and only heals real breakage.

How it works

GitHub Actions (cron every 6h + manual dispatch)
  └─ node pipeline/run.mjs
       ├─ scrape each source via `bdata scraper run`  (Bright Data Scraper Studio)
       ├─ classify against golden rows ── OK / BROKEN / CHANGED
       │     BROKEN  → `bdata scraper heal` → re-validate → commit healed scraper
       │     CHANGED → record the delta as a signal (don't heal)
       │     OK      → refresh golden
       └─ write data/*.json → commit → Vercel redeploys the dashboard

Git is the datastore. No server, no DB — the pipeline commits JSON, the dashboard (Next.js on Vercel) reads it. A broken scraper's rows never reach data/latest/, so bad rows shipped = 0 by construction.

The classifier (the core)

pipeline/classify.mjs is a pure function, covered by classify.test.mjs:

  • zero rows, or any required field empty → BROKEN (structural failure → heal)
  • all fields present but values differ from golden → CHANGED (real-world delta → signal)
  • matches golden → OK

Golden rows refresh on OK/CHANGED, never on BROKEN — so a genuine price change is recorded once, not re-flagged forever.

Scraper Studio integration

Each source is a custom Scraper Studio Collector (see pipeline/sources.json), built with:

bdata scraper create <url> "Extract name, price, description, image_url, rating from this product page."

The pipeline drives them through the same CLI the workflow uses — bdata scraper run (batch), bdata scraper heal (self-repair), bdata scraper approve. Collector IDs are the proof; they're shown on each source's detail page and triggered as production endpoints.

Targets are deliberately long-tail (a self-hosted demo store + Keychron product pages) — sites not in Bright Data's 800+ prebuilt library, per the hackathon guidance.

Run it

npm install
npm test                 # classifier tests (no network)
npm run dev              # dashboard at localhost:3000 (uses fixture data)

# real pipeline (needs bdata CLI logged in + collector IDs in sources.json):
bdata login --device
npm run pipeline         # scrape → classify → heal → write data/

The demo store lives in store/ — node store/build.mjs a builds the clean site, node store/build.mjs b builds the "redesigned" variant that breaks every selector (the breakage the heal loop recovers from).

CI

.github/workflows/spinneret.yml runs the fleet on a cron, heals on breakage, and commits results. Set repo secret BRIGHTDATA_API_KEY. The wall of green checks is the reliability proof; a red check is a caught break waiting for its heal.

Deploy

  • Dashboard → Vercel (Next.js). Set NEXT_PUBLIC_REPO_URL to the repo for the "Pipeline →" link.
  • Demo store → separate Vercel project, Root Directory = store/. It serves the prebuilt store/public/ (no build step). To break/restore it for the demo: npm run store:break / npm run store:fix, then commit + push — Vercel redeploys the static files.

AI disclosure

Built with AI coding assistance (Claude). The Scraper Studio collectors are generated by Bright Data's AI Flow from natural-language prompts (that's the product). All pipeline logic, the classifier, and the UI were written and reviewed by the author; the break-vs-change classification and the CI heal loop are the original contribution.

License

MIT

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages