diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/hoster/DdlstorageCom.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 31 | 
2 files changed, 18 insertions, 17 deletions
| diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index 0177d9648..1ad5fa6d8 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -5,12 +5,12 @@ class DdlstorageCom(XFileSharingPro):      __name__ = "DdlstorageCom"      __type__ = "hoster"      __pattern__ = r"http://(?:\w*\.)*?ddlstorage.com/\w{12}" -    __version__ = "0.05" +    __version__ = "0.06"      __description__ = """DDLStorage.com hoster plugin"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") -    FILE_INFO_PATTERN = r'<h2>Download File\s*<span[^>]*>(?P<N>[^>]+)</span></h2>\s*[^\(]*\((?P<S>[^\)]+)\)</h2>' +    FILE_INFO_PATTERN = r'<h2>\s*Download File\s*<span[^>]*>(?P<N>[^>]+)</span></h2>\s*[^\(]*\((?P<S>[^\)]+)\)</h2>'      HOSTER_NAME = "ddlstorage.com"      def setup(self): diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 7ddbeb280..36874b798 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster):      __name__ = "XFileSharingPro"      __type__ = "hoster"      __pattern__ = r"^unmatchable$" -    __version__ = "0.09" +    __version__ = "0.10"      __description__ = """XFileSharingPro common hoster base"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -52,7 +52,6 @@ class XFileSharingPro(SimpleHoster):      RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"'      CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>'      ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</'       -    #DIRECT_LINK_PATTERN = r'This direct link.*?href=["\'](.*?)["\']'      def setup(self):          self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] @@ -74,25 +73,27 @@ class XFileSharingPro(SimpleHoster):              else:                  self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME)          else: -            location = None                    +            try: +                self.html = self.load(pyfile.url, cookies = False, decode = True) +                self.file_info = self.getFileInfo() +            except PluginParseError: +                self.file_info = None              self.req.http.c.setopt(FOLLOWLOCATION, 0)              self.html = self.load(self.pyfile.url, cookies = True, decode = True)              self.header = self.req.http.header -            self.req.http.c.setopt(FOLLOWLOCATION, 1)     -             +            self.req.http.c.setopt(FOLLOWLOCATION, 1) + +            self.location = None              found = re.search("Location\s*:\s*(.*)", self.header, re.I)              if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): -                location = found.group(1)  -                self.html = self.load(pyfile.url, cookies = False, decode = True) -                 -            try: -                self.file_info = self.getFileInfo() -            except PluginParseError: -                pyfile.name = html_unescape(unquote(urlparse(location if location else pyfile.url).path.split("/")[-1])) -                 -            if location:     -                self.startDownload(location)               +                self.location = found.group(1)                  +                      +            if not self.file_info: +                pyfile.name = html_unescape(unquote(urlparse(self.location if self.location else pyfile.url).path.split("/")[-1])) +             +            if self.location:     +                self.startDownload(self.location)              elif self.premium:                  self.handlePremium()              else: | 
