From 561f0ee076c684a79fd5671af1bad0894f33e4de Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 6 Nov 2026 03:33:30 +0000 Subject: castle-search: resolve Google links lazily, in Chrome, not eagerly over plain HTTP The Node-side resolver sent one curl-like request per result with no cookies, JS or browser; Google answers that with its 'Verifying your request' countdown after a handful, and the testing itself triggered it. A click or direct navigation in Chrome redirects at once (measured). Search now leaves Google links wrapped and prints the breadcrumb Google shows for each. castle_cdp_resolve follows one wrapped link in a Chrome tab when the agent picks it, accepts only google.com/goto?url=, and reports the verification page instead of waiting it out. --- castle-search/src/errors.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'castle-search/src/errors.ts') diff --git a/castle-search/src/errors.ts b/castle-search/src/errors.ts index 2318b27..95fa7ef 100644 --- a/castle-search/src/errors.ts +++ b/castle-search/src/errors.ts @@ -81,3 +81,22 @@ export class SearchAbortedError extends Error { } export const messageOf = (e: unknown): string => (e instanceof Error ? e.message : String(e)); + +/** + * Google answered a `/goto` link with its "Verifying your request" page instead + * of redirecting. It is a bot check with a countdown; it is reported, never + * waited out or clicked through. + */ +export class GoogleVerificationError extends Error { + override readonly name = "GoogleVerificationError"; + readonly pageUrl: string; + constructor(pageUrl: string) { + super( + "Google showed its \"Verifying your request\" page instead of redirecting, so the real URL could not be " + + "read. This is a rate-based bot check: opening many links in a row triggers it, and it eases after a few " + + "minutes. Do not retry in a loop. Use the breadcrumb printed under the result to judge where it points, " + + "pick fewer links, or search again with another engine (duckduckgo, brave, bing), which return real URLs.", + ); + this.pageUrl = pageUrl; + } +} -- cgit v1.2.3