[kickass] size span detection improved (fixes #497)
This commit is contained in:
parent
23009fe4a9
commit
bef9ac5fd7
1 changed files with 13 additions and 5 deletions
|
|
@ -72,10 +72,16 @@ class TorrentPage(BasePage):
|
||||||
for ch in div.getchildren():
|
for ch in div.getchildren():
|
||||||
if ch.tail != None:
|
if ch.tail != None:
|
||||||
description += ' '+ch.tail.strip()
|
description += ' '+ch.tail.strip()
|
||||||
if div.attrib.get('class', '') == 'seedBlock':
|
elif div.attrib.get('class', '') == 'seedBlock':
|
||||||
seed = int(div.getchildren()[1].text)
|
if div.getchildren()[1].text != None:
|
||||||
if div.attrib.get('class', '') == 'leechBlock':
|
seed = int(div.getchildren()[1].text)
|
||||||
leech = int(div.getchildren()[1].text)
|
else:
|
||||||
|
seed = 0
|
||||||
|
elif div.attrib.get('class', '') == 'leechBlock':
|
||||||
|
if div.getchildren()[1].text != None:
|
||||||
|
leech = int(div.getchildren()[1].text)
|
||||||
|
else:
|
||||||
|
leech = 0
|
||||||
|
|
||||||
for h in self.document.getiterator('h1'):
|
for h in self.document.getiterator('h1'):
|
||||||
if h.attrib.get('class', '') == 'torrentName':
|
if h.attrib.get('class', '') == 'torrentName':
|
||||||
|
|
@ -87,7 +93,9 @@ class TorrentPage(BasePage):
|
||||||
|
|
||||||
size = 0
|
size = 0
|
||||||
for span in self.document.getiterator('span'):
|
for span in self.document.getiterator('span'):
|
||||||
if span.attrib.get('class', '') == 'folder' or span.attrib.get('class', '') == 'folderopen':
|
# sometimes there are others span, this is not so sure but the size of the children list
|
||||||
|
# is enough to know if this is the right span
|
||||||
|
if (span.attrib.get('class', '') == 'folder' or span.attrib.get('class', '') == 'folderopen') and len(span.getchildren())>2:
|
||||||
size = span.getchildren()[1].tail
|
size = span.getchildren()[1].tail
|
||||||
u = span.getchildren()[2].text
|
u = span.getchildren()[2].text
|
||||||
size = float(size.split(': ')[1].replace(',', '.'))
|
size = float(size.split(': ')[1].replace(',', '.'))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue