Skip to content

Instantly share code, notes, and snippets.

@Adron
Created July 5, 2019 22:06
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 Adron/de1693ba971e2df7ea1857bfcf31dda5 to your computer and use it in GitHub Desktop.
Save Adron/de1693ba971e2df7ea1857bfcf31dda5 to your computer and use it in GitHub Desktop.
TheCallOutToThings
func main() {
htmlContent, err := ioutil.ReadFile("compositecode.html")
if err != nil {
fmt.Println(err)
}
htmlData := string(htmlContent)
r := strings.NewReader(htmlData)
doc, err := html.Parse(r)
if err != nil {
fmt.Fprintf(os.Stderr, "find links: %v\n", err)
os.Exit(1)
}
for _, link := range visit(nil, doc) {
fmt.Println(link)
}
w, i, _ := CountWordsAndImages("https://compositecode.blog")
fmt.Printf("Words: %d\nImages: %d\n", w, i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment