From 4e2d04eca0147396092d2163bd8706fe497a8bf1 Mon Sep 17 00:00:00 2001 From: Matt Lyon Date: Wed, 9 Sep 2020 12:26:33 +0100 Subject: added tests, switched to lxml --- tpblite/models/torrents.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tpblite') diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py index 1c2b32d..4803740 100644 --- a/tpblite/models/torrents.py +++ b/tpblite/models/torrents.py @@ -1,7 +1,5 @@ import unicodedata -from lxml.etree import HTML - -# TODO: write better comments +import lxml.etree as ET def fileSizeStrToInt(size_str): @@ -97,7 +95,7 @@ class Torrents: return self.list[index] def _createTorrentList(self): - root = HTML(self.html_source) + root = ET.HTML(self.html_source) if root.find("body") is None: raise ConnectionError("Could not determine torrents (empty html body)") rows = root.xpath('//tr[td[@class="vertTh"]]') -- cgit v1.2.3