update the hooter

This commit is contained in:
Ted Unangst 2019-12-13 17:59:53 -05:00
parent 54fc1d8be9
commit 059de101b4
3 changed files with 7 additions and 4 deletions

2
go.mod
View File

@ -7,7 +7,7 @@ require (
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
humungus.tedunangst.com/r/webs v0.6.26
humungus.tedunangst.com/r/webs v0.6.31
)
go 1.11

4
go.sum
View File

@ -22,5 +22,5 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
humungus.tedunangst.com/r/webs v0.6.26 h1:JgF+WhY6zvhXhRdqALPIWKTwzvwkCtD1eBB5fRzIKN8=
humungus.tedunangst.com/r/webs v0.6.26/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=
humungus.tedunangst.com/r/webs v0.6.31 h1:xDgtESuVljephZA4GfcycwiOwJeeJYUIQbStFHceN1Y=
humungus.tedunangst.com/r/webs v0.6.31/go.mod h1:S9sXpVSbgAIa24yYhnMN0C94LKHG+2rioS+NsiDimps=

View File

@ -53,6 +53,9 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
fmt.Fprintf(&buf, "%s\n", url)
var htf htfilter.Filter
htf.Imager = func(node *html.Node) string {
return ""
}
for _, div := range divs {
twp := div.Parent.Parent.Parent
alink := linksel.MatchFirst(twp)
@ -77,7 +80,7 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
if author != wanted {
continue
}
text := htf.TextOnly(div)
text := htf.NodeText(div)
text = strings.Replace(text, "\n", " ", -1)
text = strings.Replace(text, "pic.twitter.com", "https://pic.twitter.com", -1)