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 20:48:05 +08:00
parent f09411489c
commit f2c3d789f1
4 changed files with 241 additions and 1 deletions

View File

@ -4,6 +4,10 @@ export const BROWSER_ALIASES_MAP = {
'Amazon Silk': 'amazon_silk',
'Android Browser': 'android',
Bada: 'bada',
Baidubot: 'baidubot',
BingAdsbot: 'bingads',
Bingbot: 'bingbot',
BingPreviewbot: 'bingpreview',
BlackBerry: 'blackberry',
Chrome: 'chrome',
Chromium: 'chromium',
@ -32,6 +36,8 @@ export const BROWSER_ALIASES_MAP = {
'Samsung Internet for Android': 'samsung_internet',
SeaMonkey: 'seamonkey',
Sleipnir: 'sleipnir',
'Sogou Browser': 'sogou',
'Sogou Mobile Browser': 'sogoum',
Swing: 'swing',
Tizen: 'tizen',
'UC Browser': 'uc',
@ -46,6 +52,10 @@ export const BROWSER_MAP = {
amazon_silk: 'Amazon Silk',
android: 'Android Browser',
bada: 'Bada',
baidubot: 'Baidubot',
bingads: 'BingAdsbot',
bingbot: 'Bingbot',
bingpreview: 'BingPreviewbot',
blackberry: 'BlackBerry',
chrome: 'Chrome',
chromium: 'Chromium',
@ -74,6 +84,8 @@ export const BROWSER_MAP = {
samsung_internet: 'Samsung Internet for Android',
seamonkey: 'SeaMonkey',
sleipnir: 'Sleipnir',
sogou: 'Sogou Browser',
sogoum: 'Sogou Mobile Browser',
swing: 'Swing',
tizen: 'Tizen',
uc: 'UC Browser',

View File

@ -35,7 +35,7 @@ const browsersList = [
const browser = {
name: 'Googlebot',
};
const version = Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
const version = Utils.getFirstMatch(/googlebot(?:-image|-news|-video)?\/(\d+(\.\d+))/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
if (version) {
browser.version = version;
@ -44,7 +44,42 @@ const browsersList = [
return browser;
},
},
/* Baidu Search Bot */
{
test: [/Baiduspider/i],
describe(ua) {
const browser = {
name: 'Baidubot',
};
const version = Utils.getFirstMatch(/baiduspider(?:-ads|-render|-video|-image|-news|-favo|-cpro)?\/(\d+(\.\d+))/i, ua);
if(version) {
browser.version = version;
}
return browser;
},
},
{
test: [/bingbot|bingpreview|adidxbot/i],
describe(ua) {
const hash = {
bingbot: 'Bingbot',
bingpreview: 'BingPreviewbot',
adidxbot: 'BingAdsbot'
};
const browser = {
name: hash[ua.match(/bingbot|bingpreview|adidxbot/i)[0].toLowerCase()],
};
const version = Utils.getFirstMatch(/(?:bingbot|adidxbot|bingpreview)\/(\d+(\.\d+)[a-zA-Z]?)/i, ua);
if(version) {
browser.version = version;
}
return browser;
},
},
/* Opera < 13.0 */
{
test: [/opera/i],
@ -108,6 +143,33 @@ const browsersList = [
return browser;
},
},
/* Sogou Browser */
{
test: [/MetaSr|SogouMobileBrowser/i],
describe(ua) {
const browser = {
name: (/SogouMobileBrowser/i).test(ua) ? 'Sogou Mobile Browser' : 'Sogou Browser',
};
const version = browser.name === 'Sogou Browser' ?
Utils.getFirstMatch(/Chrome[\s/](\d+)/i, ua) :
Utils.getFirstMatch(/SogouMobileBrowser[\s/](\d+(?:\.\d+)+)/i, ua);
const hash = {
'35': '5.1',
'38': '5.3',
'49': '6.3',
'58': '7.5',
'65': '8.6',
'72': '10.0',
'80': '11.0',
};
if(version) {
browser.version = hash[version] || version;
}
return browser;
},
},
{
test: [/MZBrowser/i],
describe(ua) {

View File

@ -18,6 +18,26 @@ export default [
},
},
{
test: [/baiduspider/i],
describe() {
return {
type: 'bot',
vendor: 'Baidu',
};
},
},
{
test: [/bingbot|adidxbot|bingpreview/i],
describe() {
return {
type: 'bot',
vendor: 'Bing',
};
},
},
/* Huawei */
{
test: [/huawei/i],

View File

@ -3054,3 +3054,149 @@
type: "mobile"
engine:
name: "Blink"
Sogou Browser:
-
ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0"
spec:
browser:
name: "Sogou Browser"
version: "7.5"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
-
ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36 SE 2.X MetaSr 1.0"
spec:
browser:
name: "Sogou Browser"
version: "11.0"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
-
ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0"
spec:
browser:
name: "Sogou Browser"
version: "10.0"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
-
ua: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3314.0 Safari/537.36 SE 2.X MetaSr 1.0"
spec:
browser:
name: "Sogou Browser"
version: "8.6"
os:
name: "Windows"
version: "NT 10.0"
versionName: "10"
platform:
type: "desktop"
engine:
name: "Blink"
Sogou Mobile Browser:
-
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SogouMobileBrowser/5.22.1"
spec:
browser:
name: "Sogou Mobile Browser"
version: "5.22.1"
os:
name: "iOS"
version: "12.4.8"
platform:
type: "mobile"
vendor: "Apple"
model: "iPhone"
engine:
name: "WebKit"
version: "605.1.15"
Baidubot:
-
ua: "Mozilla/5.0 (Linux;u;Android 4.2.2;zh-cn;) AppleWebKit/534.46 (KHTML,like Gecko) Version/5.1 Mobile Safari/10600.6.3 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"
spec:
browser:
name: "Baidubot"
version: "2.0"
os:
name: "Android"
version: "4.2.2"
versionName: "Jelly Bean"
platform:
type: "bot"
vendor: "Baidu"
engine:
name: "WebKit"
version: "534.46"
-
ua: "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"
spec:
browser:
name: "Baidubot"
version: "2.0"
os: {}
platform:
type: "bot"
vendor: "Baidu"
engine: {}
Bingbot:
-
ua: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
spec:
browser:
name: "Bingbot"
version: "2.0"
os: {}
platform:
type: "bot"
vendor: "Bing"
engine: {}
BingAdsbot:
-
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 (compatible; adidxbot/2.0; +http://www.bing.com/bingbot.htm)"
spec:
browser:
name: "BingAdsbot"
version: "2.0"
os:
name: "iOS"
version: "7.0"
platform:
type: "bot"
vendor: "Bing"
engine:
name: "WebKit"
version: "537.51.1"
BingPreviewbot:
-
ua: "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko BingPreview/1.0b"
spec:
browser:
name: "BingPreviewbot"
version: "1.0b"
os:
name: "Windows Phone"
version: "8.1"
platform:
type: "bot"
vendor: "Bing"
engine:
name: "Trident"
version: "7.0"