[isohunt] corrected (closes #529), the site doesn't provide seed information on info page anymore
This commit is contained in:
parent
460f9a423c
commit
ac7274cafd
2 changed files with 17 additions and 16 deletions
|
|
@ -30,7 +30,7 @@ class IsohuntBrowser(BaseBrowser):
|
||||||
ENCODING = 'utf-8'
|
ENCODING = 'utf-8'
|
||||||
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
|
USER_AGENT = BaseBrowser.USER_AGENTS['wget']
|
||||||
PAGES = {
|
PAGES = {
|
||||||
'https://isohunt.com/torrents/.*iht=-1&ihp=1&ihs1=2&iho1=d' : TorrentsPage,
|
'https://isohunt.com/torrents/.*iht=-1&ihp=1&ihs1=1&iho1=d' : TorrentsPage,
|
||||||
'https://isohunt.com/torrent_details.*tab=summary' : TorrentPage,
|
'https://isohunt.com/torrent_details.*tab=summary' : TorrentPage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class IsohuntBrowser(BaseBrowser):
|
||||||
return self.location('https://isohunt.com')
|
return self.location('https://isohunt.com')
|
||||||
|
|
||||||
def iter_torrents(self, pattern):
|
def iter_torrents(self, pattern):
|
||||||
self.location('https://isohunt.com/torrents/%s?iht=-1&ihp=1&ihs1=2&iho1=d' % pattern)
|
self.location('https://isohunt.com/torrents/%s?iht=-1&ihp=1&ihs1=1&iho1=d' % pattern)
|
||||||
assert self.is_on_page(TorrentsPage)
|
assert self.is_on_page(TorrentsPage)
|
||||||
return self.page.iter_torrents()
|
return self.page.iter_torrents()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,23 +63,23 @@ class TorrentPage(BasePage):
|
||||||
for a in self.document.getiterator('a'):
|
for a in self.document.getiterator('a'):
|
||||||
if 'Search more torrents of' in a.attrib.get('title', ''):
|
if 'Search more torrents of' in a.attrib.get('title', ''):
|
||||||
title = a.tail
|
title = a.tail
|
||||||
|
seed = -1
|
||||||
|
leech = -1
|
||||||
|
tip_id = "none"
|
||||||
for span in self.document.getiterator('span'):
|
for span in self.document.getiterator('span'):
|
||||||
if span.attrib.get('style', '') == 'color:green;' and ('ShowTip' in span.attrib.get('onmouseover', '')):
|
if span.attrib.get('style', '') == 'color:green;' and ('ShowTip' in span.attrib.get('onmouseover', '')):
|
||||||
seed = span.tail.split(' ')[1]
|
seed = span.tail.split(' ')[1]
|
||||||
tip_id = span.attrib.get('onmouseover', '').split("'")[1]
|
tip_id = span.attrib.get('onmouseover', '').split("'")[1]
|
||||||
for div in self.document.getiterator('div'):
|
for div in self.document.getiterator('div'):
|
||||||
# find the corresponding super tip which appears on super mouse hover!
|
# find the corresponding super tip which appears on super mouse hover!
|
||||||
if div.attrib.get('class', '') == 'dirs ydsf' and tip_id in div.attrib.get('id', ''):
|
if div.attrib.get('class', '') == 'dirs ydsf' and tip_id in div.attrib.get('id', ''):
|
||||||
leech = div.getchildren()[0].getchildren()[1].tail.split(' ')[2]
|
leech = div.getchildren()[0].getchildren()[1].tail.split(' ')[2]
|
||||||
# the <b> with the size in it doesn't have a distinction
|
# the <b> with the size in it doesn't have a distinction
|
||||||
# have to get it by higher
|
# have to get it by higher
|
||||||
elif div.attrib.get('id', '') == 'torrent_details':
|
elif div.attrib.get('id', '') == 'torrent_details':
|
||||||
size = div.getchildren()[6].getchildren()[0].getchildren()[0].text
|
size = div.getchildren()[6].getchildren()[0].getchildren()[0].text
|
||||||
u = size[-2:]
|
u = size[-2:]
|
||||||
size = float(size[:-3])
|
size = float(size[:-3])
|
||||||
|
|
||||||
# all the thing we get in that loop are unique, no need to go on looping
|
|
||||||
break
|
|
||||||
|
|
||||||
# files and description (uploader's comment)
|
# files and description (uploader's comment)
|
||||||
description = 'No description'
|
description = 'No description'
|
||||||
|
|
@ -89,7 +89,8 @@ class TorrentPage(BasePage):
|
||||||
if p.attrib.get('style', '') == 'line-height:1.2em;margin-top:1.8em':
|
if p.attrib.get('style', '') == 'line-height:1.2em;margin-top:1.8em':
|
||||||
count_p_found += 1
|
count_p_found += 1
|
||||||
if count_p_found == 1:
|
if count_p_found == 1:
|
||||||
description = p.getchildren()[1].tail
|
if p.getchildren()[1].tail != None:
|
||||||
|
description = p.getchildren()[1].tail
|
||||||
if count_p_found == 2:
|
if count_p_found == 2:
|
||||||
if p.getchildren()[0].text == 'Directory:':
|
if p.getchildren()[0].text == 'Directory:':
|
||||||
files.append(p.getchildren()[0].tail.strip()+'/')
|
files.append(p.getchildren()[0].tail.strip()+'/')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue