junalmeida / Sick-Beard

Sick-Beard is a PVR & episode guide that downloads and manages all your TV shows. You must have rights to the TV Shows being downloaded. Always observe network regulations and laws in your country.
GNU General Public License v3.0
143 stars 72 forks source link

Modify torrentz url #308

Closed serramat closed 7 years ago

VeNoMouS commented 8 years ago

Modify it to what exactly... offically torrentz is DEAD, there are 'mirrors' pretending to be torrentz, but the site is no more..

https://torrentfreak.com/torrentz-remains-down-but-the-clone-wars-are-on-160813/

serramat commented 7 years ago

I have modified the torrentz file like this. What do you think for this possible solution?


diff --git a/sickbeard/providers/torrentz.py b/sickbeard/providers/torrentz.py
index ed7b6fc..3fed365 100644
--- a/sickbeard/providers/torrentz.py
+++ b/sickbeard/providers/torrentz.py
@@ -48,7 +48,7 @@ class TORRENTZProvider(generic.TorrentProvider):
     def __init__(self):
         generic.TorrentProvider.__init__(self, "Torrentz")
         self.cache = TORRENTZCache(self)
-        self.url = 'https://torrentz.eu/'
+        self.url = 'https://torrentz2.eu/'
         self.name = "Torrentz"
         self.supportsBacklog = True
         self.rss = False
@@ -154,6 +154,7 @@ class TORRENTZProvider(generic.TorrentProvider):
             else:
                 search_type = "feedP"

+        search_type = "feed"
         # race condition between rss and back log searching if both were to run at same time, best to disable.
         if self.rss is True:
             self.rss = False
@@ -170,9 +171,15 @@ class TORRENTZProvider(generic.TorrentProvider):

         for page in range(0,2):
             searchData = None
-            
-            logger.log("[" + self.name + "] _doSearch() - " + self.url + search_type + "?q=" + urllib.quote(search_params) + "&p=" + str(page),logger.DEBUG)
-            searchData = self.getURL(self.url + search_type + "?q=" + urllib.quote(search_params) + "&p=" + str(page))
+           
+            if search_params == "":
+                str_search = "tv+added%3A2d"
+            else: 
+                str_search = urllib.quote(search_params).replace(".", "+")
+                str_search = str_search.replace("%20", "+")
+                
+            logger.log("[" + self.name + "] _doSearch() - " + self.url + search_type + "?f=" + str_search + "&p=" + str(page),logger.DEBUG) 
+            searchData = self.getURL(self.url + search_type + "?f=" + str_search + "&p=" + str(page))

             if searchData and searchData.startswith("<?xml"):    
                 try:
@@ -257,4 +264,4 @@ class TORRENTZCache(tvcache.TVCache):

     ###################################################################################################

-provider = TORRENTZProvider()
\ No newline at end of file
+provider = TORRENTZProvider()```
serramat commented 7 years ago

Any thoughts about this @VeNoMouS ?

VeNoMouS commented 7 years ago

@serramat try out 729979763be4d1c5ab75737b025ecd04ad45521c and 521cab094729b0880a529b4c85dec58aa34b413d instead... I haven't tested it yet, but its cleaner then your solution.

serramat commented 7 years ago

Hi @VeNoMouS , My code doesn't use the verified rss on Torrentz, but my solution it was enough to rise again my old friend torrentz! :-) I tried your code but I saw some errors:

2017-01-11 09:09:39 SEARCHQUEUE-MANUAL-SEARCH :: Error while searching Torrentz, skipping: global name 'results' is not defined
2017-01-11 09:09:39 SEARCHQUEUE-MANUAL-SEARCH :: No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.
2017-01-11 09:09:24 SEARCHQUEUE-RSS-SEARCH :: Error while searching Torrentz, skipping: global name 'results' is not defined
2017-01-11 09:09:24 SEARCHQUEUE-RSS-SEARCH :: No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.
VeNoMouS commented 7 years ago

Did you cherry pick? as results is defined in the _doSearch() function and thats the only place its used...

I just did a test myself...

2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Quality of New.Girl.S06E12.HDTV.x264-FLEET[rarbg] is SD TV
2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Quality of New.Girl.S06E12.HDTV.x264-FLEET[eztv].mkv is SD TV
2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Quality of New.Girl.S06E12.HDTV.x264-FLEET[PRiME] is SD TV
2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Picked New.Girl.S06E12.HDTV.x264-FLEET[rarbg] as the best
2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Downloading episode from magnet:?xt=urn:btih:4b6f1cd7dc7de8061464b4030ed2bc0db1379eb9&dn=New.Girl.S06E12.HDTV.x264-FLEET[rarbg].torrent
2017-01-11 22:14:45 INFO     SEARCHQUEUE-MANUAL-SEARCH :: Downloading a result from Torrentz at magnet:?xt=urn:btih:4b6f1cd7dc7de8061464b4030ed2bc0db1379eb9&dn=New.Girl.S06E12.HDTV.x264-FLEET[rarbg].torrent
2017-01-11 22:14:45 DEBUG    SEARCHQUEUE-MANUAL-SEARCH :: [Torrentz] getURL() retrieving URL: magnet:?xt=urn:btih:4b6f1cd7dc7de8061464b4030ed2bc0db1379eb9&dn=New.Girl.S06E12.HDTV.x264-FLEET[rarbg].torrent

Worked fine.