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

Added support for Googlebot recognition

This commit is contained in:
Robert Sandell 2019-01-16 13:30:38 +02:00
parent 1085ae62ad
commit 1535c62b74
3 changed files with 58 additions and 18 deletions

View File

@ -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],
@ -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],

View File

@ -12,6 +12,17 @@ const TYPES_LABELS = {
*/
export default [
/* Googlebot */
{
test: [/googlebot/i],
describe() {
return {
type: 'bot',
vendor: 'Google',
};
},
},
/* Huawei */
{
test: [/huawei/i],

View File

@ -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"