Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildImageURL ¶ added in v0.4.1
BuildImageURL builds a Yandex image search URL for the provided query and page index. It returns an error when the resulting query text is empty.
Types ¶
type ImageData ¶ added in v0.4.1
type ImageData struct {
InitalState struct {
SerpList struct {
Items struct {
Entities map[string]ImageEntity `json:"entities"`
} `json:"items"`
} `json:"serpList"`
} `json:"initialState"`
}
ImageData maps the subset of Yandex JSON state used by parser code.
type ImageEntity ¶ added in v0.4.1
type ImageEntity struct {
ID string `json:"id"`
Rank int `json:"pos"`
Width int `json:"origWidth"`
Height int `json:"origHeight"`
Title string `json:"alt"`
OrigURL string `json:"origUrl"`
ThumbURL string `json:"image"`
Freshness string `json:"freshnessCounter"`
IsGIF bool `json:"gifLabel"`
}
ImageEntity contains one image record from Yandex image search state JSON.
type Yandex ¶
type Yandex struct {
core.Browser
core.SearchEngineOptions
// contains filtered or unexported fields
}
Yandex implements core.SearchEngine for Yandex SERP pages.
func New ¶
func New(browser core.Browser, opts core.SearchEngineOptions) *Yandex
New creates a Yandex engine instance with browser/runtime options applied.
func (*Yandex) GetRateLimiter ¶ added in v0.2.1
GetRateLimiter returns a limiter configured from SearchEngineOptions.
func (*Yandex) Search ¶
func (yand *Yandex) Search(ctx context.Context, query core.Query) (results []core.SearchResult, err error)
Search executes a Yandex web search and returns normalized search results. It may return core.ErrCaptcha or core.ErrSearchTimeout.
func (*Yandex) SearchImage ¶ added in v0.4.1
SearchImage executes a Yandex image search and returns normalized image results. It may return core.ErrCaptcha or core.ErrSearchTimeout.