diff --git a/backend/config_sample/config_sample.json b/backend/config_sample/config_sample.json index 9eb7a78..8b1ed57 100644 --- a/backend/config_sample/config_sample.json +++ b/backend/config_sample/config_sample.json @@ -451,16 +451,16 @@ "base_url": "https://www.torrentleech.org/", "scraping": { "xpaths": { - "uploaded_amount": "body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(1) > td:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(1) > span", - "downloaded_amount": "body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(1) > td:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(2) > span", - "bonus_points": "body > div:nth-of-type(3) > div:nth-of-type(2) > div > div:nth-of-type(1) > span:nth-of-type(2) > span:nth-of-type(2) > div:nth-of-type(1) > span > span", - "buffer": "body > div:nth-of-type(3) > div:nth-of-type(2) > div > div:nth-of-type(1) > span:nth-of-type(2) > span:nth-of-type(1) > div:nth-of-type(3)", - "seeding": "body > div:nth-of-type(3) > div:nth-of-type(2) > div > div:nth-of-type(1) > span:nth-of-type(2) > span:nth-of-type(1) > div:nth-of-type(1)", - "leeching": "body > div:nth-of-type(3) > div:nth-of-type(2) > div > div:nth-of-type(1) > span:nth-of-type(2) > span:nth-of-type(1) > div:nth-of-type(2)", - "ratio": "body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(1) > td:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(3) > span", + "uploaded_amount": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(1) span", + "downloaded_amount": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(2) span", + "bonus_points": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(2) div:nth-of-type(1) span span", + "buffer": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(3)", + "seeding": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(1)", + "leeching": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(2)", + "ratio": "body div:nth-of-type(2) div:nth-of-type(2) div div:nth-of-type(1) span:nth-of-type(2) span:nth-of-type(1) div:nth-of-type(4)", "warned": "", - "torrent_comments": "body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(11) > td:nth-of-type(2)", - "class": "body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(5) > td:nth-of-type(2)" + "torrent_comments": "body div:nth-of-type(5) div div div div:nth-of-type(3) div div div table tbody tr:nth-of-type(11) td:nth-of-type(2)", + "class": "body div:nth-of-type(5) div div div div:nth-of-type(3) div div div table tbody tr:nth-of-type(5) td:nth-of-type(2)" } } } diff --git a/backend/indexers/tl.go b/backend/indexers/tl.go index d4ef6a5..819f56a 100644 --- a/backend/indexers/tl.go +++ b/backend/indexers/tl.go @@ -79,7 +79,6 @@ func ProcessIndexerResponseTL(bodyString string, indexerInfo gjson.Result) map[s doc, _ := goquery.NewDocumentFromReader(strings.NewReader(bodyString)) // fmt.Println(bodyString) - fmt.Println(doc.Find("body > div:nth-of-type(6) > div > div > div > div:nth-of-type(3) > div > div > div > table > tbody > tr:nth-of-type(1) > td:nth-of-type(2) > div:nth-of-type(2)").Text()) uploadRegexResult := re.FindStringSubmatch(doc.Find(indexerInfo.Get("scraping.xpaths.uploaded_amount").Str).Text()) if len(uploadRegexResult) == 0 { fmt.Printf("An error occured while parsing %s's response", indexerInfo.Get("indexer_name").Str) @@ -97,13 +96,13 @@ func ProcessIndexerResponseTL(bodyString string, indexerInfo gjson.Result) map[s results["buffer"] = helpers.AnyUnitToBytes(cleanBuffer, downloadRegexResult[2]) bonusPoints := doc.Find(indexerInfo.Get("scraping.xpaths.bonus_points").Str).Text() - results["bonus_points"] = strings.ReplaceAll(bonusPoints, " ", "") + results["bonus_points"] = strings.ReplaceAll(bonusPoints, "'", "") seeding_html := doc.Find(indexerInfo.Get("scraping.xpaths.seeding").Str).Text() results["seeding"] = regexp.MustCompile(`\((\d+)\)`).FindStringSubmatch(seeding_html)[1] leeching_html := doc.Find(indexerInfo.Get("scraping.xpaths.leeching").Str).Text() - results["seeding"] = regexp.MustCompile(`\((\d+)\)`).FindStringSubmatch(leeching_html)[1] + results["leeching"] = regexp.MustCompile(`\((\d+)\)`).FindStringSubmatch(leeching_html)[1] ratio_html := doc.Find(indexerInfo.Get("scraping.xpaths.ratio").Str).Text() results["ratio"] = regexp.MustCompile(`(\d+)`).FindStringSubmatch(ratio_html)[1] @@ -114,7 +113,5 @@ func ProcessIndexerResponseTL(bodyString string, indexerInfo gjson.Result) map[s class := doc.Find(indexerInfo.Get("scraping.xpaths.class").Str).Text() results["class"] = class - fmt.Println(results) - return results } diff --git a/frontend/public/images/TorrentLeech.png b/frontend/public/images/TorrentLeech.png new file mode 100644 index 0000000..daf3265 Binary files /dev/null and b/frontend/public/images/TorrentLeech.png differ