Install
openclaw skills install @scrapfly/scrapfly-sdk-goWeb scraping from Go with the Scrapfly SDK (github.com/scrapfly/go-scrapfly). Use when the user asks to scrape a URL, bypass anti-bot protection, render JavaScript, capture screenshots, or extract structured data from a Go program.
openclaw skills install @scrapfly/scrapfly-sdk-goUse the go-scrapfly module to scrape web pages from Go with proxy rotation,
anti-bot bypass (ASP), JavaScript rendering, screenshots, and AI extraction.
It ships a built-in goquery selector for parsing the response.
go get github.com/scrapfly/go-scrapfly
export SCRAPFLY_API_KEY="your-api-key"
The package name is scrapfly. Get your API key at scrapfly.io.
package main
import (
"fmt"
"log"
"os"
"github.com/scrapfly/go-scrapfly"
)
func main() {
client, err := scrapfly.New(os.Getenv("SCRAPFLY_API_KEY"))
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
apiResponse, err := client.Scrape(&scrapfly.ScrapeConfig{
URL: "https://web-scraping.dev/product/1",
})
if err != nil {
log.Fatalf("scrape failed: %v", err)
}
fmt.Println(apiResponse.Result.Content)
}
ScrapeConfig fields are Go-idiomatic PascalCase. ProxyPool takes a typed
constant.
apiResponse, err := client.Scrape(&scrapfly.ScrapeConfig{
URL: "https://web-scraping.dev/product/1",
ASP: true, // bypass anti-bot
Country: "us", // proxy country (ISO 3166-1 alpha-2)
ProxyPool: scrapfly.PublicResidentialPool, // or scrapfly.PublicDataCenterPool
RenderJS: true, // headless browser rendering
WaitForSelector: "div.product", // requires RenderJS
RenderingWait: 5000, // ms, requires RenderJS
Format: "markdown", // raw | clean_html | json | markdown | text
})
selector, err := apiResponse.Selector() // goquery document
if err != nil {
log.Fatal(err)
}
fmt.Println("Title:", selector.Find("h3").First().Text())
shot, err := client.Screenshot(&scrapfly.ScreenshotConfig{
URL: "https://web-scraping.dev/products",
})
data, err := client.Extract(&scrapfly.ExtractionConfig{
Body: []byte(apiResponse.Result.Content),
ContentType: "text/html",
ExtractionPrompt: "extract all product names and prices",
})
RenderJS: true is required for RenderingWait, WaitForSelector, and screenshotsscrapfly.PublicResidentialPool is recommended alongside ASP: trueFormat: "markdown" for clean, LLM-friendly contentapiResponse.Result.Content; parse with apiResponse.Selector()