Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Detect updated UA for Googlebot #41

Merged
merged 4 commits into from
Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion all_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ var uastrings = []struct {
expected: "Mozilla:5.0 Browser:Googlebot-2.1 Bot:true Mobile:false",
},
{
title: "GoogleBotSmartphone",
title: "GoogleBotSmartphone (iPhone)",
ua: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
expected: "Mozilla:5.0 Browser:Googlebot-2.1 Bot:true Mobile:true",
},
{
title: "GoogleBotSmartphone (Android)",
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)",
expected: "Mozilla:5.0 Browser:Googlebot-2.1 Bot:true Mobile:true",
},
{
title: "BingBot",
ua: "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",
Expand Down
2 changes: 2 additions & 0 deletions operating_systems.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func webkit(p *UserAgent, comment []string) {
}
if len(comment) > 3 {
p.localization = comment[3]
} else if len(comment) == 3 {
_ = p.googleBot()
}
} else if len(comment) > 0 {
if len(comment) > 3 {
Expand Down