nomagick commited on
Commit
5ba9306
·
unverified ·
1 Parent(s): fe26921

saas: use android ua

Browse files
src/services/serp/puppeteer.ts CHANGED
@@ -233,6 +233,7 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
233
  livePages = new Set<Page>();
234
  lastPageCratedAt: number = 0;
235
  ua: string = '';
 
236
 
237
  protected _REPORT_FUNCTION_NAME = 'bingo';
238
 
@@ -299,7 +300,8 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
299
  });
300
  this.ua = await this.browser.userAgent();
301
  this.logger.info(`Browser launched: ${this.browser.process()?.pid}, ${this.ua}`);
302
- this.curlControl.impersonateChrome(this.ua.replace(/Headless/i, ''));
 
303
 
304
  await this.newPage('beware_deadlock').then((r) => this.__loadedPage.push(r));
305
 
@@ -322,7 +324,7 @@ export class SERPSpecializedPuppeteerControl extends AsyncService {
322
  }
323
  const preparations = [];
324
 
325
- preparations.push(page.setUserAgent(this.ua.replace(/Headless/i, '')));
326
  // preparations.push(page.setUserAgent(`Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)`));
327
  // preparations.push(page.setUserAgent(`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`));
328
  preparations.push(page.setBypassCSP(true));
 
233
  livePages = new Set<Page>();
234
  lastPageCratedAt: number = 0;
235
  ua: string = '';
236
+ effectiveUA: string = '';
237
 
238
  protected _REPORT_FUNCTION_NAME = 'bingo';
239
 
 
300
  });
301
  this.ua = await this.browser.userAgent();
302
  this.logger.info(`Browser launched: ${this.browser.process()?.pid}, ${this.ua}`);
303
+ this.effectiveUA = this.ua.replace(/Headless/i, '').replace('Mozilla/5.0 (X11; Linux x86_64)', 'Mozilla/5.0 (Linux; Android 10; K)');
304
+ this.curlControl.impersonateChrome(this.effectiveUA);
305
 
306
  await this.newPage('beware_deadlock').then((r) => this.__loadedPage.push(r));
307
 
 
324
  }
325
  const preparations = [];
326
 
327
+ preparations.push(page.setUserAgent(this.effectiveUA));
328
  // preparations.push(page.setUserAgent(`Slackbot-LinkExpanding 1.0 (+https://api.slack.com/robots)`));
329
  // preparations.push(page.setUserAgent(`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.0; +https://openai.com/gptbot)`));
330
  preparations.push(page.setBypassCSP(true));
thinapps-shared CHANGED
@@ -1 +1 @@
1
- Subproject commit 6fac86977536a7b7440edba8d4cf2a1f0e769e8c
 
1
+ Subproject commit 165a1fe0cb12728f320c081226c28d7f7b53b0ed