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

Merge pull request #278 from rcsandell/master

Added support for Googlebot recognition
This commit is contained in:
Denis Demchenko 2019-01-17 11:45:10 +02:00 committed by GitHub
commit dedbe9f199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 18 deletions

View File

@ -31,6 +31,23 @@ import {
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i; const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
const browsersList = [ 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 */ /* Opera < 13.0 */
{ {
test: [/opera/i], 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 */ /* Something else */
{ {
test: [/.*/i], test: [/.*/i],

View File

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

View File

@ -2232,8 +2232,37 @@
name: "Googlebot" name: "Googlebot"
version: "2.1" version: "2.1"
os: {} os: {}
platform: {} platform:
type: "bot"
vendor: "Google"
engine: {} 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: 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" 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"