Skip to content

Commit

Permalink
cleanup 69xinshu article content
Browse files Browse the repository at this point in the history
  • Loading branch information
missdeer committed Feb 28, 2024
1 parent d382b7f commit ef57acd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions handler/69xinshu.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ func extract69xinshuChapterList(u string, rawPageContent []byte) (title string,

func extract69xinshuChapterContent(rawPageContent []byte) (c []byte) {
c = ic.Convert("gbk", "utf-8", rawPageContent)
c = bytes.Replace(c, []byte("\r\n"), []byte(""), -1)
c = bytes.Replace(c, []byte("\r"), []byte(""), -1)
c = bytes.Replace(c, []byte("\n"), []byte(""), -1)

doc, err := goquery.NewDocumentFromReader(bytes.NewReader(c))
if err != nil {
log.Fatal(err)
}
c = []byte(doc.Find("div.txtnav").Text())

html, err := doc.Find("div.txtnav").Html()
if err != nil {
log.Fatal(err)
}
c = bytes.Replace([]byte(html), []byte(`  `), []byte(" "), -1)
c = bytes.Replace(c, []byte("<br /><br />"), []byte(""), -1)
return
}

Expand Down

0 comments on commit ef57acd

Please sign in to comment.