Documentation
¶
Overview ¶
Package baidu is the library behind the baidu command: the HTTP client, request shaping, and the typed data models for Baidu.
Two APIs used: top.baidu.com for hot search boards (no key required) and suggestion.baidu.com for query suggestions (JSONP, no key required).
Package baidu provides typed data models for the baidu command.
Index ¶
Constants ¶
View Source
const (
// DefaultUserAgent identifies the client to Baidu APIs.
DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Baidu hot search and suggest APIs.
type Config ¶
type Config struct {
BaseURL string
SuggestBaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds constructor parameters.
type HotItem ¶
type HotItem struct {
Rank int `json:"rank"`
Word string `json:"word"`
Tag string `json:"tag"`
URL string `json:"url"`
}
HotItem is one entry from the Baidu hot search board.
type Suggestion ¶
Suggestion is one entry from the Baidu suggest API.
Click to show internal directories.
Click to hide internal directories.