simplify and factorize code, remove dead code, follow conventions, use new-style classes
This commit is contained in:
parent
55a1574df5
commit
f1b3264a67
28 changed files with 202 additions and 251 deletions
|
|
@ -30,24 +30,19 @@ class IsohuntBrowser(BaseBrowser):
|
|||
ENCODING = 'utf-8'
|
||||
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
|
||||
PAGES = {
|
||||
'https://isohunt.com/torrents/.*iht=-1&ihp=1&ihs1=2&iho1=d' : TorrentsPage,
|
||||
'https://isohunt.com/torrent_details.*tab=summary' : TorrentPage
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
'https://isohunt.com/torrents/.*iht=-1&ihp=1&ihs1=2&iho1=d' : TorrentsPage,
|
||||
'https://isohunt.com/torrent_details.*tab=summary' : TorrentPage,
|
||||
}
|
||||
|
||||
def home(self):
|
||||
return self.location('https://isohunt.com')
|
||||
|
||||
def iter_torrents(self, pattern):
|
||||
self.location('https://isohunt.com/torrents/%s?iht=-1&ihp=1&ihs1=2&iho1=d' % pattern)
|
||||
|
||||
assert self.is_on_page(TorrentsPage)
|
||||
return self.page.iter_torrents()
|
||||
|
||||
def get_torrent(self, id):
|
||||
self.location('https://isohunt.com/torrent_details/%s/?tab=summary' % id)
|
||||
|
||||
assert self.is_on_page(TorrentPage)
|
||||
return self.page.get_torrent(id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue