Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Speedcd parsing and add pubdate #5190

Merged
merged 3 commits into from
Sep 11, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions medusa/providers/torrent/html/speedcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ def parse(self, data, mode):

:return: A list of items found
"""
# Units
units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']

items = []

with BS4Parser(data, 'html5lib') as html:
Expand All @@ -129,14 +126,14 @@ def parse(self, data, mode):
cells = row('td')

try:
title = cells[1].find('a', class_='torrent').get_text()
title = cells[1].find('a').get_text()
download_url = urljoin(self.url,
cells[2].find(title='Download').parent['href'])
if not all([title, download_url]):
continue

seeders = try_int(cells[5].get_text(strip=True))
leechers = try_int(cells[6].get_text(strip=True))
seeders = try_int(cells[6].get_text(strip=True))
leechers = try_int(cells[7].get_text(strip=True))

# Filter unseeded torrent
if seeders < min(self.minseed, 1):
Expand All @@ -148,15 +145,18 @@ def parse(self, data, mode):

torrent_size = cells[4].get_text()
torrent_size = torrent_size[:-2] + ' ' + torrent_size[-2:]
size = convert_size(torrent_size, units=units) or -1
size = convert_size(torrent_size) or -1

pubdate_raw = cells[1].find('span', class_='elapsedDate').get_text()
pubdate = self.parse_pubdate(pubdate_raw, human_time=True)

item = {
'title': title,
'link': download_url,
'size': size,
'seeders': seeders,
'leechers': leechers,
'pubdate': None,
'pubdate': pubdate,
}
if mode != 'RSS':
log.debug('Found result: {0} with {1} seeders and {2} leechers',
Expand Down