mirror of
https://github.com/bestnite/bilinovel-downloader.git
synced 2025-04-28 11:15:54 +08:00
Compare commits
No commits in common. "main" and "v0.0.5" have entirely different histories.
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
@ -2,20 +2,12 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "volume",
|
"name": "Debug download volume",
|
||||||
"type": "go",
|
"type": "go",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "auto",
|
"mode": "auto",
|
||||||
"program": "${workspaceFolder}",
|
"program": "${workspaceFolder}",
|
||||||
"args": ["download", "volume", "-n", "2013", "-v", "165880"]
|
"args": ["download", "volume", "-n", "2013", "-v", "165880"]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "novel",
|
|
||||||
"type": "go",
|
|
||||||
"request": "launch",
|
|
||||||
"mode": "auto",
|
|
||||||
"program": "${workspaceFolder}",
|
|
||||||
"args": ["download", "novel", "-n", "4325"]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -413,9 +413,7 @@ func downloadChapterByPage(page, chapterIdx int, chapter *model.Chapter, outputP
|
|||||||
content.Find(".cgo").Remove()
|
content.Find(".cgo").Remove()
|
||||||
content.Find("center").Remove()
|
content.Find("center").Remove()
|
||||||
content.Find(".google-auto-placed").Remove()
|
content.Find(".google-auto-placed").Remove()
|
||||||
if strings.Contains(resp.String(), `font-family: "read"`) {
|
|
||||||
content.Find("p").Last().AddClass("read-font")
|
content.Find("p").Last().AddClass("read-font")
|
||||||
}
|
|
||||||
|
|
||||||
content.Find("img").Each(func(i int, s *goquery.Selection) {
|
content.Find("img").Each(func(i int, s *goquery.Selection) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -429,12 +427,15 @@ func downloadChapterByPage(page, chapterIdx int, chapter *model.Chapter, outputP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileName := filepath.Join(imgSavePath, fmt.Sprintf("%03v%s", len(chapter.ImageFullPaths)+1, path.Ext(imgUrl)))
|
fileName := filepath.Join(imgSavePath, fmt.Sprintf("%03v%s", i+1, path.Ext(imgUrl)))
|
||||||
err = DownloadImg(imgUrl, filepath.Join(outputPath, fileName))
|
err = DownloadImg(imgUrl, filepath.Join(outputPath, fileName))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.SetAttr("src", "../"+strings.TrimPrefix(fileName, "OEBPS/"))
|
s.SetAttr("src", "../"+strings.TrimPrefix(fileName, "OEBPS/"))
|
||||||
s.RemoveAttr("class")
|
s.RemoveAttr("class")
|
||||||
s.RemoveAttr("data-src")
|
s.RemoveAttr("data-src")
|
||||||
|
if s.AttrOr("alt", "") == "" {
|
||||||
|
s.SetAttr("alt", fmt.Sprintf("image-%03d", i+1))
|
||||||
|
}
|
||||||
chapter.ImageFullPaths = append(chapter.ImageFullPaths, filepath.Join(outputPath, fileName))
|
chapter.ImageFullPaths = append(chapter.ImageFullPaths, filepath.Join(outputPath, fileName))
|
||||||
chapter.ImageOEBPSPaths = append(chapter.ImageOEBPSPaths, strings.TrimPrefix(fileName, "OEBPS/"))
|
chapter.ImageOEBPSPaths = append(chapter.ImageOEBPSPaths, strings.TrimPrefix(fileName, "OEBPS/"))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user