Skip to content

feat: adaptive (self-healing) selectors + logo, docs, bump to 1.5.1 - #126

Merged
vedaant00 merged 1 commit into
mainfrom
feat/adaptive-selectors
Aug 10, 2026
Merged

feat: adaptive (self-healing) selectors + logo, docs, bump to 1.5.1#126
vedaant00 merged 1 commit into
mainfrom
feat/adaptive-selectors

Conversation

@vedaant00

Copy link
Copy Markdown
Collaborator

Adaptive (self-healing) selectors

Selector.css gains auto_save=True (fingerprint the matched element) and adaptive=True (relocate it by similarity when the selector later returns nothing), so scrapers survive site redesigns instead of silently breaking.

Relocation improves on a naive similarity match on four fronts:

  • Weighted signals, not a flat average — a stable id/data-* hook far outweighs a sibling-tag list, so weak signals cannot dilute strong ones.
  • Anchor-relative fingerprints — records the nearest stable ancestor + depth, surviving absolute-path reshuffles.
  • Volatility-aware text — prices/dates/counts are down-weighted, so healing stays robust on the fields that change most.
  • Tag-pruning before scoring — scales to large pages.

Returns a confidence score + runner-up gap (SelectorList.adaptive_confidence); fingerprints persist in a JSON store namespaced by site. Entirely opt-in — without adaptive=True, a broken selector returns empty exactly as before.

Docs & polish

  • Logo header (public/logo.png) + new title.
  • Adaptive-selectors README section.
  • Tool/scraper tables replaced with prose + a live list command (OMDb key note kept).
  • Version bump to 1.5.1.

Tests

16 adaptive tests, including relocation across a full redesign and a comparison showing the weighted scorer beats a uniform average on a volatile-text decoy that fools the uniform one. Full suite: 472 passed. ruff check + ruff format clean.

Adaptive selectors on Selector.css: auto_save=True fingerprints the
matched element, adaptive=True relocates it by similarity when the
selector later returns nothing, so scrapers survive site redesigns.

Relocation improves on a naive similarity match on four fronts: weighted
signals (a stable id/data-* hook outweighs weak ones instead of a flat
average), anchor-relative fingerprints (nearest stable ancestor + depth,
surviving path reshuffles), volatility-aware text (prices/dates/counts
down-weighted), and tag-pruning before scoring. Returns a confidence +
runner-up gap; fingerprints persist in a JSON store namespaced by site.
16 adaptive tests incl. relocation across a full redesign and a
comparison showing the weighted scorer beats a uniform average.

Docs: add the logo header, an adaptive-selectors section, a new title,
and replace the tool/scraper tables with prose + a list command (the
OMDb key note stays). Bump to 1.5.1.
@vedaant00
vedaant00 merged commit 82e4275 into main Aug 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant