blob: 7500e2d236d303d3f7ebd677d9fe0bf8e4aa8f28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/**
* Google wraps every outbound result in `https://www.google.com/goto?url=<opaque
* token>`. The token is a protobuf blob with no URL in it and the target appears
* nowhere in the page, so the only way to learn it is to follow the link.
*
* It is followed in Chrome, lazily, one link at a time, when the caller asks
* (see `resolveLink` in search.ts) — not here, and not for every result. A
* plain HTTP client gets Google's "Verifying your request" countdown after a
* handful of requests; the browser, with its own profile, gets the redirect.
*/
const GOTO = /^https?:\/\/(www\.)?google\.(?:com?\.)?[a-z]{2,3}\/goto\?url=[A-Za-z0-9_-]+$/;
/** Only these may be opened by castle_cdp_resolve — it is not a general navigator. */
export const isGoogleGoto = (url: string): boolean => GOTO.test(url);
|