Skip to content

Commit

Permalink
Bytespider fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mileusna committed Sep 13, 2024
1 parent 5cdf957 commit 8bf5b3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions ua.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,9 @@ func Parse(userAgent string) UserAgent {
}
ua.Bot = true

case tokens.existsAny("Bytespider", "Bytespider"):
if name := tokens.findBestMatch(false); name != "" {
ua.Name = name
ua.OS = ""
}
case tokens.exists("Bytespider"):
ua.Name = "Bytespider"
ua.Mobile = tokens.exists("Mobile Safari")
ua.Bot = true

case tokens.exists(Applebot):
Expand Down
2 changes: 1 addition & 1 deletion ua_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var testTable = [][]string{
{"GoogleProber", "GoogleProber", "", "bot", ""},
{"GoogleProducer; (+http://goo.gl/7y4SX)", "GoogleProducer", "", "bot", ""},
{"Mozilla/5.0 (compatible; Bytespider; [email protected]) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.0.0 Safari/537.36", "Bytespider", "", "bot", ""},
{"Mozilla/5.0 (Linux; Android 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; Bytespider; [email protected])", "Bytespider", "", "bot", ""},
{"Mozilla/5.0 (Linux; Android 5.0) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; Bytespider; [email protected])", "Bytespider", "", "bot", ua.Android},

// Google ads bots
{"Mozilla/5.0 (Linux; Android 4.0.0; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko; Mediapartners-Google) Chrome/104.0.0.0 Mobile Safari/537.36", ua.GoogleAdsBot, "", "bot", ua.Android},
Expand Down

0 comments on commit 8bf5b3a

Please sign in to comment.