From 74ff9fdcb8b49a021b63ac2e6b0191e29754d0f3 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 6 Nov 2026 03:17:13 +0000 Subject: castle-search: read Google results again by resolving its /goto links Google now wraps every result as google.com/goto?url=. The self-host filter discarded all of them, so every Google search failed with 'nothing could be parsed'. Accept /goto, resolve it node-side from the 302 Location, and when Google answers its 'Verifying your request' interstitial instead, keep the wrapped link and put the displayed breadcrumb in the snippet. --- castle-search/src/engines.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'castle-search/src/engines.ts') diff --git a/castle-search/src/engines.ts b/castle-search/src/engines.ts index ef8baef..76716c6 100644 --- a/castle-search/src/engines.ts +++ b/castle-search/src/engines.ts @@ -61,7 +61,7 @@ export type ExtractionConfig = { /** Items matching any of these are ads or non-web cards, and are skipped. */ exclude?: string[]; /** How outbound links are wrapped, if they are. */ - unwrap: "none" | "ddg" | "bing"; + unwrap: "none" | "ddg" | "bing" | "google"; /** Hosts belonging to the engine itself; links to them are not results. */ selfHostPattern: string; }; @@ -99,8 +99,11 @@ const GOOGLE: EngineDefinition = { extraction: { mode: "headings", roots: ["#rso", "#search"], - unwrap: "none", - selfHostPattern: String.raw`^https?://(www\.)?google\.[a-z.]+/`, + // Every result is `google.com/goto?url=` (since at least + // 2026-11-06). The page cannot unwrap it; search.ts resolves it afterwards. + // It must not count as Google's own link, hence the lookahead. + unwrap: "google", + selfHostPattern: String.raw`^https?://(www\.)?google\.[a-z.]+/(?!goto\?)`, }, }; -- cgit v1.2.3