Files
openserp/ecosia/selectors.go
Rustem Kamalov 9cc69da758 feat(cli): clean search, add extract/format flags; harden engines & proxy rotation; fix bugs; update docs
- Add structured `search [engine] [query]` CLI: --limit/--lang/--region/--site/--file, --format (json|text|markdown|ndjson), --extract N, --search-timeout; Envelope and route logs to stderr with a --quiet default (fixes stdout pollution)
- Unify engines behind a single engineSpec registry (CLI + serve share it)
- Unify the extract knob to bool-or-int `extract=N` (drop extract_top); CLI and HTTP share core batch extraction, raw/rendered fetch, and clamp helpers
- Engines: Ecosia CF captcha detection (raw + browser), Yandex progressive-result wait, Google PAA poll + Has() existence probes, Bing title/desc attribute fallbacks
- Proxy: rotate challenged proxies out of the tag pool for one retry (X-Proxy-Attempts); browser health-ping skip window; opt-in WaitStable
2026-06-16 03:51:37 +03:00

32 lines
1.1 KiB
Go

package ecosia
// Selectors is the single source of truth for Ecosia SERP CSS selectors.
var Selectors = struct {
Captcha string
Mainline string
Result string
Ad string
ResultLink string
Title string
Desc string
ImageResult string
ImageLink string
ImageSource string
ImageDims string
}{
// Captcha matches Ecosia's Cloudflare Turnstile interstitial. The hidden
// cf-turnstile-response input is present on every challenge page and never
// on a real SERP, so it's a precise marker for the raw (browserless) path.
Captcha: "input[name='cf-turnstile-response']",
Mainline: "[data-test-id='mainline']",
Result: "[data-test-id='mainline-result-web']",
Ad: "[data-test-id='mainline-result-ad']",
ResultLink: "[data-test-id='result-link']",
Title: "[data-test-id='result-title']",
Desc: "[data-test-id='result-description']",
ImageResult: "[data-test-id='images-result']",
ImageLink: "[data-test-id='image-result-link']",
ImageSource: "[data-test-id='image-result-source']",
ImageDims: "[data-test-id='image-result-dimensions']",
}