From 4738c4deda67731429d99309ff9754e9cf9e913e Mon Sep 17 00:00:00 2001
From: Russell Heilling <russell@linx.net>
Date: Mon, 18 Jun 2018 11:32:46 +0100
Subject: [PATCH] Do not assume that torrenttable div will be present and well
 formed.

It appears that when there are no search results the <div
id="torrenttable"> element may be missing or incomplete.  To avoid this
causing exceptions in the log, simply treat this as an empty result set.
---
 sickbeard/providers/scenetime.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sickbeard/providers/scenetime.py b/sickbeard/providers/scenetime.py
index d0af1159e..f5a9087dd 100644
--- a/sickbeard/providers/scenetime.py
+++ b/sickbeard/providers/scenetime.py
@@ -100,7 +100,11 @@ class SceneTimeProvider(TorrentProvider):  # pylint: disable=too-many-instance-a
                     continue
 
                 with BS4Parser(data, 'html5lib') as html:
-                    torrent_rows = html.find(id='torrenttable').findAll('tr')
+                    torrent_table = html.find(id='torrenttable')
+                    if torrent_table:
+                        torrent_rows = torrent_table.findAll('tr')
+                    else:
+                        torrent_rows = []
 
                     # Continue only if one Release is found
                     if len(torrent_rows) < 2:
-- 
GitLab