okay, now with the imgs
Ted Unangst tedu@tedunangst.com
Sun, 03 Jul 2022 16:17:18 -0400
1 files changed,
8 insertions(+),
1 deletions(-)
jump to
M
hoot.go
→
hoot.go
@@ -31,7 +31,7 @@
var tweetsel = cascadia.MustCompile("div[itemProp=articleBody]") var linksel = cascadia.MustCompile("a time") var replyingto = cascadia.MustCompile(".ReplyingToContextBelowAuthor") -var imgsel = cascadia.MustCompile("div.js-adaptive-photo img") +var imgsel = cascadia.MustCompile("div[data-testid=tweetPhoto] img") var authorregex = regexp.MustCompile("twitter.com/([^/]+)") var re_hoots = regexp.MustCompile(`hoot: ?https://\S+`)@@ -84,8 +84,15 @@ dlog.Printf("no author?: %s", link)
continue } author := authormatch[1] + if wanted == "" { + wanted = author + } if author != wanted { continue + } + for _, img := range imgsel.MatchAll(twp) { + img.Parent.RemoveChild(img) + div.AppendChild(img) } text := htf.NodeText(div) text = strings.Replace(text, "\n", " ", -1)