diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-18 06:09:04 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-27 22:37:54 +0100 |
commit | 58125cc90a78b67093b8213247ea647dd67dd9ca (patch) | |
tree | 69ae964377cbd45430bb78ade3930b820e867a55 /module/plugins/hoster | |
parent | [OCR] self.image -> self.img (diff) | |
download | pyload-58125cc90a78b67093b8213247ea647dd67dd9ca.tar.xz |
Spare code fixes
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/FilejungleCom.py | 8 | ||||
-rw-r--r-- | module/plugins/hoster/FileserveCom.py | 9 | ||||
-rw-r--r-- | module/plugins/hoster/Keep2ShareCc.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/MediafireCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/MegaCoNz.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 7 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 4 |
7 files changed, 16 insertions, 23 deletions
diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index cfee78fb3..af00ef9a4 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.FileserveCom import FileserveCom, check_file -from module.plugins.internal.misc import chunks +from module.plugins.hoster.FileserveCom import FileserveCom class FilejungleCom(FileserveCom): @@ -24,8 +23,3 @@ class FilejungleCom(FileserveCom): LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<.*?>| )*([^<]*)' LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>' - - -def get_info(urls): - for chunk in chunks(urls, 100): - yield check_file(FilejungleCom, chunk) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index c56023939..58db17381 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -5,10 +5,10 @@ import re from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.misc import chunks, json, parse_size, seconds_to_midnight +from module.plugins.internal.misc import json, parse_size, seconds_to_midnight -def check_file(plugin, urls): +def get_info(plugin, urls): html = get_url(plugin.URLS[1], post={'urls': "\n".join(urls)}) file_info = [] @@ -207,8 +207,3 @@ class FileserveCom(Hoster): self.scan_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): self.account.relogin() self.retry(msg=_("Not logged in")) - - -def get_info(urls): - for chunk in chunks(urls, 100): - yield check_file(FileserveCom, chunk) diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 560895eb9..8c5cc53cd 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -114,12 +114,13 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.data) self.log_debug("CAPTCHA_PATTERN found %s" % m) + if m is not None: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) else: - recaptcha = ReCaptcha(self.pyfile) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 00d3e1348..f21329a4b 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -45,6 +45,7 @@ class MediafireCom(SimpleHoster): captcha_key = solvemedia.detect_key() if captcha_key: + self.captcha = solvemedia response, challenge = solvemedia.challenge(captcha_key) self.data = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], post={'adcopy_challenge': challenge, @@ -55,6 +56,7 @@ class MediafireCom(SimpleHoster): captcha_key = recaptcha.detect_key() if captcha_key: + self.captcha = recaptcha response, challenge = recaptcha.challenge(captcha_key) self.data = self.load(self.pyfile.url, post={'g-recaptcha-response': response}) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 054116404..12cbd2635 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -163,10 +163,10 @@ class MegaCoNz(Hoster): df.close() # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] is not meta_mac: - # os.remove(file_decrypted) + # self.remove(file_decrypted, trash=False) # self.fail(_("Checksum mismatch")) - os.remove(file_crypted) + self.remove(file_crypted, trash=False) self.last_download = decode(file_decrypted) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 3966275e0..a4f6f4190 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -150,9 +150,10 @@ class RapidgatorNet(SimpleHoster): def handle_captcha(self): for klass in (AdsCaptcha, ReCaptcha, SolveMedia): - inst = klass(self.pyfile) - if inst.detect_key(): - return inst + captcha = klass(self.pyfile) + if captcha.detect_key(): + self.captcha = captcha + return captcha def get_json_response(self, url): diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 72402a2af..6205d6950 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -68,8 +68,8 @@ class ShareonlineBiz(SimpleHoster): def handle_captcha(self): - recaptcha = ReCaptcha(self.pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.data) self.set_wait(int(m.group(1)) if m else 30) |