惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threat Research - Cisco Blogs
Microsoft Security Blog
Microsoft Security Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
Recorded Future
Recorded Future
The Register - Security
The Register - Security
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
Webroot Blog
Webroot Blog
Help Net Security
Help Net Security
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
Attack and Defense Labs
Attack and Defense Labs
T
Tailwind CSS Blog
J
Java Code Geeks
C
CXSECURITY Database RSS Feed - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyberwarzone
Cyberwarzone
小众软件
小众软件
G
Google Developers Blog
SecWiki News
SecWiki News
V
V2EX
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
S
Security Affairs
AI
AI
S
Securelist
D
Docker
人人都是产品经理
人人都是产品经理
T
Troy Hunt's Blog
罗磊的独立博客
The Hacker News
The Hacker News
阮一峰的网络日志
阮一峰的网络日志
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
P
Proofpoint News Feed
Vercel News
Vercel News
Jina AI
Jina AI

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Web Scraping is a Contract
Gani Mendoza · 2026-06-02 · via DEV Community

Pithom Labs Scraper introduces a systematic approach to web scraping that treats data extraction as a binding contract rather than a fragile script. Traditional scrapers often fail silently by ingesting corrupted or empty data when website layouts inevitably change. To solve this, we present a specialized engine that utilizes human-guided discovery to establish a baseline of "truth" for a webpage's structure. This baseline, or GoldenSeal, allows the machine to perform runtime assertions and halt execution immediately if the site's data density or lineage shifts. By prioritizing loud failure and forensic evidence over quiet errors, the system ensures that automated pipelines never compromise data integrity. This methodology shifts the focus from evading bot detection to maintaining structural rigor in a constantly evolving digital environment.

Reprint from Medium

Let’s say the quiet part out loud: web scraping is usually held together with hope, CSS selectors, and a cron job that nobody on your engineering team wants to touch.

You build the parser. You map the fields. You run the script. You get a clean CSV or a pristine JSON array, and for a brief, shining moment, you feel invincible. You have conquered the unstructured internet.

And then, inevitably, the site changes.

It rarely breaks in a way that causes your script to crash and burn spectacularly. If it threw a loud, stack-tracing panic, you could fix it. Instead, a React component gets wrapped in three new div tags. A list hydrates half a second later than usual. A "Next" button moves into a different semantic container. A login session quietly expires in the background.

The data pipeline doesn’t explode. It does something infinitely worse: it keeps running. It keeps executing the same obsolete selectors against a mutated DOM. It happily writes empty strings or completely wrong text into your database. Downstream, your analytics dashboard or machine learning model is confidently eating nonsense, manufacturing false confidence at scale.

That is the part of scraping that we chronically understate. The hard problem isn’t figuring out how to extract data once. The hard problem is knowing when the web has shifted under your feet.

Most scraping tools respond to this reality with a brutal arms race. They throw more proxies, more remote headless browser farms, more fingerprint patches, and more opaque infrastructure at the problem, trying to convince the modern web that a faceless machine in a Virginia data center is actually a human being.

At Pithom Labs, we took a different route with our Go-based scraper engine. We stopped treating web scraping like a document parsing exercise, and started treating it like a typed contract with runtime assertions.

If the web is a moving target, your scraper shouldn’t pretend it’s static. It should fail loudly, produce evidence, and refuse to lie to you.


The Optimism of the Modern Scraper

Classic scrapers are optimistic little machines. They operate under a set of foundational assumptions that simply do not map to the reality of the modern internet.

They assume the page will load exactly the same way every time. They assume the selector that worked yesterday will work tomorrow. They assume that if the network request returns an HTTP 200 OK, the payload is probably meaningful.

But websites are not static documents anymore. They are moving, reactive, personalized, occasionally hostile application surfaces. They hydrate dynamically. They load content via asynchronous GraphQL calls. They lazy-load images. They A/B test their layouts. They change their entire markup structure because a frontend engineer decided to refactor a component library on a Tuesday afternoon.

When you point a traditional Python or Node.js script at this environment, you are essentially firing a blindfolded arrow and hoping the target hasn't moved. When the target does move, the script blindly extracts whatever happens to be occupying that coordinate space.

We realized that to fix this, we had to change the fundamental relationship between the scraper and the web page. We couldn't just build a better DOM parser; we had to build a system that understands what it's supposed to be looking at, and aggressively verifies that reality before it writes a single byte of data to disk.


The Baton Pass: Decoupling Discovery from Extraction

A lot of scraping products want to abstract the web away from you. They offer hosted dashboards, remote browser fleets, and managed extraction APIs. This can be useful, but it creates a massive trust problem. You have to hand over your credentials, try to replicate complex browser states on remote machines, debug someone else's infrastructure, and hope the target site doesn’t trigger a Cloudflare CAPTCHA that your headless script has no physical way of solving.

We designed the Pithom Labs Scraper around a radically different philosophy: The desktop is not a limitation. It is the point.

We built the architecture as a strict two-stage, decoupled system. We call the transition between these two stages the Baton Pass.

Stage 1: Human-Guided Discovery

In the first stage, you aren't writing code. You invoke scraper discover from your terminal, which launches a highly visible, headed instance of Google Chrome running directly on your machine.

Because it’s a real browser running locally, you can log in naturally. You can solve the CAPTCHA. You can click past the cookie consent banner. You establish the authorized session exactly as a human user would.

Once you are on the target page, our Omni-Agent Discovery overlay injects into the browser. You visually click the elements you want—titles, prices, detail links, pagination buttons.

Behind the scenes, the scraper isn't just recording dumb CSS paths. It is generating two critical artifacts:

  1. session.json: A durable record of your exact browser cookies, User-Agent, and authentication state.
  2. intent.json: A declarative recipe containing CSS/XPath selectors, semantic hints, structural hashes, and pagination logic.

Stage 2: Headless Extraction

Once you save the intent, the Baton Pass occurs. The human steps away, and the programmatic engine takes over.

You run scraper scrape, and the Go-based engine boots up in headless mode. It reads the session.json to perfectly spoof the authorized user state. It spins up a concurrent render pool using a stealth engine we call Ghost-Walker (which manages Chromedp under the hood to bypass headless detection and preserve JavaScript context).

This decoupling solves the hardest part of scraping—authentication and anti-bot mitigation—by letting a human handle the hard part once, and letting the machine handle the repetition.

But more importantly, the intent.json generated during Stage 1 isn't just a list of selectors. It is a binding contract.


Extraction as a Contract

In traditional software engineering, we use types, interfaces, and assertions to guarantee that our data is shaped correctly. If a function expects an integer and receives a string, it panics. It fails loudly.

Web scraping rarely has this luxury. Because the DOM is fundamentally untyped and fluid, scrapers have historically relied on "vibes-based" extraction. If .product-title > h2 exists, grab it. If it doesn't, write null and keep moving.

We wanted to bring systems-level rigor to DOM extraction. To do this, the intent.json acts as an executable agreement between the discovery phase and the runtime engine.

The GoldenSeal

When you finish Stage 1 discovery, the engine computes something we call the GoldenSeal.

The GoldenSeal is a structural fingerprint of the page at the exact moment you taught the scraper how to read it. It lives at the bottom of your intent.json and looks something like this:

"golden_seal": {
  "sealed_at": "2026-05-29T12:00:00Z",
  "row_count": 20,
  "structural_hash": "sha256:d8e3ab03bc",
  "field_population": {
    "title": 1.0,
    "detail_url": 1.0,
    "description": 1.0,
    "price": 0.95
  }
}

Enter fullscreen mode Exit fullscreen mode

This isn't just metadata. The GoldenSeal establishes the baseline reality of the website. It says: "When the human was looking at this page, there were exactly 20 items. The 'title' field was populated 100% of the time, and the 'price' field was populated 95% of the time."

During headless execution, the engine constantly measures the live DOM against this seal by enforcing Integrity Invariants.

The Density Invariant

The scraper expects each paginated list to maintain a consistent density. If the GoldenSeal expects 20 items per page, and the live execution suddenly extracts 0 items, or 3 items, the engine knows something is wrong.

Traditional scrapers would happily write those 3 items to a CSV and move on to the next page. Our engine trips the Density Invariant. It halts execution immediately, recognizing that either the page hasn't fully hydrated yet (Skeleton DOM), or the site layout has radically changed.

The Lineage Invariant

Even if the scraper finds the correct number of rows, the individual selectors might have drifted. The Lineage Invariant compares runtime field fill-rates against the GoldenSeal.

If the title field was populated 100% of the time during discovery, but during runtime it is only populating 10% of the time, the Lineage Invariant fails. The engine recognizes that it is experiencing Structural Drift. It refuses to continue writing empty columns.


Shift-Left QA: Validating Before We Commit

In a data pipeline, corrupted data is vastly more expensive to fix after it has been written to disk or ingested into a data warehouse. You want to catch the error as far upstream as possible.

To enforce the contract, the Pithom Labs Scraper implements a mechanism we call Shift-Left QA.

When the headless engine begins extracting data from the first page, it does not immediately stream those rows into your output CSV or JSON file. Instead, it buffers the first 5 rows in memory.

It runs these buffered rows through a gauntlet of semantic validations. It checks the Invariants. It verifies that required fields are present. If the site requires clicking into "Detail Pages" for deeper data, it ensures that the detail URLs aren't throwing 404s and that the deep extraction isn't returning blank text (enforcing the detail_skip_tolerance).

If the QA Buffer detects a critical failure—if all the fields are empty, or the data has fundamentally shifted—the run is aborted before a single byte of garbage data touches your output file.

Instead of writing bad data faster, the system stops, records the evidence, and generates a diagnostic bundle.


Failing Loudly: Evidence over Magic

The scariest scraper isn't the one that crashes. The scariest scraper is the one that fails quietly.

When the Pithom Labs Scraper breaks a contract and halts, it doesn't just log a generic error and die. It produces evidence.

It exits with strict, semantic CLI exit codes that programmatic supervisors (like cron jobs or CI/CD pipelines) can actually understand and route:

  • Exit Code 0: Success. The contract was upheld.
  • Exit Code 3: Structural Drift. The layout changed or the Density Invariant failed.
  • Exit Code 4: Integrity Failure. Data quality dropped below tolerance (e.g., detail pages are failing to load).
  • Exit Code 42: Auth Required. The site returned a 401/403 or redirected to a login screen. The session cookies are dead.

More importantly, upon a critical failure, the engine generates a timestamped diagnostics_YYYYMMDD_HHMMSS/ forensic bundle.

This bundle contains scrape_failure.jsonl (the exact structured events leading up to the crash) and, crucially, failure_snapshot.html—a complete, redacted snapshot of the DOM at the exact moment the scraper realized it was looking at an alien landscape.

You don't have to guess why the scraper failed. You don't have to write custom scripts to reproduce the error. You open the diagnostic snapshot, and you see exactly what the scraper saw: a Cloudflare challenge, a new A/B tested layout, or an expired login redirect.


Engineering for a Hostile Environment

Web scraping is, by definition, the act of writing highly coupled code against an unversioned API that you do not control, built by people who often actively do not want you to be there. It is a uniquely hostile engineering environment.

For too long, the industry's response to this hostility has been to build more complex abstractions—cloud bot farms, proxy rotators, and AI agents that promise to magically understand every DOM structure on the planet.

But magic is inherently un-debuggable. When an AI scraper hallucinates a CSS path, or a remote browser farm gets silently fingerprinted, you are left holding the bag.

We believe that reliable data extraction requires less magic and more engineering rigor.

By starting on the desktop, we inherit your natural trust and authorized access. By decoupling discovery from execution, we isolate the fragile parts of browser automation. And by treating the intent.json as a mathematically verifiable contract—enforced by Invariants and Shift-Left QA—we turn web scraping from a game of whack-a-mole into a predictable, observable system.

The web is going to keep changing. Your selectors are going to break. The goal isn't to build a scraper that never fails. The goal is to build a scraper that never lies.