remove very old dead code which is confusing
This commit is contained in:
parent
65a27bf359
commit
ca9f48106c
47
hoot.go
47
hoot.go
|
@ -67,41 +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
|
|
||||||
link := url
|
|
||||||
alink := linksel.MatchFirst(twp)
|
|
||||||
if alink == nil {
|
|
||||||
if i != 0 {
|
|
||||||
dlog.Printf("missing link")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alink = alink.Parent
|
|
||||||
link = "https://twitter.com" + htfilter.GetAttr(alink, "href")
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -111,12 +76,9 @@ func hootextractor(r io.Reader, url string, seen map[string]bool) string {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
alink = alink.Parent
|
||||||
link = "https://twitter.com" + htfilter.GetAttr(alink, "href")
|
link = "https://twitter.com" + htfilter.GetAttr(alink, "href")
|
||||||
}
|
}
|
||||||
replto := replyingto.MatchFirst(twp)
|
|
||||||
if replto != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
authormatch := authorregex.FindStringSubmatch(link)
|
authormatch := authorregex.FindStringSubmatch(link)
|
||||||
if len(authormatch) < 2 {
|
if len(authormatch) < 2 {
|
||||||
dlog.Printf("no author?: %s", link)
|
dlog.Printf("no author?: %s", link)
|
||||||
|
@ -135,14 +97,7 @@ 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)
|
||||||
text = re_removepics.ReplaceAllString(text, "")
|
|
||||||
|
|
||||||
if seen[text] {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
fmt.Fprintf(&buf, "> @%s: %s\n", author, text)
|
||||||
seen[text] = true
|
|
||||||
}
|
}
|
||||||
return buf.String()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue