(url: string)
| 109 | |
| 110 | /** Unwrap DuckDuckGo's `//duckduckgo.com/l/?uddg=<encoded>` tracking redirect. */ |
| 111 | export function unwrapDdgRedirect(url: string): string { |
| 112 | const abs = url.startsWith('//') ? 'https:' + url : url; |
| 113 | try { |
| 114 | const u = new URL(abs); |
| 115 | if (u.hostname === 'duckduckgo.com' && u.pathname === '/l/') { |
| 116 | const real = u.searchParams.get('uddg'); |
| 117 | if (real) return decodeURIComponent(real); |
| 118 | } |
| 119 | } catch { /* fall through */ } |
| 120 | return abs; |
| 121 | } |
| 122 | |
| 123 | export function stripTags(html: string): string { |
| 124 | return html |
no test coverage detected