From 7578297e3c9f5732aa4f44290f4c582ef6cece47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=92scar=20Casajuana?= Date: Fri, 20 Jan 2023 19:14:34 +0100 Subject: [PATCH] Fix manganelo grabber downloading (undesired) multiple chapters (#21) --- grabber/manganelo.go | 8 +++++--- makefile | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grabber/manganelo.go b/grabber/manganelo.go index 8cf57d7..1cac6fa 100644 --- a/grabber/manganelo.go +++ b/grabber/manganelo.go @@ -121,12 +121,14 @@ func (m Manganelo) FetchTitle() (string, error) { // FetchChapters returns a slice of chapters func (m Manganelo) FetchChapters() (chapters Filterables, errs []error) { m.rows.Each(func(i int, s *goquery.Selection) { - re := regexp.MustCompile(`(\d+\.?\d*)`) - num := re.FindString(s.Find("a").Text()) + re := regexp.MustCompile(`Chapter\s*(\d+\.?\d*)`) + chap := re.FindStringSubmatch(s.Find("a").Text()) // if the chapter has no number, we skip it (usually it's an announcement from the site) - if num == "" { + if len(chap) == 0 { return } + + num := chap[1] number, err := strconv.ParseFloat(num, 64) if err != nil { errs = append(errs, err) diff --git a/makefile b/makefile index 7747633..f3e45f1 100644 --- a/makefile +++ b/makefile @@ -39,6 +39,7 @@ grabber/manganelo: go run . https://mangakakalot.com/manga/vd921334 7 go run . https://ww5.manganelo.tv/manga/manga-aa951409 3 go run . http://manganelos.com/manga/dont-pick-up-what-youve-thrown-away 10-12 --bundle + go run . https://readmangabat.com/read-ov357862 23 go run . https://chapmanganato.com/manga-aa951409 50 go run . https://h.mangabat.com/read-tc397521 5 go run . https://mangajar.com/manga/chainsaw-man-absTop-abs3bof 23