diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/crypter/FilecryptCc.py | 5 | ||||
-rw-r--r-- | module/plugins/crypter/LinkCryptWs.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/BypassCaptcha.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/Captcha9Kw.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/CaptchaBrotherhood.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/DeathByCaptcha.py | 6 | ||||
-rw-r--r-- | module/plugins/hooks/ExpertDecoders.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ImageTyperz.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/LogMarker.py | 4 | ||||
-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 | ||||
-rw-r--r-- | module/plugins/internal/Notifier.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/XFSHoster.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/misc.py | 16 |
20 files changed, 42 insertions, 65 deletions
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 4a9328593..c2fca1ab4 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -123,6 +123,7 @@ class FilecryptCc(Crypter): captcha_key = solvemedia.detect_key() if captcha_key: + self.captcha = solvemedia response, challenge = solvemedia.challenge(captcha_key) self.site_with_links = self.load(self.pyfile.url, post={'adcopy_response' : response, @@ -134,9 +135,11 @@ class FilecryptCc(Crypter): else: recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() + captcha_key = self.captcha.detect_key() if captcha_key: + self.captcha = recaptcha + try: response, challenge = recaptcha.challenge(captcha_key) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index fb080eeb3..65b671c11 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -7,7 +7,7 @@ import Crypto.Cipher import pycurl from module.plugins.internal.Crypter import Crypter -from module.plugins.internal.misc import html_unescape, set_cookie(cj +from module.plugins.internal.misc import html_unescape, set_cookie class LinkCryptWs(Crypter): diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index bc34f1239..bc28b1469 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -4,8 +4,7 @@ import pycurl from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import threaded +from module.plugins.internal.Addon import Addon, threaded class BypassCaptchaException(Exception): @@ -126,7 +125,7 @@ class BypassCaptcha(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index b269750ba..714be8bc4 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -7,8 +7,7 @@ import re import time from module.network.HTTPRequest import BadHeader -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import threaded +from module.plugins.internal.Addon import Addon, threaded class Captcha9Kw(Addon): @@ -55,7 +54,7 @@ class Captcha9Kw(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): try: with open(task.captchaFile, 'rb') as f: data = f.read() diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index ba29d809e..15546c63f 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -15,8 +15,7 @@ except ImportError: import Image from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import threaded +from module.plugins.internal.Addon import Addon, threaded class CaptchaBrotherhoodException(Exception): @@ -161,7 +160,7 @@ class CaptchaBrotherhood(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 0e94c9cda..62cfe7d16 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -10,8 +10,8 @@ import pycurl from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import json, threaded +from module.plugins.internal.Addon import Addon, threaded +from module.plugins.internal.misc import json class DeathByCaptchaException(Exception): @@ -209,7 +209,7 @@ class DeathByCaptcha(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 9c7f129cb..9b29aa8c5 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -9,8 +9,7 @@ import pycurl from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import threaded +from module.plugins.internal.Addon import Addon, threaded class ExpertDecoders(Addon): @@ -45,7 +44,7 @@ class ExpertDecoders(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): task.data['ticket'] = ticket = uuid.uuid4() result = None diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index e77514bb5..b8b79027e 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -3,8 +3,8 @@ import os import subprocess -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import Expose, encode, fsjoin +from module.plugins.internal.Addon import Addon, Expose +from module.plugins.internal.misc import encode, fsjoin class ExternalScripts(Addon): diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 864eb476e..5afeb4a78 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -8,8 +8,7 @@ import re import pycurl from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import threaded +from module.plugins.internal.Addon import Addon, threaded class ImageTyperzException(Exception): @@ -146,7 +145,7 @@ class ImageTyperz(Addon): @threaded - def _process_captcha(self, task) + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/LogMarker.py b/module/plugins/hooks/LogMarker.py index e51fa6e3d..3889ce288 100644 --- a/module/plugins/hooks/LogMarker.py +++ b/module/plugins/hooks/LogMarker.py @@ -2,8 +2,8 @@ import datetime -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import Expose, seconds_to_nexthour +from module.plugins.internal.Addon import Addon, Expose +from module.plugins.internal.misc import seconds_to_nexthour class LogMarker(Addon): 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) diff --git a/module/plugins/internal/Notifier.py b/module/plugins/internal/Notifier.py index 2cffb6ac1..e9f1fab74 100644 --- a/module/plugins/internal/Notifier.py +++ b/module/plugins/internal/Notifier.py @@ -2,8 +2,8 @@ import time -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import Expose, encode, isiterable +from module.plugins.internal.Addon import Addon, Expose +from module.plugins.internal.misc import encode, isiterable class Notifier(Addon): diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 82b596aff..dabf1457a 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -247,6 +247,7 @@ class XFSHoster(SimpleHoster): self.log_debug("ReCaptcha key: %s" % captcha_key) if captcha_key: + self.captcha = recaptcha inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) return @@ -261,4 +262,5 @@ class XFSHoster(SimpleHoster): self.log_debug("SolveMedia key: %s" % captcha_key) if captcha_key: + self.captcha = solvemedia inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key) diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py index 864e5dd6f..9085106cd 100644 --- a/module/plugins/internal/misc.py +++ b/module/plugins/internal/misc.py @@ -84,22 +84,6 @@ class SimpleQueue(object): return self.set(queue) -class Expose(object): - """ - Used for decoration to declare rpc services - """ - def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) - return f - - -def threaded(fn): - def run(*args, **kwargs): - hookManager.startThread(fn, *args, **kwargs) - - return run - - def lock(fn): def new(*args): args[0].lock.acquire() |