V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
xoxo419
V2EX  ›  Go 编程语言

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

  •  
  •   xoxo419 · 2021-12-29 19:56:37 +08:00 · 1628 次点击
    这是一个创建于 861 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    2021-12-31 14:10:47 +08:00
    quella
        1
    quella  
       2021-12-29 20:31:28 +08:00
    ```go
    c.OnResponse(func(r *colly.Response) {
    log.Printf("%s\n", bytes.Replace(r.Body, []byte("\n"), nil, -1))
    })
    ```
    xoxo419
        2
    xoxo419  
    OP
       2021-12-30 09:39:30 +08:00
    @quella 其他的写入文件操作是要自己处理吗?
    LSvKing
        3
    LSvKing  
       2021-12-30 17:16:27 +08:00
    这种轻框架只负责网页的解析和访问
    quella
        4
    quella  
       2021-12-31 14:10:47 +08:00
    @xoxo419 是的。r.Body 写到文件里面就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   997 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:45 · PVG 05:45 · LAX 14:45 · JFK 17:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.