From 46101cdc039c8ff0f90145e78628dd5c0235529b Mon Sep 17 00:00:00 2001 From: Uri Goldberg Date: Sun, 8 Nov 2020 17:27:09 -0600 Subject: Added functionality for knowing which torrents are from trusted or VIP sources --- tpblite/models/torrents.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tpblite') diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py index 4803740..38e8149 100644 --- a/tpblite/models/torrents.py +++ b/tpblite/models/torrents.py @@ -34,6 +34,8 @@ class Torrent: ) = self._getFileInfo() self.magnetlink = self._getMagnetLink() self.url = self._getUrl() + self.is_vip = self._getVip() + self.is_trusted = self._getTrusted() def __str__(self): return "{0}, S: {1}, L: {2}, {3}".format( @@ -67,6 +69,17 @@ class Torrent: tag = self.html_row.find('.//a[@class="detLink"]') return tag.get("href") + def _getVip(self): + image_name = self.html_row.xpath('.//img/@src')[1] + print('shalom') + print(image_name) + return 'vip' in image_name + + def _getTrusted(self): + image_name = self.html_row.xpath('.//img/@src')[1] + print(image_name) + return 'trusted' in image_name + class Torrents: """ -- cgit v1.2.3