diff --git a/backend/internal/novelfire/scraper.go b/backend/internal/novelfire/scraper.go index 8b53944..f9e360f 100644 --- a/backend/internal/novelfire/scraper.go +++ b/backend/internal/novelfire/scraper.go @@ -178,12 +178,26 @@ func (s *Scraper) ScrapeMetadata(ctx context.Context, bookURL string) (domain.Bo } } - status := htmlutil.ExtractFirst(root, scraper.Selector{Tag: "span", Class: "status"}) + // Status: novelfire renders Ongoing (or + // "completed", "hiatus") inside the .header-stats block. We take the text + // content and lowercase it so the index value is always canonical lowercase. + var status string + for _, cls := range []string{"ongoing", "completed", "hiatus"} { + if v := htmlutil.ExtractFirst(root, scraper.Selector{Tag: "strong", Class: cls}); v != "" { + status = strings.ToLower(strings.TrimSpace(v)) + break + } + } - genresNode := htmlutil.FindFirst(root, scraper.Selector{Tag: "div", Class: "genres"}) + // Genres: novelfire renders