diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
commit | acc46fc3497a66a427b795b4a22c6e71d69185a1 (patch) | |
tree | 2d315b838a76435fc456b972c99c28d1732b2f70 /pyload/plugin/hoster/ZippyshareCom.py | |
parent | Code fixes (diff) | |
download | pyload-acc46fc3497a66a427b795b4a22c6e71d69185a1.tar.xz |
Update
Diffstat (limited to 'pyload/plugin/hoster/ZippyshareCom.py')
-rw-r--r-- | pyload/plugin/hoster/ZippyshareCom.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py new file mode 100644 index 000000000..1bf9338c3 --- /dev/null +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +import re + +from os.path import join +from urlparse import urljoin + +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class ZippyshareCom(SimpleHoster): + __name = "ZippyshareCom" + __type = "hoster" + __version = "0.62" + + __pattern = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' + + __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^_]+)' + + OFFLINE_PATTERN = r'>File does not exist on this server<' + + COOKIES = [("zippyshare.com", "ziplocale", "en")] + + + def setup(self): + self.multiDL = True + self.chunkLimit = -1 + self.resumeDownload = True + + + def handleFree(self): + url = self.get_link() + self.download(url) + + + def get_checksum(self): + try: + m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html) + if m: + a1, a2, c1, c2 = map(int, m.groups()) + else: + a1, a2 = map(int, re.search(r'\(\'downloadB\'\).omg = (\d+)%(\d+)', self.html).groups()) + c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups()) + + b = (a1 % a2) * (c1 % c2) + except Exception: + self.error(_("Unable to calculate checksum")) + else: + return b + 18 + + + def get_link(self): + checksum = self.get_checksum() + p_url = join("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name) + dl_link = urljoin(self.info['pattern']['HOST'], p_url) + return dl_link + + +getInfo = create_getInfo(ZippyshareCom) |