update UA for haaretz, themarker (#1249)

This commit is contained in:
InterAl 2022-12-24 08:36:36 +02:00 committed by GitHub
parent 66e3afed16
commit d7a511000b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,7 +182,9 @@ const useGoogleBotSites = [
];
// Override User-Agent with Bingbot
const useBingBot = [
const useBingBot = [];
const useGoogleAdsBotMobile = [
'haaretz.co.il',
'haaretz.com',
'themarker.com'
@ -257,6 +259,7 @@ const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.go
const userAgentMobile = 'Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)';
const userAgentDesktopBingBot = 'Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)';
const userAgentMobileBingBot = 'Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)';
const userAgentGoogleAdsBotMobile = 'Mozilla/5.0 (Linux; Android 5.0; SM-G920A) AppleWebKit (KHTML, like Gecko) Chrome Mobile Safari (compatible; AdsBot-Google-Mobile; +http://www.google.com/mobile/adsbot.html)';
let enabledSites = [];
@ -445,6 +448,15 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
});
}
// override User-Agent to use Google AdsBot Mobile Web
if (matchUrlDomain(useGoogleAdsBotMobile, details.url)) {
requestHeaders.push({
name: 'User-Agent',
value: userAgentGoogleAdsBotMobile
});
}
// remove cookies before page load
const enabledCookies = allowCookies.some(function (site) {
return matchUrlDomain(site, details.url);