serper

package
v0.57.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package serper wires Serper's Google Search API into web.Searcher.

Requests use POST /search with the X-API-KEY header and always enable autocorrect.

web.SearchRequest maps to the Serper request:

Only organic[] results are surfaced: title → Title, link → URL, snippet → Snippet, and date → PublishedTime when it is an absolute date.

Reference: https://serper.dev/playground

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, config Config) (*Client, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, request *web.SearchRequest) (*web.SearchResponse, error)

type Config

type Config struct {
	APIKey  string
	BaseURL string
	// HTTPClient remains host-owned. Requests and redirects are restricted to
	// BaseURL's origin, including when the host redirect policy changes a request.
	HTTPClient *http.Client
}

Config configures a Client. APIKey is required; an empty BaseURL selects Serper's public endpoint and a nil HTTPClient selects a default client.

Jump to

Keyboard shortcuts

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