From 8f3739a8eaf9faeac47734086f0065b014ed0862 Mon Sep 17 00:00:00 2001 From: milarin Date: Fri, 10 Mar 2023 21:38:47 +0100 Subject: [PATCH] use first found link for chapter id --- api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index 245afdc..898038d 100644 --- a/api.go +++ b/api.go @@ -37,7 +37,7 @@ func (api *Api) GetReadingList(ctx context.Context, listIndex int) (*ReadingList selection := doc.Find("table tbody tr") entries := make([]ReadingListEntry, 0, selection.Length()) selection.Each(func(i int, s *goquery.Selection) { - link := s.Find("td:nth-child(2) a") + link := s.Find("td:nth-child(2) a:first-child") href, ok := link.Attr("href") if !ok { return @@ -200,7 +200,7 @@ func (api *Api) getChapterEntriesByPageIndex(ctx context.Context, novelID NovelI entryElems.Each(func(i int, s *goquery.Selection) { td3 := s.Find("td:nth-child(3) a.chp-release") - chapterID := td3.Text() + chapterID := strings.TrimSpace(td3.Text()) groupID := path.Base(s.Find("td:nth-child(2) a").AttrOr("href", "")) link := "https:" + td3.AttrOr("href", "")