Skip to content

Instantly share code, notes, and snippets.

@mdk-aza
Created April 24, 2016 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdk-aza/f1ea3856683333c39e28ce736749749f to your computer and use it in GitHub Desktop.
Save mdk-aza/f1ea3856683333c39e28ce736749749f to your computer and use it in GitHub Desktop.
package main
import (
"github.com/PuerkitoBio/goquery"
"fmt"
"io/ioutil"
"os"
)
func main() {
url := "http://minamiichikawa.jp/pg214.html"
WritePage(url)
}
func WritePage(url string) {
doc, err := goquery.NewDocument(url)
if err != nil {
fmt.Print("url scarapping failed")
}
res, err := doc.Find("body").Html()
if err != nil {
fmt.Print("dom get failed")
}
ioutil.WriteFile("WebCrowler/html/pg214.html", []byte(res), os.ModePerm)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment