From a81ec6f628a09900ca8fec17123e957aceb47631 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 31 Oct 2019 00:14:43 -0400 Subject: [PATCH] don't need replies to yoyos in hoots --- hoot.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hoot.go b/hoot.go index 3452da8..ae21b67 100644 --- a/hoot.go +++ b/hoot.go @@ -31,6 +31,7 @@ import ( var tweetsel = cascadia.MustCompile("p.tweet-text") var linksel = cascadia.MustCompile(".time a.tweet-timestamp") +var replyingto = cascadia.MustCompile(".ReplyingToContextBelowAuthor") var authorregex = regexp.MustCompile("twitter.com/([^/]+)") var re_hoots = regexp.MustCompile(`hoot: ?https://\S+`) @@ -59,6 +60,10 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string { log.Printf("missing link") continue } + replto := replyingto.MatchFirst(twp) + if replto != nil { + continue + } link := "https://twitter.com" + htfilter.GetAttr(alink, "href") authormatch := authorregex.FindStringSubmatch(link) if len(authormatch) < 2 {