技术&日志

爬虫资料收集

golang爬虫

  • GoQuery
  • colly
  • soup
  • Pholcus

golang-colly-爬虫

FAQ

Q: 如何设置只遍历当前网站?

colly.AllowedDomains("域名"),

参考-文档-examples/basic

Q: 如何下载遍历的HTML页面?

没找到下载HTML的方法

golang代码使用

go get -u github.com/gocolly/colly/...

package main

import (
    "fmt"

    "github.com/gocolly/colly"
)

func main() {
    c := colly.NewCollector()

    // Find and visit all links
    c.OnHTML("a[href]", func(e *colly.HTMLElement) {
        e.Request.Visit(e.Attr("href"))
    })

    c.OnRequest(func(r *colly.Request) {
        fmt.Println("Visiting", r.URL)
    })

    c.Visit("http://go-colly.org/")
}

二进制程序使用

golang资料

用 Go 做爬虫的话,有哪些库可以选择?

gospider-基于colly-提供有web界面

python资料

Python3爬虫学习系列教程

Python3 实例

中国爬虫违法违规案例汇总

Python爬虫学习的完整路线

11 个有趣的 Python 爬虫例子

知乎-如何入门 Python 爬虫?

数据资源

sankedan

相关资料

一个爬虫练习平台

52讲轻松搞定网络爬虫

发表评论