Added Last Chapter functionality to see how many more chapters you have, also kinda works as update Status bar
changed it to only load latest chapter instead of all chapters for manga Added develop and release db from different locations Added stopwatch for future performance improvement metrics
This commit is contained in:
@@ -109,9 +109,24 @@ func (b *Bato) GetTitleIdAndChapterId(url string) (titleId int, chapterId int, e
|
||||
return t, c, err
|
||||
}
|
||||
|
||||
//func (b *Bato) GetChapterList(url string) (chapterIds []int, err error) {
|
||||
//
|
||||
//}
|
||||
func (b *Bato) GetChapterList(subUrl string) (subUrls []string, err error) {
|
||||
reg, err := regexp.Compile(`<div class="space-x-1">.*?<a href="(.*?)" .*?>Chapter (\d*)</a>`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
html, err := b.GetHtml(subUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
subUrls = make([]string, 0)
|
||||
matches := reg.FindAllStringSubmatch(html, -1)
|
||||
for _, match := range matches {
|
||||
subUrls = append(subUrls, match[1])
|
||||
}
|
||||
return subUrls, nil
|
||||
}
|
||||
|
||||
func (b *Bato) GetThumbnail(subUrl string) (thumbnailUrl string, err error) {
|
||||
url := fmt.Sprintf("https://bato.to/title/%s", subUrl)
|
||||
|
||||
@@ -8,4 +8,5 @@ type Provider interface {
|
||||
GetTitleAndChapter(url string) (title string, chapter string, err error)
|
||||
GetTitleIdAndChapterId(url string) (titleId int, chapterId int, err error)
|
||||
GetThumbnail(mangaId string) (thumbnailUrl string, err error)
|
||||
GetChapterList(url string) (urls []string, err error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user