google-search: Index | Files

package googlesearch

import ""


Package Files



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.


type Result Uses

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.

func Search(ctx context.Context, searchTerm string, opts ...SearchOptions) ([]Result, error)

Search returns a list of search results from Google.

type SearchOptions Uses

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
    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

SearchOptions modifies how the Search function behaves.

Package googlesearch imports 4 packages (graph). Updated 2020-06-13. Refresh now. Tools for package owners.