okay, now with the imgs
This commit is contained in:
parent
a452ef3188
commit
578deeb6e9
9
hoot.go
9
hoot.go
|
@ -31,7 +31,7 @@ import (
|
|||
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,9 +84,16 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
|
|||
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)
|
||||
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
||||
|
|
Loading…
Reference in New Issue