v3.6.7: unwrap Bing ck/a and Google url= link wrappers before the own-domain filter, so native web_search returns organic sources
This commit is contained in:
@@ -1379,7 +1379,11 @@ const SEARCH_EXTRACT = `(() => {
|
||||
const link = node.matches('a') ? node : node.closest('a');
|
||||
if (!link) continue;
|
||||
let url = link.href;
|
||||
if (/^\\/(url|link)\\?/.test(url)) { const m = url.match(/[?&](?:url|q)=([^&]+)/); if (m) { try { url = decodeURIComponent(m[1]); } catch {} } }
|
||||
// Engines wrap organic URLs: Google /url?url=..., Bing /ck/a?u=a1<base64>.
|
||||
// Unwrap first — then apply the own-domain filter, or the wrappers eat
|
||||
// every real result.
|
||||
{ const m = url.match(/[?&]u=([^&]+)/); if (m) { let v = m[1]; if (v.startsWith('a1')) v = v.slice(2); try { const d = atob(v.replace(/-/g, '+').replace(/_/g, '/')); if (/^https?:/i.test(d)) url = d; } catch {} } }
|
||||
{ const m = url.match(/[?&](?:url|q)=([^&]+)/); if (m) { try { const d = decodeURIComponent(m[1]); if (/^https?:/i.test(d)) url = d; } catch {} } }
|
||||
if (!/^https?:/i.test(url) || seen.has(url) || selfUrl(url)) continue;
|
||||
const title = clean(link.innerText);
|
||||
if (!title || title.length < 4) continue;
|
||||
|
||||
Reference in New Issue
Block a user