From 34d91e75d871c55b82775e169d5ebc51837d20b0 Mon Sep 17 00:00:00 2001 From: Matt Lyon Date: Tue, 26 Nov 2019 21:33:18 +1100 Subject: small fixes --- tpblite/models/torrents.py | 4 ++++ tpblite/models/utils.py | 1 - tpblite/tpblite.py | 9 +-------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py index 7852c28..dd63358 100644 --- a/tpblite/models/torrents.py +++ b/tpblite/models/torrents.py @@ -82,8 +82,12 @@ class Torrents(object): return torrents def __getRows(self, soup): + '''TODO: if length of rows = 1, then no search results + ''' rows = soup.body.find_all('tr') # remove first and last entries + print(len(rows)) + print(rows) del rows[0] del rows[-1] return rows diff --git a/tpblite/models/utils.py b/tpblite/models/utils.py index 200982f..310d9fd 100644 --- a/tpblite/models/utils.py +++ b/tpblite/models/utils.py @@ -10,7 +10,6 @@ class Query(object): ''' def __init__(self, query, base_url, page, order, category): self.base_url = base_url - print('category is {} {}'.format(category,str(category))) segments = ('search', query, str(page), str(order), str(category)) self.url = URL(base_url, segments) self.html_source = self._sendRequest() diff --git a/tpblite/tpblite.py b/tpblite/tpblite.py index 0bee91a..93c812b 100644 --- a/tpblite/tpblite.py +++ b/tpblite/tpblite.py @@ -13,11 +13,4 @@ class TPB(object): def search(self, query, page=0, order=99, category=0): q = Query(query, self.base_url, page, order, category) self.search_url = q.url - return Torrents(q.html_source) - -def run(): - q = Query('avengers endgame 1080p') - print(q.url) - t = Torrents(q.webpage) - torrent = t.getBestTorrent() - print(torrent.magnetlink) \ No newline at end of file + return Torrents(q.html_source) \ No newline at end of file -- cgit v1.2.3