diff --git a/bing-cli/.gitignore b/bing-cli/.gitignore new file mode 100644 index 0000000..789fcb5 --- /dev/null +++ b/bing-cli/.gitignore @@ -0,0 +1,15 @@ +# Build output +/bing-cli +*.exe +*.dll +*.so +*.dylib + +# Test binaries +*.test +*.out + +# Editors +.vscode/ +.idea/ +.DS_Store diff --git a/bing-cli/ARCHAEOLOGY.md b/bing-cli/ARCHAEOLOGY.md new file mode 100644 index 0000000..36be479 --- /dev/null +++ b/bing-cli/ARCHAEOLOGY.md @@ -0,0 +1,97 @@ +# Site Archaeology — Bing Search + +Findings from applying the archaeology protocol against Bing (English + Chinese UI) on 2026-07-15. Merged from bing-cli-acc and updated for v2. + +## Feature A: `search ` + +**URL:** `GET https://www.bing.com/search?q=&count=&offset=` + +- No auth required for basic search. +- Results are SSR'd in the DOM — no XHR needed for page one. +- Chinese market (`cc=cn&setlang=zh-Hans`) vs international (`cc=us&setlang=en`). +- `count` max is ~50 per page. `offset` enables pagination. + +### DOM Structure + +Each organic result lives in: + +```html +
  • + +

    Title text

    +
    https://example.com
    +

    Snippet text...

    +
  • +``` + +**Selectors:** + +| Field | Selector | Notes | +|---------|----------------|-------| +| title | `#b_results > li.b_algo h2 a` textContent | | +| url | `#b_results > li.b_algo .b_attribution cite` textContent | Display URL (domain only) | +| snippet | `#b_results > li.b_algo .b_caption p` textContent | May include breadcrumb prefix | +| source | same as `cite` | | +| bingHref| `h2 a` getAttribute("href") | Encrypted /ck/a redirect — resolved on Go side | + +### Extract Strategy + +Async IIFE with 8 s polling deadline (google-cli pattern): + +1. Check for consent interstitial (`location.host.startsWith('consent.')`). +2. Poll `#b_results > li.b_algo` every 500 ms until results appear. +3. Deduplicate by display URL (Set). +4. Clean snippet: `replace(/\s+/g, " ")`, strip trailing "Read more", slice to 300. + +### Gotchas + +- **Encrypted href**: The `

    ` `href` is a Bing redirect (`/ck/a?...&u=`). The CLI follows each redirect via HTTP GET and extracts the real URL from the response HTML body using a regex. +- **Inline `