|
|
@@ -137,7 +137,10 @@ func getArticle(topCandidate *candidate, candidates candidateList) string {
|
|
|
}
|
|
|
|
|
|
func removeUnlikelyCandidates(document *goquery.Document) {
|
|
|
- document.Find("*").Not("html,body").Each(func(i int, s *goquery.Selection) {
|
|
|
+ document.Find("*").Each(func(i int, s *goquery.Selection) {
|
|
|
+ if s.Length() == 0 || s.Get(0).Data == "html" || s.Get(0).Data == "body" {
|
|
|
+ return
|
|
|
+ }
|
|
|
class, _ := s.Attr("class")
|
|
|
id, _ := s.Attr("id")
|
|
|
str := class + id
|