v3.6.8: search extraction polls in-page until organics hydrate (engines serve a redirect shell first on datacenter exits), bing default engine - native web_search returns sources
This commit is contained in:
@@ -1367,7 +1367,8 @@ const FETCH_EXTRACT = `(async () => {
|
|||||||
return { url: location.href, status, text: document.body ? document.body.innerText : '' };
|
return { url: location.href, status, text: document.body ? document.body.innerText : '' };
|
||||||
})()`;
|
})()`;
|
||||||
|
|
||||||
const SEARCH_EXTRACT = `(() => {
|
const SEARCH_EXTRACT = `(async () => {
|
||||||
|
const parse = () => {
|
||||||
const clean = (s) => String(s || '').replace(/\\s+/g, ' ').trim();
|
const clean = (s) => String(s || '').replace(/\\s+/g, ' ').trim();
|
||||||
const out = []; const seen = new Set();
|
const out = []; const seen = new Set();
|
||||||
const selfUrl = (u) => /^https?:\\/\\/(?:www\\.)?(?:bing|google|duckduckgo)\\./i.test(u);
|
const selfUrl = (u) => /^https?:\\/\\/(?:www\\.)?(?:bing|google|duckduckgo)\\./i.test(u);
|
||||||
@@ -1394,6 +1395,15 @@ const SEARCH_EXTRACT = `(() => {
|
|||||||
out.push({ url, title: title.slice(0, 200), ...(snippet ? { snippet: snippet.slice(0, 400) } : {}) });
|
out.push({ url, title: title.slice(0, 200), ...(snippet ? { snippet: snippet.slice(0, 400) } : {}) });
|
||||||
}
|
}
|
||||||
return { sources: out, page: { url: location.href, title: clean(document.title) } };
|
return { sources: out, page: { url: location.href, title: clean(document.title) } };
|
||||||
|
};
|
||||||
|
// Engines serving datacenter exits hand back a redirect shell first
|
||||||
|
// (Bing: &rdr=1&rdrig=…) and hydrate organics after readyState — poll
|
||||||
|
// in-page until real results exist (max ~6s) instead of parsing the shell.
|
||||||
|
for (let i = 0; i < 12; i++) {
|
||||||
|
const r = parse();
|
||||||
|
if (r.sources.length || i >= 11) return r;
|
||||||
|
await new Promise((res) => setTimeout(res, 500));
|
||||||
|
}
|
||||||
})()`;
|
})()`;
|
||||||
|
|
||||||
const edgeFetchProvider = {
|
const edgeFetchProvider = {
|
||||||
@@ -1415,7 +1425,7 @@ const edgeSearchProvider = {
|
|||||||
async search(request, signal) {
|
async search(request, signal) {
|
||||||
const n = Math.min(Math.max(request.maxResults ?? 10, 1), 20);
|
const n = Math.min(Math.max(request.maxResults ?? 10, 1), 20);
|
||||||
const q = encodeURIComponent(request.query);
|
const q = encodeURIComponent(request.query);
|
||||||
const engine = cfgVal('searchEngine', 'google') === 'bing' ? 'bing' : 'google';
|
const engine = cfgVal('searchEngine', 'bing') === 'google' ? 'google' : 'bing';
|
||||||
const build = (e) => e === 'bing'
|
const build = (e) => e === 'bing'
|
||||||
? `https://www.bing.com/search?q=${q}&count=${Math.min(n * 2, 30)}`
|
? `https://www.bing.com/search?q=${q}&count=${Math.min(n * 2, 30)}`
|
||||||
: `https://www.google.com/search?q=${q}&num=${Math.min(n * 2, 20)}`;
|
: `https://www.google.com/search?q=${q}&num=${Math.min(n * 2, 20)}`;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@local/edge-kit-easy",
|
"name": "@local/edge-kit-easy",
|
||||||
"version": "3.6.7",
|
"version": "3.6.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Edge Kit Browser — human-style browsing for agents in Edge, Chrome, or Firefox: see, click, type, video understanding, gameplay; live-attach-first over CDP/BiDi with a native settings page and the native web seam",
|
"description": "Edge Kit Browser — human-style browsing for agents in Edge, Chrome, or Firefox: see, click, type, video understanding, gameplay; live-attach-first over CDP/BiDi with a native settings page and the native web seam",
|
||||||
|
|||||||
Reference in New Issue
Block a user