fixes for other gazelle websites
This commit is contained in:
parent
e4b7f8ba29
commit
4befb4482e
1 changed files with 16 additions and 6 deletions
|
|
@ -84,8 +84,16 @@ class TorrentsPage(BasePage):
|
||||||
title = tds[i].find('a').text
|
title = tds[i].find('a').text
|
||||||
url = urlparse.urlparse(tds[i].find('a').attrib['href'])
|
url = urlparse.urlparse(tds[i].find('a').attrib['href'])
|
||||||
params = urlparse.parse_qs(url.query)
|
params = urlparse.parse_qs(url.query)
|
||||||
id = '%s.%s' % (params['id'][0], params['torrentid'][0])
|
if 'torrentid' in params:
|
||||||
size = self.unit(*tds[i+3].text.split())
|
id = '%s.%s' % (params['id'][0], params['torrentid'][0])
|
||||||
|
else:
|
||||||
|
url = tds[i].find('span').find('a').attrib['href']
|
||||||
|
m = self.TORRENTID_REGEXP.match(url)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
id = '%s.%s' % (params['id'][0], m.group(1))
|
||||||
|
size, unit = tds[i+3].text.split()
|
||||||
|
size = get_bytes_size(float(size), unit)
|
||||||
seeders = int(tds[-2].text)
|
seeders = int(tds[-2].text)
|
||||||
leechers = int(tds[-1].text)
|
leechers = int(tds[-1].text)
|
||||||
|
|
||||||
|
|
@ -111,7 +119,10 @@ class TorrentsPage(BasePage):
|
||||||
title = self.browser.parser.select(table, 'div.title_text', 1).text
|
title = self.browser.parser.select(table, 'div.title_text', 1).text
|
||||||
|
|
||||||
torrent = Torrent(id, title)
|
torrent = Torrent(id, title)
|
||||||
torrentid = id.split('.', 1)[1]
|
if '.' in id:
|
||||||
|
torrentid = id.split('.', 1)[1]
|
||||||
|
else:
|
||||||
|
torrentid = id
|
||||||
table = self.browser.parser.select(self.document.getroot(), 'table.torrent_table')
|
table = self.browser.parser.select(self.document.getroot(), 'table.torrent_table')
|
||||||
if len(table) == 0:
|
if len(table) == 0:
|
||||||
table = self.browser.parser.select(self.document.getroot(), 'div.main_column', 1)
|
table = self.browser.parser.select(self.document.getroot(), 'div.main_column', 1)
|
||||||
|
|
@ -149,7 +160,6 @@ class TorrentsPage(BasePage):
|
||||||
warning('ID not found')
|
warning('ID not found')
|
||||||
continue
|
continue
|
||||||
if m.group(1) != torrentid:
|
if m.group(1) != torrentid:
|
||||||
print
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
torrent.url = self.format_url(url)
|
torrent.url = self.format_url(url)
|
||||||
|
|
@ -160,7 +170,7 @@ class TorrentsPage(BasePage):
|
||||||
break
|
break
|
||||||
|
|
||||||
if not torrent.url:
|
if not torrent.url:
|
||||||
warning('Torrent %d not found in list' % torrentid)
|
warning('Torrent %s not found in list' % torrentid)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
div = self.parser.select(self.document.getroot(), 'div.main_column', 1)
|
div = self.parser.select(self.document.getroot(), 'div.main_column', 1)
|
||||||
|
|
@ -184,7 +194,7 @@ class TorrentsPage(BasePage):
|
||||||
torrent.description = u''
|
torrent.description = u''
|
||||||
torrent.description += u'%s\n\n%s\n' % (title, body)
|
torrent.description += u'%s\n\n%s\n' % (title, body)
|
||||||
|
|
||||||
div = self.document.getroot().cssselect('div#files_%s,div#filelist_%s' % (torrentid, torrentid))
|
div = self.document.getroot().cssselect('div#files_%s,div#filelist_%s,tr#torrent_%s td' % (torrentid, torrentid, torrentid))
|
||||||
if div:
|
if div:
|
||||||
torrent.files = []
|
torrent.files = []
|
||||||
for tr in div[0].find('table'):
|
for tr in div[0].find('table'):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue