diff options
Diffstat (limited to 'module/plugins/crypter')
| -rw-r--r-- | module/plugins/crypter/HoerbuchIn.py | 52 | 
1 files changed, 31 insertions, 21 deletions
diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index ad9c8cce3..7b0ee957b 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -1,19 +1,16 @@  # -*- coding: utf-8 -*-  import re -  import BeautifulSoup -  from module.plugins.internal.Crypter import Crypter -  class HoerbuchIn(Crypter):      __name__    = "HoerbuchIn"      __type__    = "crypter" -    __version__ = "0.65" +    __version__ = "0.66"      __status__  = "testing" -    __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)' +    __pattern__ = r'http://(?:www\.)?hoerbuch\.us/(wp/horbucher/\d+/|tp/out\.php\?.+|protection/folder_\d+\.html)'      __config__  = [("activated"         , "bool"          , "Activated"                       , True     ),                     ("use_premium"       , "bool"          , "Use premium account if available", True     ),                     ("folder_per_package", "Default;Yes;No", "Create folder for each package"  , "Default")] @@ -24,9 +21,10 @@ class HoerbuchIn(Crypter):                         ("mkaay", "mkaay@mkaay.de")] -    article = re.compile("http://(?:www\.)?hoerbuch\.in/wp/horbucher/\d+/.+/") -    protection = re.compile("http://(?:www\.)?hoerbuch\.in/protection/folder_\d+.html") - +    article         = re.compile("http://(?:www\.)?hoerbuch\.us/wp/horbucher/\d+/.+/") +    protection      = re.compile("http://(?:www\.)?hoerbuch\.us/protection/folder_\d+.html") +    uploaded        = re.compile("http://(?:www\.)?hoerbuch\.us/protection/uploaded/(\w+)\.html") +    hoster_links    = re.compile("http://(?:www\.)?hoerbuch\.us/wp/goto/Download/\d+/")      def decrypt(self, pyfile):          self.pyfile = pyfile @@ -35,30 +33,42 @@ class HoerbuchIn(Crypter):              html = self.load(pyfile.url)              soup = BeautifulSoup.BeautifulSoup(html, convertEntities=BeautifulSoup.BeautifulStoneSoup.HTML_ENTITIES) -            abookname = soup.find("a", attrs={'rel': "bookmark"}).text -            for a in soup.findAll("a", attrs={'href': self.protection}): -                package = "%s (%s)" % (abookname, a.previousSibling.previousSibling.text[:-1]) -                links = self.decrypt_folder(a['href']) +            links = [] +            for a in soup.findAll("a", attrs={'href': self.hoster_links}): +                for decrypted_link in self.decrypt_folder(a.get('href')): +                    links.append(decrypted_link) -                self.packages.append((package, links, package)) +            self.packages.append((pyfile.name, links, pyfile.name))          else:              self.links = self.decrypt_folder(pyfile.url) -      def decrypt_folder(self, url): -        m = self.protection.search(url) + +        m = self.hoster_links.search(url) or self.protection.search(url) +          if m is None:              self.fail(_("Bad URL"))          url = m.group(0) -        self.pyfile.url = url +        if self.hoster_links.match(url): +            self.load(url) +            url = self.req.lastEffectiveURL +          html = self.load(url, post={'viewed': "adpg"}) +        self.pyfile.url = url +          links = [] -        pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") -        for hoster, lid in pattern.findall(html): -            self.req.lastURL = url -            self.load("http://www.hoerbuch.in/protection/%s/%s" % (hoster, lid)) -            links.append(self.req.lastEffectiveURL) + +        soup = BeautifulSoup.BeautifulSoup(html, convertEntities=BeautifulSoup.BeautifulStoneSoup.HTML_ENTITIES) + +        for container in soup.findAll("div", attrs={'class': "container"}): +            href = container.a.get("href") + +            uploaded = self.uploaded.search(href) +            if uploaded is not None: +                href = "http://uploaded.net/file/%s" % uploaded.group(1) + +            links.append(href)          return links  | 
