diff options
Diffstat (limited to 'castle-search/src/engines.ts')
| -rw-r--r-- | castle-search/src/engines.ts | 9 |
1 files changed, 6 insertions, 3 deletions
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=<opaque token>` (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\?)`, }, }; |
