diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-22 21:20:06 +0200 |
commit | aaaf5a4cddec894aacd7400c59a9f2f5e710362f (patch) | |
tree | 9d9e89aff86598b3ffcc86117abd554b193e28b5 /pyload/plugins/hoster/DepositfilesCom.py | |
parent | implemented media type filter (diff) | |
download | pyload-aaaf5a4cddec894aacd7400c59a9f2f5e710362f.tar.xz |
Fixed PEP 8 violations in Hosters
(cherry picked from commit 2edeee0532ec6d6b4b26fd045a5971f67ca455da)
Conflicts:
pyload/plugins/hoster/BasePlugin.py
pyload/plugins/hoster/MultishareCz.py
pyload/plugins/hoster/NetloadIn.py
pyload/plugins/hoster/PremiumizeMe.py
pyload/plugins/hoster/RapidshareCom.py
Diffstat (limited to 'pyload/plugins/hoster/DepositfilesCom.py')
-rw-r--r-- | pyload/plugins/hoster/DepositfilesCom.py | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/pyload/plugins/hoster/DepositfilesCom.py b/pyload/plugins/hoster/DepositfilesCom.py index ee5fdf6af..1ede3b715 100644 --- a/pyload/plugins/hoster/DepositfilesCom.py +++ b/pyload/plugins/hoster/DepositfilesCom.py @@ -4,9 +4,9 @@ import re from urllib import unquote from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL from module.plugins.internal.CaptchaService import ReCaptcha + class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" @@ -21,7 +21,8 @@ class DepositfilesCom(SimpleHoster): FILE_INFO_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\'' FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")] - FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )] + FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), + (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )] RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'" DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' @@ -31,8 +32,9 @@ class DepositfilesCom(SimpleHoster): self.resumeDownload = self.premium def handleFree(self): - self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}, cookies = True) - if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() + self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) + if re.search(self.FILE_OFFLINE_PATTERN, self.html): + self.offline() if re.search(r'File is checked, please try again in a minute.', self.html) is not None: self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.") @@ -43,7 +45,7 @@ class DepositfilesCom(SimpleHoster): wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo( "%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time) ) + self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time)) self.setWait(wait_time) self.wantReconnect = True self.wait() @@ -52,7 +54,7 @@ class DepositfilesCom(SimpleHoster): wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo( "%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time) ) + self.logInfo("%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time)) self.setWait(wait_time * 60, False) wait = re.search(r'Please wait (\d+) sec', self.html) @@ -60,33 +62,38 @@ class DepositfilesCom(SimpleHoster): self.setWait(int(wait.group(1))) found = re.search(r"var fid = '(\w+)';", self.html) - if not found: self.retry(wait_time=5) - params = {'fid' : found.group(1)} - self.logDebug ("FID: %s" % params['fid']) + if not found: + self.retry(wait_time=5) + params = {'fid': found.group(1)} + self.logDebug("FID: %s" % params['fid']) captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m' found = re.search(self.RECAPTCHA_PATTERN, self.html) - if found: captcha_key = found.group(1) - self.logDebug ("CAPTCHA_KEY: %s" % captcha_key) + if found: + captcha_key = found.group(1) + self.logDebug("CAPTCHA_KEY: %s" % captcha_key) self.wait() recaptcha = ReCaptcha(self) for i in range(5): - self.html = self.load("http://depositfiles.com/get_file.php", get = params) + 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.parseError('Captcha key') - if 'response' in params: self.invalidCaptcha() + if not captcha_key: + self.parseError('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() + if 'response' in params: + self.correctCaptcha() link = unquote(found.group(1)) - self.logDebug ("LINK: %s" % link) + self.logDebug("LINK: %s" % link) break else: self.parseError('Download link') @@ -94,9 +101,9 @@ class DepositfilesCom(SimpleHoster): self.fail('No valid captcha response received') try: - self.download(link, disposition = True) + self.download(link, disposition=True) except: - self.retry(wait_time = 60) + self.retry(wait_time=60) def handlePremium(self): if '<span class="html_download_api-gold_traffic_limit">' in self.html: @@ -105,8 +112,10 @@ class DepositfilesCom(SimpleHoster): elif 'onClick="show_gold_offer' in self.html: self.account.relogin(self.user) self.retry() - link = unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) + link = unquote( + re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) self.multiDL = True - self.download(link, disposition = True) + self.download(link, disposition=True) + getInfo = create_getInfo(DepositfilesCom) |