remove very old dead code which is confusing
This commit is contained in:
parent
65a27bf359
commit
ca9f48106c
45
hoot.go
45
hoot.go
|
@ -67,7 +67,6 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
|
||||||
|
|
||||||
divs := tweetsel.MatchAll(root)
|
divs := tweetsel.MatchAll(root)
|
||||||
for i, div := range divs {
|
for i, div := range divs {
|
||||||
{
|
|
||||||
twp := div.Parent.Parent.Parent.Parent.Parent
|
twp := div.Parent.Parent.Parent.Parent.Parent
|
||||||
link := url
|
link := url
|
||||||
alink := linksel.MatchFirst(twp)
|
alink := linksel.MatchFirst(twp)
|
||||||
|
@ -99,50 +98,6 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
|
||||||
text := htf.NodeText(div)
|
text := htf.NodeText(div)
|
||||||
text = strings.Replace(text, "\n", " ", -1)
|
text = strings.Replace(text, "\n", " ", -1)
|
||||||
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
twp := div.Parent.Parent.Parent.Parent.Parent
|
|
||||||
link := url
|
|
||||||
alink := linksel.MatchFirst(twp)
|
|
||||||
if alink == nil {
|
|
||||||
if i != 0 {
|
|
||||||
dlog.Printf("missing link")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
link = "https://twitter.com" + htfilter.GetAttr(alink, "href")
|
|
||||||
}
|
|
||||||
replto := replyingto.MatchFirst(twp)
|
|
||||||
if replto != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
authormatch := authorregex.FindStringSubmatch(link)
|
|
||||||
if len(authormatch) < 2 {
|
|
||||||
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)
|
|
||||||
text = re_removepics.ReplaceAllString(text, "")
|
|
||||||
|
|
||||||
if seen[text] {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
|
||||||
seen[text] = true
|
|
||||||
}
|
}
|
||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue