[isohunt].rock()

This commit is contained in:
Julien Veyssier 2010-11-28 21:59:40 +01:00
commit fb7374c83e

View file

@ -77,7 +77,6 @@ class TorrentPage(BasePage):
def get_torrent(self, id): def get_torrent(self, id):
title = '' title = ''
description = 'No description'
url = 'https://isohunt.com/download/%s/%s.torrent' % (id , id) url = 'https://isohunt.com/download/%s/%s.torrent' % (id , id)
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',''):
@ -85,9 +84,23 @@ class TorrentPage(BasePage):
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]
break tip_id = span.attrib.get('onmouseover','').split("'")[1]
leech = 0 for div in self.document.getiterator('div'):
# 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',''):
leech = div.getchildren()[0].getchildren()[1].tail.split(' ')[2]
# the <b> with the size in it doesn't have a distinction
# have to get it by higher
elif div.attrib.get('id','') == 'torrent_details':
size = div.getchildren()[6].getchildren()[0].getchildren()[0].text
u = size[-2:]
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)
description = 'No description'
files = [] files = []
count_p_found = 0 count_p_found = 0
for p in self.document.getiterator('p'): for p in self.document.getiterator('p'):
@ -101,26 +114,17 @@ class TorrentPage(BasePage):
else: else:
files.append(p.getchildren()[0].tail.strip()) files.append(p.getchildren()[0].tail.strip())
# TODO marche pas
for td in self.document.getiterator('td'): for td in self.document.getiterator('td'):
print td.attrib.get('class') #print td.attrib.get('class')
if td.attrib.get('class','') == 'fileRows': if td.attrib.get('class','') == 'fileRows':
#files.append(td.text)
filename = td.text filename = td.text
print "len"+str(len(td.getchildren())) #print "len"+str(len(td.getchildren()))
for slash in td.getchildren(): for slash in td.getchildren():
filename += '/' filename += '/'
filename += slash.tail filename += slash.tail
files.append(filename) files.append(filename)
# TODO leechers
size = 0
u = 'MB'
#--------------------------TODO #--------------------------TODO
torrent = Torrent(id, title) torrent = Torrent(id, title)