Repository: pymedusa/Medusa

Issue:
Torrent file content is empty
**Describe the bug**

I installed the hotfix 0.3.3 and i still get this error
Torrent file content is empty: The.100.S06E05.The.Gospel.of.Josephine.1080p.AMZN.WEBRip.x265.DDP.5.1.D0ct0rLew[SEV

I'm using jackett with 1337x.to

**Medusa 0.3.3
 - OS: [e.g. ubuntu 18.04 x86_64
 - Branch: master
 - Commit: 4d4a63c850b583017e3cce56c819ac49d0ce5e35
 - Python version: 3.7.3
 - Database version: 44.14

**Debug logs (at least 50 lines):**

`2019-06-12 23:43:53 WARNING	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Torrent file content is empty: The.100.S06E05.The.Gospel.of.Josephine.1080p.AMZN.WEBRip.x265.DDP.5.1.D0ct0rLew[SEV
2019-06-12 23:43:53 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Error requesting url http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV Error: No connection adapters were found for 'magnet:?xt=urn:btih:9DB4C2B604D920517ECF8CB4413E07364430B941&dn=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV&tr=http:%2F%2Ftracker3.itzmx.com:6961%2Fannounce&tr=udp:%2F%2Ftracker.leechers-paradise.org:6969%2Fannounce&tr=udp:%2F%2Ftracker.coppersurfer.tk:6969%2Fannounce&tr=udp:%2F%2Ftracker.internetwarriors.net:1337%2Fannounce&tr=udp:%2F%2Ftracker.opentrackr.org:1337%2Fannounce&tr=udp:%2F%2Fexodus.desync.com:6969%2Fannounce&tr=udp:%2F%2Fexplodie.org:6969%2Fannounce&tr=udp:%2F%2Ftracker.torrent.eu.org:451%2Fannounce&tr=udp:%2F%2Ftracker.cyberia.is:6969%2Fannounce&tr=udp:%2F%2Fthetracker.org:80%2Fannounce&tr=udp:%2F%2Fopen.demonii.si:1337%2Fannounce&tr=udp:%2F%2Fipv4.tracker.harry.lu:80%2Fannounce&tr=udp:%2F%2Fdenis.stalker.upeer.me:6969%2Fannounce&tr=udp:%2F%2Fretracker.lanta-net.ru:2710%2Fannounce&tr=udp:%2F%2Ftracker.zer0day.to:1337%2Fannounce&tr=udp:%2F%2Ftracker.leechers-paradise.org:6969%2Fannounce&tr=udp:%2F%2Fcoppersurfer.tk:6969%2Fannounce'
2019-06-12 23:43:53 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] User-Agent: Medusa/0.3.3 (Linux; 4.14.120-160; c13aa6be-8d58-11e9-bc18-001e06308ec7)
2019-06-12 23:43:53 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] GET URL: http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV [Status: 302]
2019-06-12 23:43:52 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Unable to retrieve redirect URL for http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV
2019-06-12 23:43:52 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Error requesting url http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV Error: No connection adapters were found for 'magnet:?xt=urn:btih:9DB4C2B604D920517ECF8CB4413E07364430B941&dn=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV&tr=http:%2F%2Ftracker3.itzmx.com:6961%2Fannounce&tr=udp:%2F%2Ftracker.leechers-paradise.org:6969%2Fannounce&tr=udp:%2F%2Ftracker.coppersurfer.tk:6969%2Fannounce&tr=udp:%2F%2Ftracker.internetwarriors.net:1337%2Fannounce&tr=udp:%2F%2Ftracker.opentrackr.org:1337%2Fannounce&tr=udp:%2F%2Fexodus.desync.com:6969%2Fannounce&tr=udp:%2F%2Fexplodie.org:6969%2Fannounce&tr=udp:%2F%2Ftracker.torrent.eu.org:451%2Fannounce&tr=udp:%2F%2Ftracker.cyberia.is:6969%2Fannounce&tr=udp:%2F%2Fthetracker.org:80%2Fannounce&tr=udp:%2F%2Fopen.demonii.si:1337%2Fannounce&tr=udp:%2F%2Fipv4.tracker.harry.lu:80%2Fannounce&tr=udp:%2F%2Fdenis.stalker.upeer.me:6969%2Fannounce&tr=udp:%2F%2Fretracker.lanta-net.ru:2710%2Fannounce&tr=udp:%2F%2Ftracker.zer0day.to:1337%2Fannounce&tr=udp:%2F%2Ftracker.leechers-paradise.org:6969%2Fannounce&tr=udp:%2F%2Fcoppersurfer.tk:6969%2Fannounce'
2019-06-12 23:43:52 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] User-Agent: Medusa/0.3.3 (Linux; 4.14.120-160; c13aa6be-8d58-11e9-bc18-001e06308ec7)
2019-06-12 23:43:52 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] GET URL: http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV [Status: 302]
2019-06-12 23:43:52 DEBUG	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Retrieving redirect URL for http://192.168.178.238:9117/dl/1337x/?jackett_apikey=**********&path=Q2ZESjhOaTJQNUoyUkJGS3BkbGpNcjRpSXVGazVEWF9MQ3VoSjBPRGJpT25laXlyRFZqcExIc19jb0g2R1EwY3JtSTk1Q2RWbEdob2daNEJHMzAtWHdwU3EzempIcFV0Y29ZejExaXBkaUczWDBGVkNRYW1jMUsxd0xjekZ2LVRUY2RoVnpCaVVjQWFRWEtPTzJZZUllY2FtSS1rSk5TbTRwSFNXWTlHemtXVWkwRl9YbWs3MDdlc3VfM0JLQnBadWYweF9jam5CR2FSZHdveXYtOGJWTTNLcTRtdm1zLXloSld0VExZSHI4SlR4SXF4S2JDSTU0a0pXcEwwYWU1eTlHcGFmMzdoa1paM0RxUU5kOUdoMDFWTjlkNA&file=The+100+S06E05+The+Gospel+of+Josephine+1080p+AMZN+WEBRip+x265+DDP+5.1+D0ct0rLew[SEV
2019-06-12 23:43:52 INFO	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Downloading The.100.S06E05.The.Gospel.of.Josephine.1080p.AMZN.WEBRip.x265.DDP.5.1.D0ct0rLew[SEV with 26 seeders and 28 leechers and size 1.53 GB from 1337x, through a SearchType.MANUAL_SEARCH search
2019-06-12 23:43:52 INFO	SNATCHQUEUE-SNATCH-268592 :: [4d4a63c] Beginning to snatch release: The.100.S06E05.The.Gospel.of.Josephine.1080p.AMZN.WEBRip.x265.DDP.5.1.D0ct0rLew[SEV
`


Discussion:

Resolving patch:
diff --git a/medusa/providers/torrent/torrent_provider.py b/medusa/providers/torrent/torrent_provider.py
--- a/medusa/providers/torrent/torrent_provider.py
+++ b/medusa/providers/torrent/torrent_provider.py
@@ -22,8 +22,6 @@
 from medusa.logger.adapters.style import BraceAdapter
 from medusa.providers.generic_provider import GenericProvider
 
-from requests.exceptions import InvalidSchema
-
 log = BraceAdapter(logging.getLogger(__name__))
 log.logger.addHandler(logging.NullHandler())
 
@@ -151,18 +149,17 @@ def get_redirect_url(self, url):
         """Get the final address that the provided URL redirects to."""
         log.debug('Retrieving redirect URL for {url}', {'url': url})
 
-        try:
-            response = self.session.get(url, stream=True)
-            if response:
-                response.close()
-                return response.url
+        response = self.session.get(url, stream=True)
+        if response:
+            response.close()
+            return response.url
 
         # Jackett redirects to a magnet causing InvalidSchema.
         # Use an alternative method to get the redirect URL.
-        except InvalidSchema:
-            response = self.session.get(url, allow_redirects=False)
-            if response and response.headers.get('Location'):
-                return response.headers['Location']
+        log.debug('Using alternative method to retrieve redirect URL')
+        response = self.session.get(url, allow_redirects=False)
+        if response and response.headers.get('Location'):
+            return response.headers['Location']
 
         log.debug('Unable to retrieve redirect URL for {url}', {'url': url})
         return url


Test patch: