1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Support Sogou Browser and Some Search Bots

This commit is contained in:
Cattttttttt 2021-01-21 21:03:00 +08:00
parent f2c3d789f1
commit 107c9c7411
2 changed files with 16 additions and 16 deletions

View File

@ -53,7 +53,7 @@ const browsersList = [
}; };
const version = Utils.getFirstMatch(/baiduspider(?:-ads|-render|-video|-image|-news|-favo|-cpro)?\/(\d+(\.\d+))/i, ua); const version = Utils.getFirstMatch(/baiduspider(?:-ads|-render|-video|-image|-news|-favo|-cpro)?\/(\d+(\.\d+))/i, ua);
if(version) { if (version) {
browser.version = version; browser.version = version;
} }
@ -66,14 +66,14 @@ const browsersList = [
const hash = { const hash = {
bingbot: 'Bingbot', bingbot: 'Bingbot',
bingpreview: 'BingPreviewbot', bingpreview: 'BingPreviewbot',
adidxbot: 'BingAdsbot' adidxbot: 'BingAdsbot',
}; };
const browser = { const browser = {
name: hash[ua.match(/bingbot|bingpreview|adidxbot/i)[0].toLowerCase()], name: hash[ua.match(/bingbot|bingpreview|adidxbot/i)[0].toLowerCase()],
}; };
const version = Utils.getFirstMatch(/(?:bingbot|adidxbot|bingpreview)\/(\d+(\.\d+)[a-zA-Z]?)/i, ua); const version = Utils.getFirstMatch(/(?:bingbot|adidxbot|bingpreview)\/(\d+(\.\d+)[a-zA-Z]?)/i, ua);
if(version) { if (version) {
browser.version = version; browser.version = version;
} }
@ -150,21 +150,21 @@ const browsersList = [
const browser = { const browser = {
name: (/SogouMobileBrowser/i).test(ua) ? 'Sogou Mobile Browser' : 'Sogou Browser', name: (/SogouMobileBrowser/i).test(ua) ? 'Sogou Mobile Browser' : 'Sogou Browser',
}; };
const version = browser.name === 'Sogou Browser' ? const version = browser.name === 'Sogou Browser'
Utils.getFirstMatch(/Chrome[\s/](\d+)/i, ua) : ? Utils.getFirstMatch(/Chrome[\s/](\d+)/i, ua)
Utils.getFirstMatch(/SogouMobileBrowser[\s/](\d+(?:\.\d+)+)/i, ua); : Utils.getFirstMatch(/SogouMobileBrowser[\s/](\d+(?:\.\d+)+)/i, ua);
const hash = { const hash = {
'35': '5.1', 35: '5.1',
'38': '5.3', 38: '5.3',
'49': '6.3', 49: '6.3',
'58': '7.5', 58: '7.5',
'65': '8.6', 65: '8.6',
'72': '10.0', 72: '10.0',
'80': '11.0', 80: '11.0',
}; };
if(version) { if (version) {
browser.version = hash[version] || version; browser.version = hash[version] || (browser.name !== 'Sogou Browser' && version);
} }
return browser; return browser;

View File

@ -23,7 +23,7 @@ export default [
describe() { describe() {
return { return {
type: 'bot', type: 'bot',
vendor: 'Baidu', vendor: 'Baidu',
}; };
}, },
}, },