The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
xoxo419

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

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