From 55300aef48335969f5615f44e6ac5e1bf05667ec Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Thu, 20 Feb 2020 01:10:57 +0100 Subject: added top --- tpblite/models/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tpblite/models/utils.py') 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() -- cgit v1.2.3 From 85adf1b1126de2091828d5ed0309d037e66b3232 Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Sat, 22 Aug 2020 03:37:04 +0200 Subject: add 0 check --- tpblite/models/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tpblite/models/utils.py') diff --git a/tpblite/models/utils.py b/tpblite/models/utils.py index 8043707..b9126e9 100644 --- a/tpblite/models/utils.py +++ b/tpblite/models/utils.py @@ -44,8 +44,10 @@ class QueryParser: @classmethod def top(cls: Type[T], base_url: str, category: int, last_48: bool) -> T: + if category == 0: + category = "all" if last_48: - segments = ("top", '48h' + str(category)) + segments = ("top", "48h" + str(category)) else: segments = ("top", str(category)) return cls(base_url, segments) -- cgit v1.2.3