aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt <32886639+mattlyon93@users.noreply.github.com>2020-11-09 22:43:58 +0000
committerGitHub <noreply@github.com>2020-11-09 22:43:58 +0000
commitc380ebc0187a5cdda64702ef6d84ec2117eb0a8c (patch)
treeaf78a1858fe10feb95d430f946667c0fc947ad4c
parent92bd0c22026cabd72b32194520ff7d810823b81a (diff)
parent82bfbfeff606b7b56b8cade227389f1e5b2d1168 (diff)
downloadtpb-lite-c380ebc0187a5cdda64702ef6d84ec2117eb0a8c.tar.gz
tpb-lite-c380ebc0187a5cdda64702ef6d84ec2117eb0a8c.tar.bz2
tpb-lite-c380ebc0187a5cdda64702ef6d84ec2117eb0a8c.zip
Merge pull request #10 from klaymond/is-vip
Added functionality to know whether a Torrent comes from trusted or VIP source
-rw-r--r--tpblite/models/torrents.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py
index 4803740..3d6fc10 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,14 @@ 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]
+ return 'vip' in image_name
+
+ def _getTrusted(self):
+ image_name = self.html_row.xpath('.//img/@src')[1]
+ return 'trusted' in image_name
+
class Torrents:
"""