From 5e52449e21d1dc296a3c7c9b854ea6136d51196e Mon Sep 17 00:00:00 2001
From: h3llrais3r <pooh_beer_1@hotmail.com>
Date: Fri, 5 May 2017 07:02:02 +0200
Subject: [PATCH] Fallback to magnet links for HorribleSubsProvider (#3712)

---
 sickbeard/providers/horriblesubs.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sickbeard/providers/horriblesubs.py b/sickbeard/providers/horriblesubs.py
index b6b121ac3..5aa337357 100755
--- a/sickbeard/providers/horriblesubs.py
+++ b/sickbeard/providers/horriblesubs.py
@@ -93,8 +93,13 @@ class HorribleSubsProvider(TorrentProvider):  # pylint: disable=too-many-instanc
                             label = torrent_row.find('td', class_='dl-label')
                             title = label.get_text(strip=True)
 
-                            torrent_link = torrent_row.find('td', class_='hs-torrent-link')
-                            download_url = torrent_link.find('a')['href'] if torrent_link else None
+                            link = torrent_row.find('td', class_='hs-torrent-link')
+                            download_url = link.find('a')['href'] if link and link.find('a') else None
+
+                            if not download_url:
+                                # fallback to magnet link
+                                link = torrent_row.find('td', class_='hs-magnet-link')
+                                download_url = link.find('a')['href'] if link and link.find('a') else None
 
                         except StandardError:
                             continue
-- 
GitLab