tweak hoot, less noise, log errors
This commit is contained in:
parent
b1f7c8540b
commit
0a1de921e1
8
hoot.go
8
hoot.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue