summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-10-03 18:05:57 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-10-03 18:05:57 +0200
commit2c1a72d104377f49b3a7a26f0165797bbd60e4ec (patch)
tree54add97a16ecf318145856455ff4252cb6525ac9
parentMerge pull request #289 from vuolter/s/hoster/MegaNz (diff)
downloadpyload-2c1a72d104377f49b3a7a26f0165797bbd60e4ec.tar.xz
Zippyshare: fixed #292
-rw-r--r--module/plugins/hoster/ZippyshareCom.py89
1 files changed, 52 insertions, 37 deletions
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 661f90e20..a3b1cf783 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -15,7 +15,7 @@ class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)"
- __version__ = "0.40"
+ __version__ = "0.41"
__description__ = """Zippyshare.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg", "stickell")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
@@ -63,11 +63,11 @@ class ZippyshareCom(SimpleHoster):
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- url = multiply = modulo = None
+ url = None
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html, re.S)
- if found:
- #Method #1: JS eval
+ #Method #1: JS eval
+ if found and re.search(r'span id="omg" class="(\d*)"', self.html):
js = "\n".join(found.groups())
d = re.search(r'span id="omg" class="(\d*)"', self.html).group(1)
regex = r"document.getElementById\('omg'\).getAttribute\('class'\)"
@@ -75,41 +75,17 @@ class ZippyshareCom(SimpleHoster):
regex = r"document.getElementById\(\\*'dlbutton\\*'\).href = "
js = re.sub(regex, '', js)
url = self.js.eval(js)
+ elif found and re.search(r"document.getElementById\(\\*'dlbutton\\*'\).omg", self.html):
+ js = "\n".join(found.groups())
+ regex = r"document.getElementById\(\\*'dlbutton\\*'\).omg"
+ omg = re.search(regex + r" = ([^;]+);", js).group(1)
+ js = re.sub(regex + r" = ([^;]+);", '', js)
+ js = re.sub(regex, omg, js)
+ js = re.sub(r"document.getElementById\(\\*'dlbutton\\*'\).href = ", '', js)
+ url = self.js.eval(js)
else:
#Method #2: SWF eval
- seed_search = re.search(self.SEED_PATTERN, self.html)
- if seed_search:
- swf_url, file_seed = seed_search.groups()
-
- swf_sts = self.getStorage("swf_sts")
- swf_stamp = int(self.getStorage("swf_stamp") or 0)
- swf_version = self.getStorage("version")
- self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
-
- if not swf_sts:
- self.logDebug('Using default values')
- multiply, modulo = self.LAST_KNOWN_VALUES
- elif swf_sts == "1":
- self.logDebug('Using stored values')
- multiply = self.getStorage("multiply")
- modulo = self.getStorage("modulo")
- elif swf_sts == "2":
- if swf_version < self.__version__:
- self.logDebug('Reverting to default values')
- self.setStorage("swf_sts", "")
- self.setStorage("version", self.__version__)
- multiply, modulo = self.LAST_KNOWN_VALUES
- elif (swf_stamp + 3600000) < timestamp():
- swfdump = self.get_swfdump_path()
- if swfdump:
- multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
- else:
- self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
-
- if multiply and modulo:
- self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
- url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
- (int(file_seed) * int(multiply)) % int(modulo))
+ url = self.swf_eval()
if not url:
#Method #3: Captcha
@@ -117,6 +93,45 @@ class ZippyshareCom(SimpleHoster):
return self.file_info['HOST'] + url
+ def swf_eval(self):
+ multiply = modulo = None
+ seed_search = re.search(self.SEED_PATTERN, self.html)
+ if seed_search:
+ swf_url, file_seed = seed_search.groups()
+
+ swf_sts = self.getStorage("swf_sts")
+ swf_stamp = int(self.getStorage("swf_stamp") or 0)
+ swf_version = self.getStorage("version")
+ self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
+
+ if not swf_sts:
+ self.logDebug('Using default values')
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif swf_sts == "1":
+ self.logDebug('Using stored values')
+ multiply = self.getStorage("multiply")
+ modulo = self.getStorage("modulo")
+ elif swf_sts == "2":
+ if swf_version < self.__version__:
+ self.logDebug('Reverting to default values')
+ self.setStorage("swf_sts", "")
+ self.setStorage("version", self.__version__)
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif (swf_stamp + 3600000) < timestamp():
+ swfdump = self.get_swfdump_path()
+ if swfdump:
+ multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
+ else:
+ self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
+
+ if multiply and modulo:
+ self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
+ url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
+ (int(file_seed) * int(multiply)) % int(modulo))
+ return url
+
+ return None
+
def get_swf_values(self, swf_url, swfdump):
self.logDebug('Parsing values from %s' % swf_url)
multiply = modulo = None