diff options
author | mattlyon93 <matthewlyon18@gmail.com> | 2019-11-03 12:29:00 +1100 |
---|---|---|
committer | mattlyon93 <matthewlyon18@gmail.com> | 2019-11-03 12:29:00 +1100 |
commit | a3fa73495141fc240ea0ad9b54d7a2882264db20 (patch) | |
tree | ba17da28c7209d4a667e9d34e180199c6aed61ab /tpblite/models | |
parent | 612087fd74b849525c32dfc4033603808b0c2433 (diff) | |
download | tpb-lite-a3fa73495141fc240ea0ad9b54d7a2882264db20.tar.gz tpb-lite-a3fa73495141fc240ea0ad9b54d7a2882264db20.tar.bz2 tpb-lite-a3fa73495141fc240ea0ad9b54d7a2882264db20.zip |
improvements to TPB controller and Query
Diffstat (limited to 'tpblite/models')
-rw-r--r-- | tpblite/models/torrents.py | 6 | ||||
-rw-r--r-- | tpblite/models/utils.py | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tpblite/models/torrents.py b/tpblite/models/torrents.py index 9fd40c4..7852c28 100644 --- a/tpblite/models/torrents.py +++ b/tpblite/models/torrents.py @@ -63,8 +63,8 @@ class Torrents(object): torrent list or dict. Has methods to select items from torrent list. ''' - def __init__(self, webpage): - self.webpage = webpage + def __init__(self, html_source): + self.html_source = html_source self.list = self._createTorrentList() def __str__(self): @@ -74,7 +74,7 @@ class Torrents(object): return iter(self.list) def _createTorrentList(self): - soup = BeautifulSoup(self.webpage, features='html.parser') + soup = BeautifulSoup(self.html_source, features='html.parser') rows = self.__getRows(soup) torrents = [] for row in rows: diff --git a/tpblite/models/utils.py b/tpblite/models/utils.py index 977672b..200982f 100644 --- a/tpblite/models/utils.py +++ b/tpblite/models/utils.py @@ -10,9 +10,10 @@ class Query(object): ''' def __init__(self, query, base_url, page, order, category): self.base_url = base_url + print('category is {} {}'.format(category,str(category))) segments = ('search', query, str(page), str(order), str(category)) self.url = URL(base_url, segments) - self.webpage = self._sendRequest() + self.html_source = self._sendRequest() def _sendRequest(self): req = Request(self.url, headers=headers()) |