mssola / user_agent

This project has been moved, check the README.md file!

Home Page:https://github.com/mssola/useragent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Baiduspider/2.0

vmihailenco opened this issue · comments

Looks like this package does not support Baidu bot: "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"

package main

import "fmt"
import ua "github.com/mssola/user_agent"

func main() {
    userAgent := &ua.UserAgent{}
    userAgent.Parse("Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)")
    fmt.Println(userAgent.Bot())
}

Fixed with commit 79de7b2 . Thanks for reporting :)