V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
xoxo419

golang 爬虫框架 colly 有提供下载保存 HTML 的方法吗?

  •  
  •   xoxo419 · Dec 29, 2021 · 2217 views
    This topic created in 1584 days ago, the information mentioned may be changed or developed.
    4 replies    2021-12-31 14:10:47 +08:00
    quella
        1
    quella  
       Dec 29, 2021
    ```go
    c.OnResponse(func(r *colly.Response) {
    log.Printf("%s\n", bytes.Replace(r.Body, []byte("\n"), nil, -1))
    })
    ```
    xoxo419
        2
    xoxo419  
    OP
       Dec 30, 2021
    @quella 其他的写入文件操作是要自己处理吗?
    LSvKing
        3
    LSvKing  
       Dec 30, 2021
    这种轻框架只负责网页的解析和访问
    quella
        4
    quella  
       Dec 31, 2021
    @xoxo419 是的。r.Body 写到文件里面就行了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   923 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:48 · PVG 02:48 · LAX 11:48 · JFK 14:48
    ♥ Do have faith in what you're doing.