provider

package
v0.0.0-...-c5d5a31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var YandexProvider search.Provider = "Yandex"

YandexProvider indicates the search results came from the Yandex API

Functions

This section is empty.

Types

type Response

type Response struct {
	Attrdate string `xml:"date,attr"  json:",omitempty"`
	Found    []struct {
		Attrpriority string `xml:"priority,attr"  json:",omitempty"`
		Found        int64  `xml:",chardata" json:",omitempty"`
	} `xml:"found,omitempty" json:"found,omitempty"`
	FoundHuman string `xml:"found-human,omitempty" json:"found-human,omitempty"`
	Reqid      string `xml:"reqid,omitempty" json:"reqid,omitempty"`
	Error      *struct {
		Text string `xml:",chardata"`
		Code string `xml:"code,attr"`
	} `xml:"error"`
	Results struct {
		Grouping struct {
			Attrattr                 string `xml:"attr,attr"  json:",omitempty"`
			Attrcurcateg             string `xml:"curcateg,attr"  json:",omitempty"`
			AttrdocsDashInDashGroup  string `xml:"docs-in-group,attr"  json:",omitempty"`
			AttrgroupsDashOnDashPage string `xml:"groups-on-page,attr"  json:",omitempty"`
			Attrmode                 string `xml:"mode,attr"  json:",omitempty"`
			Found                    []struct {
				Attrpriority string `xml:"priority,attr"  json:",omitempty"`
				Found        string `xml:",chardata" json:",omitempty"`
			} `xml:"found,omitempty" json:"found,omitempty"`
			FoundDocs []struct {
				Attrpriority string `xml:"priority,attr"  json:",omitempty"`
				FoundDocs    string `xml:",chardata" json:",omitempty"`
			} `xml:"found-docs,omitempty" json:"found-docs,omitempty"`
			FoundDocsHuman struct {
				FoundDocsHuman string `xml:",chardata" json:",omitempty"`
			} `xml:"found-docs-human,omitempty" json:"found-docs-human,omitempty"`
			Group []struct {
				Categ struct {
					Attrattr string `xml:"attr,attr"  json:",omitempty"`
					Attrname string `xml:"name,attr"  json:",omitempty"`
				} `xml:"categ,omitempty" json:"categ,omitempty"`
				Doc struct {
					Attrid   string `xml:"id,attr"  json:",omitempty"`
					Charset  string `xml:"charset,omitempty" json:"charset,omitempty"`
					Domain   string `xml:"domain,omitempty" json:"domain,omitempty"`
					Headline struct {
						Headline string `xml:",innerxml" json:",omitempty"`
					} `xml:"headline,omitempty" json:"headline,omitempty"`
					MimeType string `xml:"mime-type,omitempty" json:"mime-type,omitempty"`
					Modtime  string `xml:"modtime,omitempty" json:"modtime,omitempty"`
					Passages struct {
						Passage []struct {
							Passage string `xml:",innerxml" json:",omitempty"`
						} `xml:"passage,omitempty" json:"passage,omitempty"`
					} `xml:"passages,omitempty" json:"passages,omitempty"`
					Properties struct {
						TurboCgiURL   string `xml:"TurboCgiUrl,omitempty" json:"TurboCgiUrl,omitempty"`
						TurboFallback string `xml:"TurboFallback,omitempty" json:"TurboFallback,omitempty"`
						TurboLink     string `xml:"TurboLink,omitempty" json:"TurboLink,omitempty"`
						PassagesType  string `xml:"_PassagesType,omitempty" json:"_PassagesType,omitempty"`
						Lang          string `xml:"lang,omitempty" json:"lang,omitempty"`
					} `xml:"properties,omitempty" json:"properties,omitempty"`
					Relevance            string `xml:"relevance,omitempty" json:"relevance,omitempty"`
					SavedDashCopyDashURL string `xml:"saved-copy-url,omitempty" json:"saved-copy-url,omitempty"`
					Size                 string `xml:"size,omitempty" json:"size,omitempty"`
					Title                struct {
						Title string `xml:",innerxml" json:",omitempty"`
					} `xml:"title,omitempty" json:"title,omitempty"`
					URL string `xml:"url,omitempty" json:"url,omitempty"`
				} `xml:"doc,omitempty" json:"doc,omitempty"`
				DocCount  string `xml:"doccount,omitempty" json:"doccount,omitempty"`
				Relevance string `xml:"relevance,omitempty" json:"relevance,omitempty"`
			} `xml:"group,omitempty" json:"group,omitempty"`
			Page struct {
				Attrfirst string `xml:"first,attr"  json:",omitempty"`
				Attrlast  string `xml:"last,attr"  json:",omitempty"`
				Page      string `xml:",chardata" json:",omitempty"`
			} `xml:"page,omitempty" json:"page,omitempty"`
		} `xml:"grouping,omitempty" json:"grouping,omitempty"`
	} `xml:"results,omitempty" json:"results,omitempty"`
}

Response is the XML response from the Yandex API

type Yandex

type Yandex struct {
	*http.Client
	User string
	Key  string
}

Yandex holds settings for the Yandex API.

func (*Yandex) Fetch

func (y *Yandex) Fetch(q string, filter search.Filter, lang language.Tag, region language.Region, number int, offset int) (*search.Results, error)

Fetch retrieves search results from the Yandex API. https://tech.yandex.com/xml/doc/dg/concepts/get-request-docpage/ https://xml.yandex.com/test/

type YandexResponse

type YandexResponse struct {
	Attrversion string `xml:"version,attr"  json:",omitempty"`
	Request     struct {
		Groupings struct {
			GroupBy struct {
				Attrattr                 string `xml:"attr,attr"  json:",omitempty"`
				Attrcurcateg             string `xml:"curcateg,attr"  json:",omitempty"`
				AttrdocsDashInDashGroup  string `xml:"docs-in-group,attr"  json:",omitempty"`
				AttrgroupsDashOnDashPage string `xml:"groups-on-page,attr"  json:",omitempty"`
				Attrmode                 string `xml:"mode,attr"  json:",omitempty"`
			} `xml:"groupby,omitempty" json:"groupby,omitempty"`
		} `xml:"groupings,omitempty" json:"groupings,omitempty"`
		MaxPassages string `xml:"maxpassages,omitempty" json:"maxpassages,omitempty"`
		Page        string `xml:"page,omitempty" json:"page,omitempty"`
		Query       string `xml:"query,omitempty" json:"query,omitempty"`
		SortBy      struct {
			Order    string `xml:"order,attr"  json:",omitempty"`
			Priority string `xml:"priority,attr"  json:",omitempty"`
			SortBy   string `xml:",chardata" json:"sortby,omitempty"`
		} `xml:"sortby,omitempty" json:"sortby,omitempty"`
	} `xml:"request,omitempty" json:"request,omitempty"`
	Response *Response `xml:"response,omitempty" json:"response,omitempty"`
}

YandexResponse is the request and XML response from the Yandex API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL