diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-08 08:28:34 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-08 08:28:34 +0100 |
commit | cd86a6d32ba7d6d30f449041b0b389c809311eb4 (patch) | |
tree | e54f6166d2c4a957e46fc51258637b7ea9c4a249 /module/plugins/hoster | |
parent | closed #422 (diff) | |
download | pyload-cd86a6d32ba7d6d30f449041b0b389c809311eb4.tar.xz |
update DepositfilesCom, fix HellshareCz
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 46 | ||||
-rw-r--r-- | module/plugins/hoster/HellshareCz.py | 4 |
2 files changed, 34 insertions, 16 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 1fba3bad5..81e6aa4d6 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -5,6 +5,7 @@ import re import urllib from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL +from module.plugins.ReCaptcha import ReCaptcha def getInfo(urls): result = [] @@ -29,13 +30,15 @@ class DepositfilesCom(Hoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" - __version__ = "0.33" + __version__ = "0.34" __description__ = """Depositfiles.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") FILE_INFO_PATTERN = r'File name: <b title="([^"]+)">.*\s*<span class="nowrap">File size: <b>([0-9.]+) (KB|MB|GB)</b>' FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' + RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)', this\);" + DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"' def setup(self): self.resumeDownload = self.multiDL = True if self.account else False @@ -96,27 +99,42 @@ class DepositfilesCom(Hoster): found = re.search(r"var fid = '(\w+)';", self.html) if not found: self.retry(wait_time=5) - fid = found.group(1) - self.logDebug ("FID: %s" % fid) + params = {'fid' : found.group(1)} + self.logDebug ("FID: %s" % params['fid']) - self.wait() - - #form = re.search(r"\$\('#download_container'\)\.load\('([^']+)", self.html) + captcha_key = None + found = re.search(self.RECAPTCHA_PATTERN, self.html) + if found: captcha_key = found.group(1) + self.logDebug ("CAPTCHA_KEY: %s" % captcha_key) - #self.html = self.load("http://depositfiles.com/"+ form.group(1)) + self.wait() + recaptcha = ReCaptcha(self) + + for i in range(5): + self.html = self.load("http://depositfiles.com/get_file.php", get = params) + if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: + if not captcha_key: self.fail('Parse error (Captcha key)') + if 'response' in params: self.invalidCaptcha() + params['challenge'], params['response'] = recaptcha.challenge(captcha_key) + self.logDebug(params) + continue + + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if found: + if 'response' in params: self.correctCaptcha() + link = urllib.unquote(found.group(1)) + self.logDebug ("LINK: %s" % link) + break + else: + self.fail('Parse error (Download link)') + else: + self.fail('No valid captcha response received') - self.html = self.load("http://depositfiles.com/get_file.php?fid=" + fid) - link = urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1)) - self.logDebug ("LINK: %s" % link) try: self.download(link) except: self.retry(wait_time = 60) - #wait_time = int(re.search(r'<span id="download_waiter_remain">(.*?)</span>', self.html).group(1)) - #self.setWait(wait_time) - #self.log.debug("DepositFiles.com: Waiting %d seconds." % wait_time) - def handlePremium(self): link = urllib.unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) self.download(link)
\ No newline at end of file diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 7986ecf11..8c90e8099 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -48,7 +48,7 @@ class HellshareCz(Hoster): __name__ = "HellshareCz" __type__ = "hoster" __pattern__ = r"http://(.*\.)*hellshare\.(cz|com|sk|hu)/.*" - __version__ = "0.70" + __version__ = "0.71" __description__ = """Hellshare.cz""" __author_name__ = ("zoidberg") @@ -97,7 +97,7 @@ class HellshareCz(Hoster): def handleFree(self): # hellshare is very generous - if 'You exceeded your today's limit for free download. You can download only 1 files per 24 hours.' in self.html: + if "You exceeded your today's limit for free download. You can download only 1 files per 24 hours." in self.html: t = datetime.datetime.today().replace(hour=1, minute=0, second=0) + datetime.timedelta( days=1) - datetime.datetime.today() self.setWait(t.seconds, True) |