tweak hoot, less noise, log errors

This commit is contained in:
Ted Unangst 2019-09-03 01:19:55 -04:00
parent b1f7c8540b
commit 0a1de921e1
1 changed files with 6 additions and 2 deletions

View File

@ -64,13 +64,17 @@ func hootfetcher(hoot string) string {
} }
func hootfixer(r io.Reader, url string) string { func hootfixer(r io.Reader, url string) string {
root, _ := html.Parse(r) root, err := html.Parse(r)
if err != nil {
log.Printf("error parsing hoot: %s", err)
return url
}
divs := tweetsel.MatchAll(root) divs := tweetsel.MatchAll(root)
wanted := "" wanted := ""
var buf strings.Builder var buf strings.Builder
fmt.Fprintf(&buf, "hoot: %s\n", url) fmt.Fprintf(&buf, "%s\n", url)
for _, div := range divs { for _, div := range divs {
twp := div.Parent.Parent.Parent twp := div.Parent.Parent.Parent
alink := linksel.MatchFirst(twp) alink := linksel.MatchFirst(twp)