Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Selectors = struct { Captcha []string CookieBtn string ResultItems string Results string Ads string ImageResults string Title string TitleFallbacks []string DescPrimary string DescFallback string DescAny string AdTitle string }{ Captcha: []string{"div.captcha", "div.captcha_header"}, CookieBtn: "button#bnp_btn_accept", ResultItems: "#b_results > li.b_algo, #b_results > li.b_ad", Results: "li.b_algo", Ads: "li.b_ad", ImageResults: "a.iusc, div.iuscp, div.isv", Title: "h2 a", TitleFallbacks: []string{"h2", "a[aria-label]"}, DescPrimary: "div.b_caption p", DescFallback: "div.b_caption div", DescAny: "p", AdTitle: "h2 a", }
Selectors is the single source of truth for Bing SERP CSS selectors.
Functions ¶
func BuildImageURL ¶
BuildImageURL builds a Bing image search URL from Query fields. It returns an error when the resulting query text is empty.
Types ¶
type Bing ¶
type Bing struct {
core.Browser
core.SearchEngineOptions
// contains filtered or unexported fields
}
Bing implements core.SearchEngine for Bing SERP pages.
func New ¶
func New(browser core.Browser, opts core.SearchEngineOptions) *Bing
New creates a Bing engine instance with browser/runtime options applied.
func (*Bing) Search ¶
func (bing *Bing) Search(ctx context.Context, query core.Query) (results []core.SearchResult, err error)
Search executes a Bing web search and returns normalized search results. It may return core.ErrCaptcha or core.ErrSearchTimeout.
func (*Bing) SearchImage ¶
SearchImage executes a Bing image search and returns normalized image results. It may return core.ErrCaptcha or core.ErrSearchTimeout.
type BingImageData ¶
type BingImageData struct {
T string `json:"t"` // Title
Desc string `json:"desc"` // Description
IMGURL string `json:"imgurl"` // Original image URL
W int `json:"w"` // Width
H int `json:"h"` // Height
PURL string `json:"purl"` // Page URL
TURL string `json:"turl"` // Thumbnail URL
MURL string `json:"murl"` // Image URL
}
BingImageData represents metadata encoded in the image result `m` attribute.
Click to show internal directories.
Click to hide internal directories.