Skip to content

Commit 5862b88

Browse files
committed
fix Boxun fetch body nil.
1 parent 5f68d3a commit 5862b88

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

internal/fetcher/body.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,15 @@ func Boxun(p *Post) (string, error) {
9696
if len(nodes) == 0 {
9797
return "", errors.New("[-] There is no tag named `<td class=F11>` from: " + p.URL.String())
9898
}
99-
articleDoc := nodes[0].FirstChild
100-
blist := ElementsNextByTag(articleDoc, "br")
99+
blist := ElementsNextByTag(nodes[0], "br")
101100
for _, b := range blist {
102-
if b.NextSibling == nil || b.NextSibling.Type != html.TextNode || b.NextSibling.Data == "" {
101+
if b.Type != html.TextNode || b.Data == "" {
103102
continue
104103
} else {
105-
body += b.NextSibling.Data
104+
body += strings.ReplaceAll(b.Data, "\u00a0", "")
106105
}
107106
}
108-
107+
gears.ConvertToUtf8(&body, "gbk", "utf8")
109108
return body, nil
110109
}
111110

0 commit comments

Comments
 (0)