diff options
| author | 2015-01-22 21:04:09 +0100 | |
|---|---|---|
| committer | 2015-01-22 21:04:09 +0100 | |
| commit | 5f132e5d5c97f2f3e9ce2c532ce61cb87734f545 (patch) | |
| tree | a172b8c7feae13d53c7e5bb0dd6aef212ddbc733 | |
| parent | [UlozTo] Fix setup (thx kmarty) (diff) | |
| download | pyload-5f132e5d5c97f2f3e9ce2c532ce61cb87734f545.tar.xz | |
[ZippyshareCom] Fix https://github.com/pyload/pyload/issues/1060
| -rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 37 | 
1 files changed, 23 insertions, 14 deletions
| diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 39c8d36d6..f32c5877f 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -2,42 +2,51 @@  import re -from urlparse import urljoin - +from module.plugins.internal.CaptchaService import ReCaptcha  from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class ZippyshareCom(SimpleHoster):      __name__    = "ZippyshareCom"      __type__    = "hoster" -    __version__ = "0.67" +    __version__ = "0.68" -    __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' +    __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'      __description__ = """Zippyshare.com hoster plugin"""      __license__     = "GPLv3"      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] -    NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' -    SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' +    COOKIES = [("zippyshare.com", "ziplocale", "en")] -    OFFLINE_PATTERN = r'>File does not exist on this server<' +    NAME_PATTERN    = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' +    SIZE_PATTERN    = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' +    OFFLINE_PATTERN = r'>File does not exist on this server' -    COOKIES = [("zippyshare.com", "ziplocale", "en")] +    LINK_PREMIUM_PATTERN = r'document.location = \'(.+?)\''      def setup(self): -        self.multiDL        = True          self.chunkLimit     = -1 +        self.multiDL        = True          self.resumeDownload = True      def handleFree(self, pyfile): -        checksum = self.get_checksum() -        p_url    = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) +        recaptcha   = ReCaptcha(self) +        captcha_key = recaptcha.detect_key() + +        if captcha_key: +            try: +                self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) +                recaptcha.challenge() -        self.link = urljoin(self.info['pattern']['HOST'], p_url) +            except Exception, e: +                self.error(e) + +        else: +            self.link = '/'.join(("d", self.info['pattern']['KEY'], str(self.get_checksum()), self.pyfile.name))      def get_checksum(self): @@ -51,8 +60,8 @@ class ZippyshareCom(SimpleHoster):                  c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups())                  b = (a1 % a2) * (c1 % c2) + 18 -        except Exception, e: -            self.error(_("Unable to calculate checksum"), e) +        except Exception: +            self.error(_("Unable to calculate checksum"))          else:              return b | 
