From e9e1c637b95f609a3053c243f2f5837d5214f3c0 Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Sat, 22 Aug 2020 18:46:58 +0200 Subject: add url attribute to Torrent --- tpblite/models/torrents.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tpblite/models') diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py index ada282f..5145289 100644 --- a/tpblite/models/torrents.py +++ b/tpblite/models/torrents.py @@ -33,6 +33,7 @@ class Torrent: self._getFileInfo() ) self.magnetlink = self._getMagnetLink() + self.url = self._getUrl() def __str__(self): return "{0}, S: {1}, L: {2}, {3}".format( @@ -63,10 +64,14 @@ class Torrent: uploader = unicodedata.normalize("NFKD", t[2].replace("ULed by ", "").strip()) return uptime, size, byte_size, uploader + def _getUrl(self): + tag = self.html_row.find("a", class_="detLink") + return tag.get("href") + class Torrents: """ - Torrent object, takes query response and parses into + Torrent object, takes query response and parses into torrent list or dict. Has methods to select items from torrent list. """ -- cgit v1.2.3