saas: use android ua

This commit is contained in:
Yanlong Wang 2025-04-14 21:31:33 +08:00
parent fe26921648
commit 5ba93067d2
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37
2 changed files with 5 additions and 3 deletions

View File

@ -233,6 +233,7 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
livePages = new Set<Page>();
lastPageCratedAt: number = 0;
ua: string = '';
effectiveUA: string = '';
protected _REPORT_FUNCTION_NAME = 'bingo';
@ -299,7 +300,8 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
});
this.ua = await this.browser.userAgent();
this.logger.info(`Browser launched: ${this.browser.process()?.pid}, ${this.ua}`);
this.curlControl.impersonateChrome(this.ua.replace(/Headless/i, ''));
this.effectiveUA = this.ua.replace(/Headless/i, '').replace('Mozilla/5.0 (X11; Linux x86_64)', 'Mozilla/5.0 (Linux; Android 10; K)');
this.curlControl.impersonateChrome(this.effectiveUA);
await this.newPage('beware_deadlock').then((r) => this.__loadedPage.push(r));
@ -322,7 +324,7 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
}
const preparations = [];
preparations.push(page.setUserAgent(this.ua.replace(/Headless/i, '')));
preparations.push(page.setUserAgent(this.effectiveUA));
// preparations.push(page.setUserAgent(`Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)`));
// preparations.push(page.setUserAgent(`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`));
preparations.push(page.setBypassCSP(true));

@ -1 +1 @@
Subproject commit 6fac86977536a7b7440edba8d4cf2a1f0e769e8c
Subproject commit 165a1fe0cb12728f320c081226c28d7f7b53b0ed