Skip to content

Commit 4050a25

Browse files
committed
added missing parts
1 parent da61600 commit 4050a25

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

src/constants.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
// NOTE: this list must be up-to-date with browsers listed in
22
// test/acceptance/useragentstrings.yml
33
export const BROWSER_ALIASES_MAP = {
4+
AmazonBot: 'amazonbot',
45
'Amazon Silk': 'amazon_silk',
56
'Android Browser': 'android',
7+
BaiduSpider: 'baiduspider',
68
Bada: 'bada',
9+
BingCrawler: 'bingcrawler',
710
BlackBerry: 'blackberry',
811
Chrome: 'chrome',
912
Chromium: 'chromium',
13+
DuckDuckBot: 'duckduckbot',
1014
Electron: 'electron',
1115
Epiphany: 'epiphany',
1216
Firefox: 'firefox',
1317
Focus: 'focus',
1418
Generic: 'generic',
1519
'Google Search': 'google_search',
1620
Googlebot: 'googlebot',
21+
InternetArchiveCrawler: 'internetarchivecrawler',
1722
'Internet Explorer': 'ie',
1823
'K-Meleon': 'k_meleon',
24+
MetaWebCrawler: 'metawebcrawler',
1925
Maxthon: 'maxthon',
2026
'Microsoft Edge': 'edge',
2127
'MZ Browser': 'mz',
@@ -39,26 +45,35 @@ export const BROWSER_ALIASES_MAP = {
3945
Vivaldi: 'vivaldi',
4046
'WebOS Browser': 'webos',
4147
WeChat: 'wechat',
48+
YahooSlurp: 'yahooslurp',
4249
'Yandex Browser': 'yandex',
50+
YandexBot: 'yandexbot',
4351
Roku: 'roku',
52+
PingdomBot: 'pingdombot',
4453
};
4554

4655
export const BROWSER_MAP = {
56+
amazonbot: 'AmazonBot',
4757
amazon_silk: 'Amazon Silk',
4858
android: 'Android Browser',
59+
baiduspider: 'BaiduSpider',
4960
bada: 'Bada',
61+
bingcrawler: 'BingCrawler',
5062
blackberry: 'BlackBerry',
5163
chrome: 'Chrome',
5264
chromium: 'Chromium',
65+
duckduckbot: 'DuckDuckBot',
5366
electron: 'Electron',
5467
epiphany: 'Epiphany',
5568
firefox: 'Firefox',
5669
focus: 'Focus',
5770
generic: 'Generic',
5871
googlebot: 'Googlebot',
72+
internetarchivecrawler: 'InternetArchiveCrawler',
5973
google_search: 'Google Search',
6074
ie: 'Internet Explorer',
6175
k_meleon: 'K-Meleon',
76+
metawebcrawler: 'MetaWebCrawler',
6277
maxthon: 'Maxthon',
6378
edge: 'Microsoft Edge',
6479
mz: 'MZ Browser',
@@ -83,6 +98,9 @@ export const BROWSER_MAP = {
8398
webos: 'WebOS Browser',
8499
wechat: 'WeChat',
85100
yandex: 'Yandex Browser',
101+
yahooslurp: 'YahooSlurp',
102+
yandexbot: 'YandexBot',
103+
pingdombot: 'PingdomBot',
86104
};
87105

88106
export const PLATFORMS_MAP = {

src/parser-browsers.js

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,154 @@ const browsersList = [
4545
},
4646
},
4747

48+
/* AmazonBot */
49+
{
50+
test: [/amazonbot/i],
51+
describe(ua) {
52+
const browser = {
53+
name: 'AmazonBot',
54+
};
55+
const version = Utils.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
56+
57+
if (version) {
58+
browser.version = version;
59+
}
60+
61+
return browser;
62+
},
63+
},
64+
65+
/* BingCrawler */
66+
{
67+
test: [/bingbot/i],
68+
describe(ua) {
69+
const browser = {
70+
name: 'BingCrawler',
71+
};
72+
const version = Utils.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
73+
74+
if (version) {
75+
browser.version = version;
76+
}
77+
78+
return browser;
79+
},
80+
},
81+
82+
/* BaiduSpider */
83+
{
84+
test: [/baiduspider/i],
85+
describe(ua) {
86+
const browser = {
87+
name: 'BaiduSpider',
88+
};
89+
const version = Utils.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
90+
91+
if (version) {
92+
browser.version = version;
93+
}
94+
95+
return browser;
96+
},
97+
},
98+
99+
/* DuckDuckBot */
100+
{
101+
test: [/duckduckbot/i],
102+
describe(ua) {
103+
const browser = {
104+
name: 'DuckDuckBot',
105+
};
106+
const version = Utils.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
107+
108+
if (version) {
109+
browser.version = version;
110+
}
111+
112+
return browser;
113+
},
114+
},
115+
116+
/* InternetArchiveCrawler */
117+
{
118+
test: [/ia_archiver/i],
119+
describe(ua) {
120+
const browser = {
121+
name: 'InternetArchiveCrawler',
122+
};
123+
const version = Utils.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
124+
125+
if (version) {
126+
browser.version = version;
127+
}
128+
129+
return browser;
130+
},
131+
},
132+
133+
/* MetaWebCrawler */
134+
{
135+
test: [/facebookexternalhit/i, /facebookcatalog/i],
136+
describe(ua) {
137+
const browser = {
138+
name: 'MetaWebCrawler',
139+
};
140+
const version = Utils.getFirstMatch(/facebookexternalhit\/(\d+(\.\d+)+)/i, ua)
141+
|| Utils.getFirstMatch(/facebookcatalog\/(\d+(\.\d+)+)/i, ua)
142+
|| Utils.getFirstMatch(commonVersionIdentifier, ua);
143+
144+
if (version) {
145+
browser.version = version;
146+
}
147+
148+
return browser;
149+
},
150+
},
151+
152+
/* YahooSlurp */
153+
{
154+
test: [/yahoo!?[\s/]*slurp/i],
155+
describe() {
156+
return {
157+
name: 'YahooSlurp',
158+
};
159+
},
160+
},
161+
162+
/* YandexBot */
163+
{
164+
test: [/yandexbot/i, /yandexmobilebot/i],
165+
describe(ua) {
166+
const browser = {
167+
name: 'YandexBot',
168+
};
169+
const version = Utils.getFirstMatch(/yandex(?:bot|mobilebot)\/(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
170+
171+
if (version) {
172+
browser.version = version;
173+
}
174+
175+
return browser;
176+
},
177+
},
178+
179+
/* PingdomBot */
180+
{
181+
test: [/pingdom/i],
182+
describe(ua) {
183+
const browser = {
184+
name: 'PingdomBot',
185+
};
186+
const version = Utils.getFirstMatch(/version[_/](\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(/pingdom\.com_bot_.*?(\d+(\.\d+)+)/i, ua) || Utils.getFirstMatch(commonVersionIdentifier, ua);
187+
188+
if (version) {
189+
browser.version = version;
190+
}
191+
192+
return browser;
193+
},
194+
},
195+
48196
/* Opera < 13.0 */
49197
{
50198
test: [/opera/i],

0 commit comments

Comments
 (0)