diff options
Diffstat (limited to 'castle-search/src/format.ts')
| -rw-r--r-- | castle-search/src/format.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/castle-search/src/format.ts b/castle-search/src/format.ts index aef6c3b..9c7c3cc 100644 --- a/castle-search/src/format.ts +++ b/castle-search/src/format.ts @@ -8,6 +8,7 @@ */ import type { SearchResult } from "./extract.ts"; +import { isGoogleGoto } from "./google-links.ts"; export type FormatInput = { query: string; @@ -36,6 +37,13 @@ export const formatResults = (input: FormatInput): string => { input.results.forEach((result, index) => { lines.push(`${index + 1}. ${result.title}`); lines.push(` ${result.url}`); + // Google wraps every link and only reveals the target when followed. Say so + // here, next to the link, with what Google displays for it — that is often + // enough to decide without resolving anything. + if (isGoogleGoto(result.url)) { + const shown = result.display ? ` Google shows it as: ${result.display}.` : ""; + lines.push(` [Google-wrapped link, real URL not yet known.${shown} Pass it to castle_cdp_resolve if you need to open it.]`); + } if (result.snippet) lines.push(` ${result.snippet}`); lines.push(""); }); |
