aboutsummaryrefslogtreecommitdiffstats
path: root/tpblite/models/utils.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/models/utils.py
parent87155dd4b37234628aebc41fcce123da439b5566 (diff)
downloadtpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.tar.gz
tpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.tar.bz2
tpb-lite-55300aef48335969f5615f44e6ac5e1bf05667ec.zip
added top
Diffstat (limited to 'tpblite/models/utils.py')
-rw-r--r--tpblite/models/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tpblite/models/utils.py b/tpblite/models/utils.py
index 6c479d4..8043707 100644
--- a/tpblite/models/utils.py
+++ b/tpblite/models/utils.py
@@ -42,6 +42,14 @@ class QueryParser:
segments = ("browse", str(category), str(page), str(order), "0")
return cls(base_url, segments)
+ @classmethod
+ def top(cls: Type[T], base_url: str, category: int, last_48: bool) -> T:
+ if last_48:
+ segments = ("top", '48h' + str(category))
+ else:
+ segments = ("top", str(category))
+ return cls(base_url, segments)
+
def _sendRequest(self):
req = Request(self.url, headers=headers())
return urlopen(req).read()