Fixes in NZBIndex spider

master
Sven Slootweg 11 years ago
parent d14d4ea9cb
commit 696d4f1c6e

@ -26,30 +26,31 @@ class NzbindexSpider(object):
search_results = [] search_results = []
results = re.findall("<tr[^>]+>(.*?)<\/tr>", response.text, re.DOTALL) results = re.findall("<tr[^>]*>(.*?)<\/tr>", response.text, re.DOTALL)
for result in results: for result in results:
if 'class="threat"' in result: if 'class="threat"' in result:
# Password protected or otherwise unsuitable for download # Password protected or otherwise unsuitable for download
continue continue
match = re.search("<label[^>]+>(.*?)<\/label>", result, re.DOTALL) match = re.search("<label[^>]*>(.*?)<\/label>", result, re.DOTALL)
if match is None: if match is None:
continue continue
title = parser.unescape(re.sub("<[^>]+>", "", match.group(1))) title = parser.unescape(re.sub("<[^>]*>", "", match.group(1)))
if name.lower() in title.lower(): if name.lower() in title.lower():
match = re.search('https?:\/\/nzbindex\.com\/download\/[^"]+\.nzb', result) match = re.search('https?:\/\/nzbindex\.com\/download\/[^"]+\.nzb', result)
if match is not None: if match is not None:
search_results.append(NzbindexResult(title, match.group(0))) search_results.append(NzbindexResult(title, match.group(0), self))
if len(search_results) == 0: if len(search_results) == 0:
raise NotFoundException("No results were found.") raise NotFoundException("No results were found.")
return search_results return search_results
class NzbindexResult(object): class NzbindexResult(object):
def __init__(self, title, url, spider): def __init__(self, title, url, spider):
self.title = title self.title = title

Loading…
Cancel
Save