From 696d4f1c6e513ff9ab2584769b2fdf939598804e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 30 Jun 2013 15:36:32 +0200 Subject: [PATCH] Fixes in NZBIndex spider --- sources/nzbindex.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/nzbindex.py b/sources/nzbindex.py index 509170f..9d4f427 100644 --- a/sources/nzbindex.py +++ b/sources/nzbindex.py @@ -26,30 +26,31 @@ class NzbindexSpider(object): search_results = [] - results = re.findall("]+>(.*?)<\/tr>", response.text, re.DOTALL) + results = re.findall("]*>(.*?)<\/tr>", response.text, re.DOTALL) for result in results: if 'class="threat"' in result: # Password protected or otherwise unsuitable for download continue - match = re.search("]+>(.*?)<\/label>", result, re.DOTALL) + match = re.search("]*>(.*?)<\/label>", result, re.DOTALL) if match is None: continue - title = parser.unescape(re.sub("<[^>]+>", "", match.group(1))) + title = parser.unescape(re.sub("<[^>]*>", "", match.group(1))) if name.lower() in title.lower(): match = re.search('https?:\/\/nzbindex\.com\/download\/[^"]+\.nzb', result) 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: raise NotFoundException("No results were found.") return search_results + class NzbindexResult(object): def __init__(self, title, url, spider): self.title = title