Repository: Flexget/Flexget

Issue:
horriblesubs plugin no longer functional
HorribleSubs  remade their website on 01.07.2018, and plugin no longer works. "Task didn't produce any entries"

 FlexGet version:  2.14.2

horriblesubs plugin no longer functional
HorribleSubs  remade their website on 01.07.2018, and plugin no longer works. "Task didn't produce any entries"

 FlexGet version:  2.14.2



Discussion:
Looks like there are quite big changes
I've got a fix wrote for this. I'll be uploading it shortly after a little more testing.
Looks like there are quite big changes
I've got a fix wrote for this. I'll be uploading it shortly after a little more testing.

Resolving patch:
diff --git a/flexget/plugins/sites/horriblesubs.py b/flexget/plugins/sites/horriblesubs.py
--- a/flexget/plugins/sites/horriblesubs.py
+++ b/flexget/plugins/sites/horriblesubs.py
@@ -2,6 +2,7 @@
 from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
 
 import logging
+import re
 
 from flexget import plugin
 from flexget.entry import Entry
@@ -20,7 +21,7 @@ class HorribleSubs(object):
     schema = {'type': 'boolean'}
 
     @staticmethod
-    def horrible_entries(requests, page_url):
+    def horrible_get_downloads(requests, title, page_url):
         entries = []
 
         try:
@@ -28,24 +29,46 @@ def horrible_entries(requests, page_url):
         except RequestException as e:
             log.error('HorribleSubs request failed: %s', e)
             return entries
-
-        for td_label in soup.findAll('td', attrs={'class': 'dl-label'}):
-            title = '[HorribleSubs] {0}'.format(str(td_label.find('i').string))
+        for div in soup.findAll('div', attrs={'class': 'rls-link'}):
+            ttitle = '{0} [{1}]'.format(title,re.sub(r'.*-', '', div['id']))
             urls = []
-            log.debug('Found title `%s`', title)
-            for span in td_label.parent.findAll('span', attrs={'class': 'dl-link'}):
-                # skip non torrent based links
-                if 'hs-ddl-link' in span.parent.attrs['class']:
+            for url in div.findAll('a'):
+				# skip non torrent based links
+                if 'hs-ddl-link' in url.parent.attrs['class'] or 'hs-xdcc-link' in url.parent.attrs['class']:
                     continue
-                url = str(span.find('a').attrs['href'])
                 log.debug('Found url `%s`', url)
-                urls.append(url)
+                urls.append(url.attrs['href'])
             # move magnets to last, a bit hacky
             for url in urls[:]:
                 if url.startswith('magnet'):
                     urls.remove(url)
                     urls.append(url)
-            entries.append(Entry(title=title, url=urls[0], urls=urls))
+            entries.append(Entry(title=ttitle, url=urls[0], urls=urls))
+        return entries
+
+    @staticmethod
+    def horrible_entries(requests, page_url):
+        entries = []
+
+        try:
+            soup = get_soup(requests.get(page_url).content)
+        except RequestException as e:
+            log.error('HorribleSubs request failed: %s', e)
+            return entries
+
+        for li_label in soup.findAll('li'):
+            title = '[HorribleSubs] {0}{1}'.format(str(li_label.find('span').next_sibling),str(li_label.find('strong').text))
+            log.debug('Found title `%s`', title)
+            url = li_label.find('a')['href']
+            episode = re.sub(r'.*#', '', url)
+            # Get show ID
+            try:
+                soup = get_soup(requests.get('https://horriblesubs.info/{0}'.format(url)).content)
+            except RequestException as e:
+                log.error('HorribleSubs request failed: %s', e)
+                return entries
+            show_id = re.sub(r'[^0-9]', '', soup(text=re.compile('hs_showid'))[0])
+            entries = HorribleSubs.horrible_get_downloads(requests, title, 'https://horriblesubs.info/api.php?method=getshows&type=show&mode=filter&showid={0}&value={1}'.format(show_id,episode))
         return entries
 
     @staticmethod
@@ -63,7 +86,7 @@ def on_task_input(self, task, config):
         if not config:
             return
         scraper = HorribleSubs.scraper()
-        return HorribleSubs.horrible_entries(scraper, 'http://horriblesubs.info/lib/latest.php')
+        return HorribleSubs.horrible_entries(scraper, 'https://horriblesubs.info/api.php?method=getlatest')
 
     # Search API method
     def search(self, task, entry, config):
@@ -74,7 +97,7 @@ def search(self, task, entry, config):
         for search_string in entry.get('search_strings', [entry['title']]):
             log.debug('Searching `%s`', search_string)
             results = HorribleSubs.horrible_entries(
-                scraper, 'http://horriblesubs.info/lib/search.php?value={0}'.format(search_string))
+                scraper, 'https://horriblesubs.info/api.php?method=search&value={0}'.format(search_string))
             entries.extend(results)
         return entries
 


Test patch: