aboutsummaryrefslogtreecommitdiff
path: root/search.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2024-05-28 21:58:44 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2024-05-28 21:58:44 +0530
commitbe1aaadc320f5ec5dc5f607aa2799e2ba90ae939 (patch)
tree42a6966a24a1c7310172a7eb93902827919290e4 /search.go
parentc10fb3398376c7f6ccbbc676973832b34abef713 (diff)
finally properly getting title and url of anime while ignoring commentsHEADv1.3.0master
Diffstat (limited to 'search.go')
-rw-r--r--search.go8
1 files changed, 6 insertions, 2 deletions
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) {