Created
July 5, 2019 22:06
-
-
Save Adron/de1693ba971e2df7ea1857bfcf31dda5 to your computer and use it in GitHub Desktop.
TheCallOutToThings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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