Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBlocked = errors.New("google block")
ErrBlocked indicates that Google has detected that you were scraping and temporarily blocked you. The duration of the block is unspecified.
See: https://github.com/rocketlaunchr/google-search#warning-warning
var GoogleDomains = map[string]string{}/* 198 elements not displayed */
GoogleDomains represents localized Google homepages. The 2 letter country code is based on ISO 3166-1 alpha-2.
See: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
var RateLimit = rate.NewLimiter(rate.Inf, 0)
RateLimit sets a global limit to how many requests to Google Search can be made in a given time interval. The default is unlimited (but obviously Google Search will block you temporarily if you do too many calls too quickly).
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// Rank is the order number of the search result.
Rank int `json:"rank"`
// URL of result.
URL string `json:"url"`
// Title of result.
Title string `json:"title"`
// Description of the result.
Description string `json:"description"`
}
Result represents a single result from Google Search.
type SearchOptions ¶
type SearchOptions struct {
// CountryCode sets the ISO 3166-1 alpha-2 code of the localized Google Search homepage to use.
// The default is "us", which will return results from https://www.google.com.
CountryCode string
// LanguageCode sets the language code.
// Default: en
LanguageCode string
// Limit sets how many results to fetch (at maximum).
Limit int
// Start sets from what rank the new result set should return.
Start int
// UserAgent sets the UserAgent of the http request.
// Default: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
UserAgent string
// OverLimit searches for more results than that specified by Limit.
// It then reduces the returned results to match Limit.
OverLimit bool
// ProxyAddr sets a proxy address to avoid IP blocking.
ProxyAddr string
// FollowNextPage, when set, scrapes subsequent result pages.
FollowNextPage bool
}
SearchOptions modifies how the Search function behaves.