Skip to content

Commit

Permalink
Merge 1535c62 into 1085ae6
Browse files Browse the repository at this point in the history
  • Loading branch information
rcsandell committed Jan 16, 2019
2 parents 1085ae6 + 1535c62 commit 157cf98
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 18 deletions.
34 changes: 17 additions & 17 deletions src/parser-browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ import {
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;

const browsersList = [
/* Googlebot */
{
test: [/googlebot/i],
describe(ua) {
const browser = {
name: 'Googlebot',
};
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);

if (version) {
browser.version = version;
}

return browser;
},
},

/* Opera < 13.0 */
{
test: [/opera/i],
Expand Down Expand Up @@ -555,23 +572,6 @@ const browsersList = [
},
},

/* Googlebot */
{
test: [/googlebot/i],
describe(ua) {
const browser = {
name: 'Googlebot',
};
const version = getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua) || getFirstMatch(commonVersionIdentifier, ua);

if (version) {
browser.version = version;
}

return browser;
},
},

/* Something else */
{
test: [/.*/i],
Expand Down
11 changes: 11 additions & 0 deletions src/parser-platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ const TYPES_LABELS = {
*/

export default [
/* Googlebot */
{
test: [/googlebot/i],
describe() {
return {
type: 'bot',
vendor: 'Google',
};
},
},

/* Huawei */
{
test: [/huawei/i],
Expand Down
31 changes: 30 additions & 1 deletion test/acceptance/useragentstrings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2232,8 +2232,37 @@
name: "Googlebot"
version: "2.1"
os: {}
platform: {}
platform:
type: "bot"
vendor: "Google"
engine: {}
-
ua: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
spec:
browser:
name: "Googlebot"
version: "2.1"
os:
name: "Android"
version: "6.0.1"
versionName: "Marshmallow"
platform:
type: "bot"
vendor: "Google"
engine:
name: "Blink"
-
ua: "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36"
spec:
browser:
name: "Googlebot"
version: "2.1"
os: {}
platform:
type: "bot"
vendor: "Google"
engine:
name: "Blink"
WeChat:
-
ua: "Mozilla/5.0 (iPad; U; CPU OS 9 like Mac OS X; en-us; iPad4,4) AppleWebKit/534.46 (KHTML, like Gecko) MicroMessenger/6.5.2.501 U3/1 Safari/7543.48.3"
Expand Down

0 comments on commit 157cf98

Please sign in to comment.