2
0

Doc changes

This commit is contained in:
mileusna
2017-08-16 18:07:24 +02:00
parent e1aff7cb1e
commit 500b5d184d
2 changed files with 12 additions and 14 deletions
+6 -6
View File
@@ -4,7 +4,7 @@ Parse browser's and bot's user agents strings and determin user agent name, vers
## Status ## Status
Still need some work on detecting Andorid device name. Still need some work on detecting Andorid device names.
## Installation <a id="installation"></a> ## Installation <a id="installation"></a>
``` ```
@@ -17,10 +17,10 @@ go get github.com/mileusna/useragent
package main package main
import ( import (
"fmt" "fmt"
"strings" "strings"
"github.com/mileusna/useragent" "github.com/mileusna/useragent"
) )
func main() { func main() {
@@ -34,7 +34,7 @@ func main() {
"Mozilla/5.0 (Android 4.3; Mobile; rv:54.0) Gecko/54.0 Firefox/54.0", "Mozilla/5.0 (Android 4.3; Mobile; rv:54.0) Gecko/54.0 Firefox/54.0",
"Mozilla/5.0 (Linux; Android 4.3; GT-I9300 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36 OPR/42.9.2246.119956", "Mozilla/5.0 (Linux; Android 4.3; GT-I9300 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36 OPR/42.9.2246.119956",
"Opera/9.80 (Android; Opera Mini/28.0.2254/66.318; U; en) Presto/2.12.423 Version/12.16", "Opera/9.80 (Android; Opera Mini/28.0.2254/66.318; U; en) Presto/2.12.423 Version/12.16",
} }
for _, s := range userAgents { for _, s := range userAgents {
ua := ua.Parse(s) ua := ua.Parse(s)
@@ -67,7 +67,7 @@ func main() {
## Notice ## Notice
+ Opera and Opera Mini are two browsers, since they operate on very differenta way. + Opera and Opera Mini are two browsers, since they operate on very different way.
+ If Googlebot (or any other bot) is detected and it is using its mobile crawler, both `bot` and `mobile` flags will be set to `true`. + If Googlebot (or any other bot) is detected and it is using its mobile crawler, both `bot` and `mobile` flags will be set to `true`.
+6 -8
View File
@@ -13,14 +13,12 @@ type UserAgent struct {
OS string OS string
OSVersion string OSVersion string
Device string Device string
Mobile bool
Mobile bool Tablet bool
Tablet bool Desktop bool
Desktop bool Bot bool
Bot bool URL string
URL string String string
String string
} }
var ignore = map[string]struct{}{ var ignore = map[string]struct{}{