mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 19:59:10 +08:00
fix
This commit is contained in:
parent
bf84c993e2
commit
6c0aff4cc9
@ -193,6 +193,9 @@ export class GoogleSERP extends AsyncService {
|
|||||||
this.nativeIPBlocked();
|
this.nativeIPBlocked();
|
||||||
}
|
}
|
||||||
this.contextPool.destroy(ctx);
|
this.contextPool.destroy(ctx);
|
||||||
|
throw new ServiceBadAttemptError({
|
||||||
|
message: 'Google returned an error page. This may happen due to various reasons, including rate limiting or other issues.',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts && sideLoaded.sideLoadOpts) {
|
if (opts && sideLoaded.sideLoadOpts) {
|
||||||
@ -217,6 +220,9 @@ export class GoogleSERP extends AsyncService {
|
|||||||
const jsdom = this.jsDomControl.linkedom.parseHTML(html, { location: { href: origHref } });
|
const jsdom = this.jsDomControl.linkedom.parseHTML(html, { location: { href: origHref } });
|
||||||
try {
|
try {
|
||||||
const r = runGetWebSearchResultsScript(createContext(jsdom));
|
const r = runGetWebSearchResultsScript(createContext(jsdom));
|
||||||
|
if (!Array.isArray(r)) {
|
||||||
|
throw new Error('Failed to parse response as SERP results');
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user