This is a Go wrapper for the Zyte API. Zyte API is a web scraping API that allows you to extract data from websites using antibot and proxy capabilities. This wrapper aims to provide an easy way to call the Zyte API using Go.
Please note that this wrapper is still under development and may contain bugs.
- Go 1.16 or higher
- A Zyte API account and API key
To install the wrapper, run the following command:
go get github.com/felipdc/zyte-api-go/pkg/zyte_api_go
To use the wrapper, you first need to create a client:
import (
"github.com/felipdc/zyte-api-go/pkg/zyte_api_go"
)
func main() {
e := zyte_api_go.NewExtractor("YOUR_API_KEY")
}
You can then use the client to make API requests:
// Set options
schema := zyte_api_go.RequestSchema{
Url: "http://books.toscrape.com/",
HttpResponseBody: true,
}
options := zyte_api_go.Options{
Schema: schema,
}
// Scrape a website
response := e.Extract(options)
// Print the response
fmt.Println(response)
Below is a table describing which parameter is currently supported.
Parameter | Done |
---|---|
requestHeaders | ❌ |
httpRequestMethod | ✅ |
httpRequestBody | ✅ |
httpRequestText | ✅ |
customHttpRequestHeaders | ❌ |
httpResponseBody | ✅ |
httpResponseHeaders | ✅ |
browserHtml | ✅ |
screenshot | ✅ |
screenshotOptions | ✅ |
geolocation | ✅ |
javascript | ✅ |
actions | ✅ |
jobId | ✅ |
echoData | ❌ |
experimental | ❌ |
For more information about ZyteAPI, please refer to the documentation.