From 40cf9fa062ab84d1db9ae56168c6c1bc19dec219 Mon Sep 17 00:00:00 2001
From: Kfir Hadas <sharkykh@gmail.com>
Date: Wed, 24 May 2017 11:42:40 +0300
Subject: [PATCH] Nyaa RSS update (#3793)

* Update keys based on latest RSS template

https://github.com/nyaadevs/nyaa/pull/140

* Flip and add comment
---
 sickbeard/providers/nyaa.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sickbeard/providers/nyaa.py b/sickbeard/providers/nyaa.py
index ad438d55e..e10323457 100644
--- a/sickbeard/providers/nyaa.py
+++ b/sickbeard/providers/nyaa.py
@@ -80,10 +80,16 @@ class NyaaProvider(TorrentProvider):  # pylint: disable=too-many-instance-attrib
                         if not all([title, download_url]):
                             continue
 
-                        seeders = try_int(curItem['seeders'])
-                        leechers = try_int(curItem['leechers'])
-                        torrent_size = curItem['size']
-                        info_hash = curItem['infohash']
+                        try:
+                            seeders = try_int(curItem['nyaa:seeders'])
+                            leechers = try_int(curItem['nyaa:leechers'])
+                            torrent_size = curItem['nyaa:size']
+                            info_hash = curItem['nyaa:infohash']
+                        except KeyError: # Transition phase because of https://github.com/nyaadevs/nyaa/pull/140
+                            seeders = try_int(curItem['seeders'])
+                            leechers = try_int(curItem['leechers'])
+                            torrent_size = curItem['size']
+                            info_hash = curItem['infohash']
 
                         if seeders < self.minseed or leechers < self.minleech:
                             if mode != 'RSS':
-- 
GitLab