/v2 module path shown below. SDKs covers the API key and the defaults all SDKs share.
Install
In a new directory, create a module, then add the SDK. Skipgo mod init if the project already has a go.mod.
Scrape a page
Save this asmain.go and run go run main.go. It prints the page as Markdown, starting with # Example Domain.
main.go
Look up a brand
Inmain, replace the scrape request, error check, and print statement with this lookup. It prints the company name.
Notes
- Optional fields take helpers, such as
contextdev.Bool(true),contextdev.Int(0), andcontextdev.String("US"); enum fields take plain strings. - Requests have no default timeout. Set one per attempt with
option.WithRequestTimeout(120 * time.Second), or for the whole call with acontextdeadline.option.WithMaxRetries(0)turns off retries. - If a params struct has no field for an option you need, such as
HighlightsParams,JsonParams, orProductParams, your installed version predates it. Send the request withclient.Post, as described in SDKs.