fix: display images in epub

This commit is contained in:
lapwat committed 2021-12-09 23:48:25 +01:00
1 parent 4b9840e356
commit 2be32cd50f
5 files changed
+150 -99

No files matched your search

+5 -3
View File
@@ -41,15 +41,17 @@ func NewChapterFromURL(url string, images bool) chapter {
content := strings.ReplaceAll(article.Content, "\n", "")
if images {
// Load the HTML document
// parse html content
doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
if err != nil {
log.Fatal(err)
}
// Find the review items
// extract images only
content = ""
doc.Find("img").Each(func(i int, s *goquery.Selection) {
content, _ = goquery.OuterHtml(s)
newContent, _ := goquery.OuterHtml(s)
content += newContent
})
}