From be1aaadc320f5ec5dc5f607aa2799e2ba90ae939 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 28 May 2024 21:58:44 +0530 Subject: finally properly getting title and url of anime while ignoring comments --- search.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'search.go') diff --git a/search.go b/search.go index 2c9d40d..c018f0a 100644 --- a/search.go +++ b/search.go @@ -41,8 +41,12 @@ func Search(q SearchQuery) ([]Entry, error) { case 0: entry.Category = e.ChildAttr("a", "title") case 1: - entry.URL = e.ChildAttr("a", "href") - entry.Title = e.ChildAttr("a", "title") + e.ForEach("a", func(_ int, e *colly.HTMLElement) { + if e.Attr("class") != "comments" { + entry.URL = e.Attr("href") + entry.Title = e.Text + } + }) case 2: e.ForEach("a", func(_ int, e *colly.HTMLElement) { switch(e.Index) { -- cgit v1.2.3