Skip to content

fix: restore Bing, IQDB, E-Hentai and Google Lens; add AI overviews - #395

Open
Peloxerat wants to merge 12 commits into
kitUIN:mainfrom
Peloxerat:fix/engines
Open

Peloxerat wants to merge 12 commits into
kitUIN:mainfrom
Peloxerat:fix/engines

Conversation

@Peloxerat

@Peloxerat Peloxerat commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Restores broken engines, surfaces clearer errors, and adds AI overviews for Bing and Google Lens.

Closes #343

Fixes

  • network: drop Content-Type when a redirect turns POST into GET. httpx2 keeps the multipart header on the bodiless GET, and E-Hentai's Cloudflare rules reject it with 403.
  • bing: Bing redirects image searches to a regular results page with a visual search flyout. The signature key and offset are now read from that page (SignatureUtils.init(...), they change per page), insights are queried by BCID for both URL and file searches, and cookies are kept between requests. Like Copyseeker, Bing needs a shared client, so the test and the sync demo now use Network.
  • google-lens: with signed-in cookies uploadbyurl redirects to the sign-in page; URL searches now fall back to downloading the image and uploading it as a file.
  • iqdb: under high load IQDB queues the query and may answer "Can't read query result! Please try again". Such queries are retried (retries, retry_delay), and an error page now raises ParsingError instead of IndexError.
  • ehentai: file searches sent within ~5 seconds of the previous one are rejected; they are retried (retries, retry_delay) and raise ParsingError if still rejected.
  • copyseeker: when no discovery ID is returned, raise ParsingError instead of building an empty response that fails with KeyError: 'id' (Copyseeker engine broken: site now gates search behind account authentication (all hardcoded action tokens stale) #393).

Features

  • ParsingError on Cloudflare challenge pages for Ascii2D and TinEye, instead of empty results or JSONDecodeError.
  • bing: BingResponse.ai_overview with the AI-generated description and cited sources (already present in the insights response).
  • google-lens: GoogleLens(ai_overview=True) loads the "AI overview" shown with Lens results and exposes GoogleLensResponse.ai_overview (text and sources). Off by default since it costs an extra request.
  • yandex: Yandex(ai_overview=True) loads the Yandex Neuro answer for the image (optionally for a question q) and exposes YandexResponse.ai_overview (text and sources). Off by default; Yandex limits it to about 100 requests per hour.

Docs

  • README (and translations): notes column with what each engine requires.
  • Google Lens cookies: results require cookies of a signed-in account. Export them from a session no browser keeps using (e.g. an incognito window closed without signing out), otherwise the browser rotates them and they stop working. To keep the session alive, periodically POST https://accounts.google.com/RotateCookies and save the returned cookies.

Testing

Live run (pytest --disable-vcr) with a SauceNAO key and Google cookies: 21 passed, 2 failed, 4 skipped.

  • Failed: TinEye, blocked by a Cloudflare challenge from the test IP (now reported as ParsingError).
  • Skipped: Ascii2D (no base_url configured) and the deprecated Google engine.

Results of Bing, Google Lens, E-Hentai, SauceNAO and IQDB were also checked against the query images.

Keep httpx2 from sending a bodiless GET with a multipart content type
after a redirect, which E-Hentai rejects with 403.
Read the signature key from the search page, query insights by BCID for
both URL and file searches, and keep cookies between requests.
Load the streamed AI overview referenced by the results page when
`ai_overview` is enabled, and parse its text and cited sources.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Bing module requires a fix

1 participant