kickass: Fix download URL and support magnets
This commit is contained in:
parent
4b7aa7e9fd
commit
c4213c3c74
1 changed files with 9 additions and 4 deletions
|
|
@ -75,6 +75,7 @@ class TorrentPage(BasePage):
|
||||||
leech = 0
|
leech = 0
|
||||||
description = NotAvailable
|
description = NotAvailable
|
||||||
url = NotAvailable
|
url = NotAvailable
|
||||||
|
magnet = NotAvailable
|
||||||
title = NotAvailable
|
title = NotAvailable
|
||||||
for div in self.document.getiterator('div'):
|
for div in self.document.getiterator('div'):
|
||||||
if div.attrib.get('id', '') == 'desc':
|
if div.attrib.get('id', '') == 'desc':
|
||||||
|
|
@ -97,10 +98,13 @@ class TorrentPage(BasePage):
|
||||||
'h1.torrentName span', 1)
|
'h1.torrentName span', 1)
|
||||||
title = title.text
|
title = title.text
|
||||||
|
|
||||||
for a in self.document.getiterator('a'):
|
for a in self.parser.select(self.document.getroot(),
|
||||||
if ('Download' in a.attrib.get('title', '')) \
|
'div.downloadButtonGroup a'):
|
||||||
and ('torrent file' in a.attrib.get('title', '')):
|
href = a.attrib.get('href', '')
|
||||||
url = a.attrib.get('href', '')
|
if href.startswith('magnet'):
|
||||||
|
magnet = href
|
||||||
|
elif href.startswith('//') or href.startswith('http'):
|
||||||
|
url = href
|
||||||
|
|
||||||
size = 0
|
size = 0
|
||||||
u = ''
|
u = ''
|
||||||
|
|
@ -123,6 +127,7 @@ class TorrentPage(BasePage):
|
||||||
torrent.url = url
|
torrent.url = url
|
||||||
if torrent.url:
|
if torrent.url:
|
||||||
torrent.filename = parse_qs(urlsplit(url).query).get('title', [None])[0]
|
torrent.filename = parse_qs(urlsplit(url).query).get('title', [None])[0]
|
||||||
|
torrent.magnet = magnet
|
||||||
torrent.size = get_bytes_size(size, u)
|
torrent.size = get_bytes_size(size, u)
|
||||||
torrent.seeders = int(seed)
|
torrent.seeders = int(seed)
|
||||||
torrent.leechers = int(leech)
|
torrent.leechers = int(leech)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue