-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnovel.go
35 lines (30 loc) · 995 Bytes
/
novel.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import "github.com/missdeer/getnovel/ebook"
type TOCPattern struct {
Host string
BookTitle string
BookTitlePos int
Item string
ArticleTitlePos int
ArticleURLPos int
IsAbsoluteURL bool
}
type PageContentMarker struct {
Host string
Start []byte
End []byte
}
type NovelChapterInfo struct {
Index int
Title string
URL string
}
type NovelSiteHandler struct {
Title string
Urls []string
CanHandle func(string) bool // (url) -> can handle
PreprocessChapterListURL func(string) string // (original url) -> final url
ExtractChapterList func(string, []byte) (string, []*NovelChapterInfo) // (url, raw page content) (title, chapters)
ExtractChapterContent func([]byte) []byte // (raw page content) -> cleanup content
Download func(string, ebook.IBook)
}