google

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package google implements web search against Google's classic non-JavaScript result page (the server-rendered markup served when the client does not run JavaScript).

This provider is inherently best-effort: Google's result DOM is regionally A/B tested and can change without notice, and Google serves JS-challenge or "unusual traffic" pages to callers it distrusts (the shared httpclient.Detect reports those before this package ever parses). The parse heuristic below is therefore written against the documented/observed basic markup, degrades to empty snippets rather than wrong results, and MUST be re-validated against a real captured success page before its output is trusted end-to-end — see plan.md Phase 2 exit criteria and AGENTS.md Known Pitfalls.

Index

Constants

This section is empty.

Variables

View Source
var Endpoint = "https://www.google.com/search"

Endpoint is Google's web search URL. It accepts the query as the q parameter and returns server-rendered result markup to non-JS clients. It is a var, not a const, so tests can point Search at a local httptest server.

Functions

func Search(ctx context.Context, client *httpclient.Client, query string, maxResults int) ([]provider.Result, error)

Search queries Google for query and returns up to maxResults results (maxResults <= 0 means no cap). It returns serrors.ErrChallenge/ErrBlocked if Google challenges or blocks the request, or serrors.ErrNoResults if the page parsed cleanly but contained no results.

Types

This section is empty.

Jump to

Keyboard shortcuts

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