当前位置:首页 > 文章列表
>
Golang >
Go问答 >
使用 gocolly 抓取特定的 从现在开始,我们要努力学习啦!今天我给大家带来《使用 gocolly 抓取特定的 我正在尝试使用 gocolly 制作网络抓取工具。我只想在 感谢 xarantolus 的回答。 终于介绍完啦!小伙伴们,这篇关于《使用 gocolly 抓取特定的 使用 gocolly 抓取特定的
https://wol.jw.org/en/wol/h/r1/lp-e
上抓取 ID 为 dailyText
的 解决方案
这对我来说非常有用(如果域名允许我使用它的话。)func main() {
cly := colly.NewCollector(
colly.AllowedDomains("https://yourpage.site"),
)
cly.OnHTML("body", func(e *colly.HTMLElement) {
link := e.Attr("div")
fmt.Printf("Link found: %q -> %s\n", e.Text, link)
cly.Visit(e.Request.AbsoluteURL(link))
})
cly.OnRequest(func(r *colly.Request) {
fmt.Println("Visiting", r.URL.String())
})
page := cly.Visit("https://yourpage.site")
fmt.Print(page)
}
如何在golang中使用单个go文件?无法导入go文件