/** * JavaScript extractors + URL classifiers for visit_page / google_search. * * Each extractor is a self-contained JS string (run via CDP * `Runtime.evaluate` in the page's main execution context). They're kept as * strings — not real TypeScript — because they execute in the browser, not * Node, and can't be type-checked or linted here. The tests in * `tests/unit/extractors-parse.test.ts` validate they at least parse as valid * JavaScript via `new Function()`. * * Split from `chrome.ts` so the CDP plumbing (which changes rarely) is * isolated from the site-specific extractors (which change whenever a site * redesigns its DOM). This module has zero dependency on the CDP layer — * it's pure data + pure functions. */ import { readFileSync } from "node:fs"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; // ── Google consent + search ─────────────────────────────────────────────── // Backtick constant for building JS strings that contain backticks const BT = "`"; // NOTE: deliberately does NOT match tags. Clicking an anchor navigates // away from the target page. Cookie-consent "accept" buttons are always //