1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Cleaned up NyaaTorrents search code and fixed unicode issues.

This commit is contained in:
echel0n 2014-07-24 01:33:38 -07:00
parent a697805923
commit 161226180f

View File

@ -80,29 +80,28 @@ class NyaaProvider(generic.TorrentProvider):
logger.log(u"Search string: " + searchURL, logger.DEBUG)
data = self.cache.getRSSFeed(searchURL)
if not data:
logger.log(u"Error trying to load NyaaTorrents RSS feed: " + searchURL, logger.ERROR)
logger.log(u"RSS data: " + data, logger.DEBUG)
return []
items = data.entries
if 'entries' in data:
items = data.entries
results = []
results = []
for curItem in items:
for curItem in items:
(title, url) = self._get_title_and_url(curItem)
(title, url) = self._get_title_and_url(curItem)
if not title or not url:
logger.log(
u"The XML returned from the NyaaTorrents RSS feed is incomplete, this result is unusable: " + data,
logger.ERROR)
continue
if title and url:
results.append(curItem)
else:
logger.log(
u"The data returned from the " + self.name + " is incomplete, this result is unusable",
logger.DEBUG)
results.append(curItem)
return results
return results
return []
def _get_title_and_url(self, item):