SPB Git forge

spb/websensor

Public
33commits 1branches 0releases
3.4 MBsize
maindefault branch
10 days agolast push
TypeScript 55.4% Python 43.2% SQL 1.2%
1.5 KB · 17 lines markdown
Rendered Raw Blame History
1# Connector: Generic HTTP (`http`)2**Purpose**: HTML pages (pricing, news lists, security bulletins, changelogs), JSON documents, plain text and3HEAD-only header monitoring. **Sensor types**: HTML, JSON, XML, HTTP_HEADERS, FILE.4**Retrieval**: conditional GET (ETag / If-Modified-Since), gzip/br, manual redirects (≤ 5, SSRF-checked per hop),512 MB limit, 25 s timeout, HTTP/2 with automatic HTTP/1.1 pin on NGHTTP2 stream errors, one browser-UA retry on6403 or TLS/connection resets, Scrapfly fallback if the source allows it.7**Normalization**: `canonicalizeHtml` (removes script/style/nav/footer/aside/cookie chrome, comments, tracking8params; scrubs clock times, "x minutes ago", hashes/UUIDs, tokens, visitor counters) → canonical text, headings,9links, structure counts, meta dates; JSON → sorted-key canonical form (`jsonPath`, `ignoreKeys` config).10Thin pages (< 40 chars, no headings: JS shells, interstitials) get extraction confidence 0.3 and never produce11events (flip protection).12**Config**: `keepChrome`, `jsonPath`, `ignoreKeys`, `accept`, `headers`, `method: HEAD`, `renderJs` (Scrapfly).13**Known quirks**: Akamai/Cloudflare bot management returns 403 or resets the connection for unknown UAs (handled14by the browser-UA retry, else Scrapfly). Client-rendered pages produce thin canonical text — prefer feeds/APIs.15**Tests**: `packages/core/src/core.test.ts` (canonicalization, diff, heuristics). **Verified**: 2026-09-08 on16~85 HTML/JSON sensors (Anthropic news/pricing, Stripe changelog, Apple system status, Wikipedia ITN…).17