fix piratebay small sizes

This commit is contained in:
Julien Veyssier 2010-12-05 18:44:44 +01:00
commit bd12ead317

View file

@ -26,7 +26,8 @@ __all__ = ['TorrentsPage']
class TorrentsPage(BasePage): class TorrentsPage(BasePage):
def unit(self, n, u): def unit(self, n, u):
m = {'KB': 1024, m = {'B': 1,
'KB': 1024,
'MB': 1024*1024, 'MB': 1024*1024,
'GB': 1024*1024*1024, 'GB': 1024*1024*1024,
'TB': 1024*1024*1024*1024, 'TB': 1024*1024*1024*1024,
@ -51,10 +52,9 @@ class TorrentsPage(BasePage):
a = td.getchildren()[1] a = td.getchildren()[1]
url = a.attrib['href'] url = a.attrib['href']
size = td.find('font').text.split(',')[1] size = td.find('font').text.split(',')[1].strip()
size = size.split(' ')[2] u = size.split(' ')[1].split(u'\xa0')[1].replace('i','')
u = size[-3:].replace('i','') size = size.split(' ')[1].split(u'\xa0')[0]
size = size[:-3]
seed = tr.getchildren()[2].text seed = tr.getchildren()[2].text
leech = tr.getchildren()[3].text leech = tr.getchildren()[3].text