serper

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 9 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
}

Client implements web.Searcher against the Serper Google Search API.

func NewClient

func NewClient(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 *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