aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnis Armus <ragnis@armus.ee>2019-10-20 19:05:20 +0300
committerRagnis Armus <ragnis@armus.ee>2019-10-20 19:05:20 +0300
commitb814169385a3ca3bb5d96614e0b6458f14d031f5 (patch)
tree749b79af395e7e9272d1f3a6bea8eef1e19b2a4c
parent564cc2eaf73ce0e848824bb57fa7521daf7ad309 (diff)
Fix parsing ettv seeder count
-rw-r--r--search/ettv.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/search/ettv.go b/search/ettv.go
index d671bd9..01b175f 100644
--- a/search/ettv.go
+++ b/search/ettv.go
@@ -5,6 +5,7 @@ import (
"errors"
"net/url"
"strconv"
+ "strings"
"github.com/PuerkitoBio/goquery"
)
@@ -20,7 +21,7 @@ func (s ETTV) Search(ctx context.Context, query string) (results Results, err er
return
}
doc.Find("#main .right_column .myFrame-content table > tbody > tr").Each(func(i int, tr *goquery.Selection) {
- seeders, err := strconv.Atoi(tr.Find("td:nth-child(6) b").Text())
+ seeders, err := parseFmtInt(tr.Find("td:nth-child(6) b").Text())
if err != nil || seeders < 0 {
return
}
@@ -84,3 +85,8 @@ func (s ETTV) magnetURL(ctx context.Context, url string) (magnet string, err err
})
return
}
+
+func parseFmtInt(s string) (int, error) {
+ s = strings.ReplaceAll(s, ",", "")
+ return strconv.Atoi(s)
+}