Skip to content

Commit

Permalink
fix(lookup): remove mobile versions of user agent
Browse files Browse the repository at this point in the history
Removing mobile versions of user agents should help
us with false positives, as the mobile version may give
different selectors which we cannot parse correctly.
  • Loading branch information
jef committed Dec 17, 2020
1 parent 7425e64 commit 96ae818
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,19 @@ export async function getRandomUserAgent(): Promise<string> {
];
}

const userAgent =
return (
getRandom((ua) => {
return ua.browserName === 'Chrome' && ua.browserVersion > '20';
}) ?? config.browser.userAgent;

logger.debug('user agent', userAgent);

return userAgent;
if (
ua.browserName === 'Chrome' &&
ua.browserVersion > '40' &&
ua.osName !== 'Android' &&
ua.osName !== 'iOS'
) {
logger.debug('user agent', ua);
return true;
}

return false;
}) ?? config.browser.userAgent
);
}

0 comments on commit 96ae818

Please sign in to comment.