Я пытаюсь использовать https://github.com/gocolly/colly.
Я пытаюсь посетить URL и сохранить полный ответ на моем локальном диске, например, посетить google.com и сохранить полное тело ответа URL google.html.
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="bn"><head><meta content="text/html; charset=UTF-8" http-;google.pmc=JSON.parse(pmc);})();</script> </body></html>
func main() {
response, err := http.Get("https://www.google.com")
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
outFile, err := os.Create("google.html")
if err != nil {
log.Fatal(err)
}
defer outFile.Close()
// Copy data from HTTP response to file
_, err = io.Copy(outFile, response.Body)
if err != nil {
log.Fatal(err)
}
}
Мой ожидаемый результат:
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="bn"><head><meta content="text/html; charset=UTF-8" http-;google.pmc=JSON.parse(pmc);})();</script> </body></html>