aboutsummaryrefslogtreecommitdiffstats
path: root/tpblite/models/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tpblite/models/utils.py')
-rw-r--r--tpblite/models/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tpblite/models/utils.py b/tpblite/models/utils.py
index 6c479d4..b9126e9 100644
--- a/tpblite/models/utils.py
+++ b/tpblite/models/utils.py
@@ -42,6 +42,16 @@ 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 category == 0:
+ category = "all"
+ 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()