From 0a1de921e12bb42dc3567e3772b804830780f7ef Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 3 Sep 2019 01:19:55 -0400 Subject: [PATCH] tweak hoot, less noise, log errors --- hoot.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hoot.go b/hoot.go index 8e8aff7..9d11b33 100644 --- a/hoot.go +++ b/hoot.go @@ -64,13 +64,17 @@ func hootfetcher(hoot 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) wanted := "" var buf strings.Builder - fmt.Fprintf(&buf, "hoot: %s\n", url) + fmt.Fprintf(&buf, "%s\n", url) for _, div := range divs { twp := div.Parent.Parent.Parent alink := linksel.MatchFirst(twp)