diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 21:19:03 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-28 21:19:03 +0200 |
commit | 46c6fc74a4e423927554f024b78dbbbf33e982cd (patch) | |
tree | e7ff9580bb5e80b91e2bd9609409116a19c5941e /pyload/plugins/hoster/ZippyshareCom.py | |
parent | Api : Add brackets and pipe to urlmatcher (diff) | |
parent | [XFileSharingPro] Fixed typo (diff) | |
download | pyload-46c6fc74a4e423927554f024b78dbbbf33e982cd.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/SerienjunkiesOrg.py
pyload/plugins/hooks/ExternalScripts.py
pyload/plugins/hooks/ExtractArchive.py
pyload/plugins/hooks/MergeFiles.py
pyload/plugins/hoster/CatShareNet.py
pyload/plugins/hoster/FilezyNet.py
pyload/plugins/hoster/IFileWs.py
pyload/plugins/hoster/PremiumTo.py
pyload/plugins/hoster/SpeedyshareCom.py
pyload/plugins/hoster/UptoboxCom.py
pyload/plugins/hoster/XFileSharingPro.py
pyload/plugins/hoster/ZippyshareCom.py
Diffstat (limited to 'pyload/plugins/hoster/ZippyshareCom.py')
-rw-r--r-- | pyload/plugins/hoster/ZippyshareCom.py | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/pyload/plugins/hoster/ZippyshareCom.py b/pyload/plugins/hoster/ZippyshareCom.py index d6b7375e2..60d152455 100644 --- a/pyload/plugins/hoster/ZippyshareCom.py +++ b/pyload/plugins/hoster/ZippyshareCom.py @@ -1,74 +1,72 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://www13.zippyshare.com/v/18665333/file.html import re +from os import path +from urlparse import urljoin + from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.49" + __version__ = "0.51" - __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)' + __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' __description__ = """Zippyshare.com hoster plugin""" - __author_name__ = ("spoob", "zoidberg", "stickell", "skylab") - __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it", "development@sky-lab.de") + __author_name__ = "Walter Purcaro" + __author_mail__ = "vuolter@gmail.com" + + + FILE_NAME_PATTERN = r'>Name:.+?">(?P<N>.+?)<' + FILE_SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.]+) (?P<U>\w+)' - FILE_NAME_PATTERN = r'<title>Zippyshare\.com - (?P<N>[^<]+)</title>' - FILE_SIZE_PATTERN = r'>Size:</font>\s*<font [^>]*>(?P<S>[0-9.,]+) (?P<U>[kKMG]+)i?B</font><br />' - FILE_INFO_PATTERN = r'document\.getElementById\(\'dlbutton\'\)\.href = "[^;]*/(?P<N>[^"]+)";' - OFFLINE_PATTERN = r'>File does not exist on this server</div>' + OFFLINE_PATTERN = r'>File does not exist on this server<' - SH_COOKIES = [(".zippyshare.com", "ziplocale", "en")] + COOKIES = [(".zippyshare.com", "ziplocale", "en")] def setup(self): self.multiDL = True + self.chunkLimit = -1 + self.resumeDownload = True + def handleFree(self): - url = self.get_file_url() - if not url: - self.fail("Download URL not found.") + url = self.get_link() self.logDebug("Download URL: %s" % url) self.download(url) - def get_file_url(self): - """returns the absolute downloadable filepath""" - url_parts = re.search(r'(addthis:url="(http://www(\d+).zippyshare.com/v/(\d*)/file.html))', self.html) - number = url_parts.group(4) - check = re.search(r'<script type="text/javascript">([^<]*?)(var a = (\d*);)', self.html) - if check: - a = int(re.search(r'<script type="text/javascript">([^<]*?)(var a = (\d*);)', self.html).group(3)) - k = int(re.search(r'<script type="text/javascript">([^<]*?)(\d*%(\d*))', self.html).group(3)) - checksum = ((a + 3) % k) * ((a + 3) % 3) + 18 + + def get_checksum(self): + m = re.search(r'\(a\*b\+19\)', self.html) + if m: + m = re.findall(r'var \w = (\d+)\%(\d+);', self.html) + c = lambda a,b: a * b + 19 else: - # This might work but is insecure - # checksum = eval(re.search("((\d*)\s\%\s(\d*)\s\+\s(\d*)\s\%\s(\d*))", self.html).group(0)) - - m = re.search(r"((?P<a>\d*)\s%\s(?P<b>\d*)\s\+\s(?P<c>\d*)\s%\s(?P<k>\d*))", self.html) - if m is None: - self.parseError("Unable to detect values to calculate direct link") - a = int(m.group("a")) - b = int(m.group("b")) - c = int(m.group("c")) - k = int(m.group("k")) - if a == c: - checksum = ((a % b) + (a % k)) - else: - checksum = ((a % b) + (c % k)) - - self.logInfo('Checksum: %s' % checksum) - - filename = re.search(r'>Name:</font>\s*<font [^>]*>(?P<N>[^<]+)</font><br />', self.html).group('N') - - url = "/d/%s/%s/%s" % (number, checksum, filename) - self.logInfo(self.file_info['HOST'] + url) - return self.file_info['HOST'] + url + m = re.findall(r'(\d+) \% (\d+)', self.html) + c = lambda a,b: a + b + + if not m: + self.parseError("Unable to calculate checksum") + + a = map(lambda x: int(x), m[0]) + b = map(lambda x: int(x), m[1]) + + # Checksum is calculated as (a*b+19) or (a+b), where a and b are the result of modulo calculations + a = a[0] % a[1] + b = b[0] % b[1] + + return c(a, b) + + + def get_link(self): + checksum = self.get_checksum() + p_url = path.join("d", self.file_info['KEY'], str(checksum), self.pyfile.name) + dl_link = urljoin(self.file_info['HOST'], p_url) + return dl_link getInfo = create_getInfo(ZippyshareCom) |