aboutsummaryrefslogtreecommitdiffstats
path: root/tpblite/tpblite.py
diff options
context:
space:
mode:
authorLoic Coyle <loic.coyle@hotmail.fr>2020-02-20 01:10:57 +0100
committerLoic Coyle <loic.coyle@hotmail.fr>2020-02-20 01:10:57 +0100
commit55300aef48335969f5615f44e6ac5e1bf05667ec (patch)
tree4f82eaf1380f7a05ea221c6ae9f21b301ba57753 /tpblite/tpblite.py
parent87155dd4b37234628aebc41fcce123da439b5566 (diff)
downloadtpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.tar.gz
tpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.tar.bz2
tpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.zip
added top
Diffstat (limited to 'tpblite/tpblite.py')
-rw-r--r--tpblite/tpblite.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tpblite/tpblite.py b/tpblite/tpblite.py
index 1ec3991..abd59ae 100644
--- a/tpblite/tpblite.py
+++ b/tpblite/tpblite.py
@@ -61,3 +61,19 @@ class TPB:
q = QueryParser.browse(self.base_url, category, page, order)
self._search_url = q.url
return Torrents(q.html_source)
+
+ def top(self, category: int=0, last_48=False):
+ """Get the top torrents of a category and return a list of Torrents
+
+ Args:
+ category: Restrict search to specific category, for list of categories see
+ tpblite.models.constants.CATEGORIES
+ last_48: wether to fetch the top torrent in the last 48 hours or the overall top
+
+ Return:
+ Torrent object
+ """
+ q = QueryParser.top(self.base_url, category, last_48)
+ self._search_url = q.url
+ return Torrents(q.html_source)
+