all repos — honk @ 0278f216f94fee7d7c2a7f7045129e0a18b2eb67

my fork of honk

fix hoot to work with twitter's crap
Ted Unangst tedu@tedunangst.com
Tue, 22 Dec 2020 13:04:04 -0500
commit

0278f216f94fee7d7c2a7f7045129e0a18b2eb67

parent

baecae46f908d52258a8e957149af1c00575d890

2 files changed, 7 insertions(+), 4 deletions(-)

jump to
M docs/changelog.txtdocs/changelog.txt

@@ -1,5 +1,9 @@

changelog +=== next + ++ Fix hoot to work with Twitter's latest crap. + === 0.9.5 Emergency Ejection + Fix honk init user creation.
M hoot.gohoot.go

@@ -29,8 +29,8 @@ "golang.org/x/net/html"

"humungus.tedunangst.com/r/webs/htfilter" ) -var tweetsel = cascadia.MustCompile("div.tweet-text") -var linksel = cascadia.MustCompile("td.timestamp a") +var tweetsel = cascadia.MustCompile("p.tweet-text") +var linksel = cascadia.MustCompile("a.tweet-timestamp") var replyingto = cascadia.MustCompile(".ReplyingToContextBelowAuthor") var authorregex = regexp.MustCompile("twitter.com/([^/]+)")

@@ -109,14 +109,13 @@ if url[0] == ' ' {

url = url[1:] } url = strings.Replace(url, "mobile.twitter.com", "twitter.com", -1) - url = strings.Replace(url, "twitter.com", "mobile.twitter.com", -1) log.Printf("hooterizing %s", url) req, err := http.NewRequest("GET", url, nil) if err != nil { log.Printf("error: %s", err) return hoot } - req.Header.Set("User-Agent", "OpenBSD ftp") + req.Header.Set("User-Agent", "Bot") req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") req.Header.Set("Accept-Language", "en-US,en;q=0.9") resp, err := http.DefaultClient.Do(req)