代码拉取完成,页面将自动刷新
This library is Gets the "OSName" or "BrowserName" for USER_AGENT
$ set GO111MODULE=on
$ set GOPROXY=https://goproxy.io,direct
### The Golang 1.13+ can be executed directly
$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.io,direct
$ export GO111MODULE=on
$ export GOPROXY=https://goproxy.io,direct
### or
$ echo "export GO111MODULE=on" >> ~/.profile
$ echo "export GOPROXY=https://goproxy.cn,direct" >> ~/.profile
$ source ~/.profile
$ go get -u github.com/wenlng/go-user-agent
import useragent "github.com/wenlng/go-user-agent"
func main(){
userAgent := "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60"
name := useragent.GetOsName(userAgent)
fmt.Println(name) // "Windows 10"
}
import useragent "github.com/wenlng/go-user-agent"
func main(){
userAgent := "Mozilla/5.0 {Macintosh; Intel Mac OS X 10.6.8; U; en) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60"
name := useragent.GetBrowserName(userAgent)
fmt.Println(name) // "Chrome/39.0.2171.95"
}
MIT
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。