diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-13 23:47:36 +0100 |
commit | bdfa8104065831bf0eb2f6a022552e8de725ed47 (patch) | |
tree | 4a43864e1bb257c7737a765d62899244b825a859 /pyload/plugins/hook | |
parent | [themes] Tiny code cosmetics (diff) | |
parent | [Plugin] Some fixes by rlindner81 (diff) | |
download | pyload-bdfa8104065831bf0eb2f6a022552e8de725ed47.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/accounts/MegaRapidCz.py
module/plugins/accounts/ShareRapidCom.py
module/plugins/crypter/HotfileComFolder.py
module/plugins/crypter/HotfileFolderCom.py
module/plugins/hoster/Keep2shareCC.py
module/plugins/hoster/Keep2shareCc.py
module/plugins/hoster/MegaCoNz.py
module/plugins/hoster/MegaNz.py
module/plugins/hoster/MegaRapidCz.py
module/plugins/hoster/ShareRapidCom.py
module/plugins/internal/CaptchaService.py
pyload/api/__init__.py
pyload/manager/AccountManager.py
pyload/manager/PluginManager.py
pyload/manager/thread/PluginThread.py
pyload/network/HTTPRequest.py
pyload/network/XDCCRequest.py
pyload/plugins/Plugin.py
pyload/plugins/account/BillionuploadsCom.py
pyload/plugins/account/CramitIn.py
pyload/plugins/account/EasybytezCom.py
pyload/plugins/account/FastshareCz.py
pyload/plugins/account/File4safeCom.py
pyload/plugins/account/FileParadoxIn.py
pyload/plugins/account/FileomCom.py
pyload/plugins/account/FilerNet.py
pyload/plugins/account/FilerioCom.py
pyload/plugins/account/FourSharedCom.py
pyload/plugins/account/Ftp.py
pyload/plugins/account/Http.py
pyload/plugins/account/HugefilesNet.py
pyload/plugins/account/HundredEightyUploadCom.py
pyload/plugins/account/LomafileCom.py
pyload/plugins/account/MovReelCom.py
pyload/plugins/account/MultishareCz.py
pyload/plugins/account/MyfastfileCom.py
pyload/plugins/account/NosuploadCom.py
pyload/plugins/account/NovafileCom.py
pyload/plugins/account/QuickshareCz.py
pyload/plugins/account/RarefileNet.py
pyload/plugins/account/RyushareCom.py
pyload/plugins/account/SecureUploadEu.py
pyload/plugins/account/SendmywayCom.py
pyload/plugins/account/ShareRapidCom.py
pyload/plugins/account/StahnuTo.py
pyload/plugins/account/StreamcloudEu.py
pyload/plugins/account/TusfilesNet.py
pyload/plugins/account/UploadingCom.py
pyload/plugins/account/UptoboxCom.py
pyload/plugins/account/VidPlayNet.py
pyload/plugins/addon/Checksum.py
pyload/plugins/addon/ClickAndLoad.py
pyload/plugins/addon/DeleteFinished.py
pyload/plugins/addon/DownloadScheduler.py
pyload/plugins/addon/ExternalScripts.py
pyload/plugins/addon/ExtractArchive.py
pyload/plugins/addon/HotFolder.py
pyload/plugins/addon/IRCInterface.py
pyload/plugins/addon/MergeFiles.py
pyload/plugins/addon/MultiHome.py
pyload/plugins/addon/RestartFailed.py
pyload/plugins/addon/UnSkipOnFail.py
pyload/plugins/addon/WindowsPhoneToastNotify.py
pyload/plugins/addon/XMPPInterface.py
pyload/plugins/base/Container.py
pyload/plugins/base/Crypter.py
pyload/plugins/base/Hook.py
pyload/plugins/base/OCR.py
pyload/plugins/container/RSDF.py
pyload/plugins/crypter/DuploadOrgFolder.py
pyload/plugins/crypter/EasybytezComFolder.py
pyload/plugins/crypter/FiredriveComFolder.py
pyload/plugins/crypter/HotfileFolderCom.py
pyload/plugins/crypter/LinkSaveIn.py
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/ShareRapidComFolder.py
pyload/plugins/crypter/TusfilesNetFolder.py
pyload/plugins/crypter/UploadableChFolder.py
pyload/plugins/crypter/UploadedToFolder.py
pyload/plugins/hook/Captcha9kw.py
pyload/plugins/hook/MyfastfileCom.py
pyload/plugins/hoster/BillionuploadsCom.py
pyload/plugins/hoster/CramitIn.py
pyload/plugins/hoster/EasybytezCom.py
pyload/plugins/hoster/File4safeCom.py
pyload/plugins/hoster/FileParadoxIn.py
pyload/plugins/hoster/FilefactoryCom.py
pyload/plugins/hoster/FileomCom.py
pyload/plugins/hoster/FilerioCom.py
pyload/plugins/hoster/FileshareInUa.py
pyload/plugins/hoster/FiredriveCom.py
pyload/plugins/hoster/Ftp.py
pyload/plugins/hoster/HugefilesNet.py
pyload/plugins/hoster/HundredEightyUploadCom.py
pyload/plugins/hoster/Keep2shareCC.py
pyload/plugins/hoster/LoadTo.py
pyload/plugins/hoster/LomafileCom.py
pyload/plugins/hoster/MegaNz.py
pyload/plugins/hoster/MegacrypterCom.py
pyload/plugins/hoster/MovReelCom.py
pyload/plugins/hoster/MyvideoDe.py
pyload/plugins/hoster/NosuploadCom.py
pyload/plugins/hoster/NovafileCom.py
pyload/plugins/hoster/PandaPlaNet.py
pyload/plugins/hoster/PremiumTo.py
pyload/plugins/hoster/RarefileNet.py
pyload/plugins/hoster/RyushareCom.py
pyload/plugins/hoster/SecureUploadEu.py
pyload/plugins/hoster/SendmywayCom.py
pyload/plugins/hoster/ShareRapidCom.py
pyload/plugins/hoster/SockshareCom.py
pyload/plugins/hoster/StreamcloudEu.py
pyload/plugins/hoster/TurbobitNet.py
pyload/plugins/hoster/TusfilesNet.py
pyload/plugins/hoster/UptoboxCom.py
pyload/plugins/hoster/VidPlayNet.py
pyload/plugins/hoster/WebshareCz.py
pyload/plugins/internal/DeadCrypter.py
pyload/plugins/internal/DeadHoster.py
pyload/plugins/internal/MultiHoster.py
pyload/plugins/internal/SimpleCrypter.py
pyload/plugins/internal/SimpleHoster.py
pyload/plugins/internal/UpdateManager.py
pyload/plugins/internal/XFSPAccount.py
pyload/plugins/internal/XFSPHoster.py
pyload/utils/__init__.py
pyload/utils/packagetools.py
pyload/webui/app/cnl.py
Diffstat (limited to 'pyload/plugins/hook')
27 files changed, 572 insertions, 394 deletions
diff --git a/pyload/plugins/hook/AlldebridCom.py b/pyload/plugins/hook/AlldebridCom.py index dadf322b4..9ed80f101 100644 --- a/pyload/plugins/hook/AlldebridCom.py +++ b/pyload/plugins/hook/AlldebridCom.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): - __name__ = "AlldebridCom" - __type__ = "hook" + __name__ = "AlldebridCom" + __type__ = "hook" __version__ = "0.13" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", False), + __config__ = [("https", "bool", "Enable HTTPS", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Alldebrid.com hook plugin""" - __authors__ = [("Andy Voigt", "spamsales@online.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def getHoster(self): diff --git a/pyload/plugins/hook/BypassCaptcha.py b/pyload/plugins/hook/BypassCaptcha.py index 02b72c6d0..8b34777f0 100644 --- a/pyload/plugins/hook/BypassCaptcha.py +++ b/pyload/plugins/hook/BypassCaptcha.py @@ -13,29 +13,32 @@ class BypassCaptchaException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<BypassCaptchaException %s>" % self.err + def __repr__(self): return "<BypassCaptchaException %s>" % self.err class BypassCaptcha(Hook): - __name__ = "BypassCaptcha" - __type__ = "hook" + __name__ = "BypassCaptcha" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force BC even if client is connected", False), + __config__ = [("force", "bool", "Force BC even if client is connected", False), ("passkey", "password", "Passkey", "")] __description__ = """Send captchas to BypassCaptcha.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("Godofdream", "soilfcition@gmail.com"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("Godofdream", "soilfcition@gmail.com"), + ("zoidberg", "zoidberg@mujmail.cz")] PYLOAD_KEY = "4f771155b640970d5607f919a615bdefc67e7d32" @@ -46,14 +49,16 @@ class BypassCaptcha(Hook): def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) return int(data['Left']) + def submit(self, captcha, captchaType="file", match=None): req = getRequest() @@ -61,18 +66,18 @@ class BypassCaptcha(Hook): req.c.setopt(LOW_SPEED_TIME, 80) try: - response = req.load(self.SUBMIT_URL, - post={"vendor_key": self.PYLOAD_KEY, - "key": self.getConfig("passkey"), - "gen_task_id": "1", - "file": (FORM_FILE, captcha)}, - multipart=True) + res = req.load(self.SUBMIT_URL, + post={'vendor_key': self.PYLOAD_KEY, + 'key': self.getConfig("passkey"), + 'gen_task_id': "1", + 'file': (FORM_FILE, captcha)}, + multipart=True) finally: req.close() - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) if not data or "Value" not in data: - raise BypassCaptchaException(response) + raise BypassCaptchaException(res) result = data['Value'] ticket = data['TaskId'] @@ -80,12 +85,14 @@ class BypassCaptcha(Hook): return ticket, result + def respond(self, ticket, success): try: - response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), + res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), "cv": 1 if success else 0}) except BadHeader, e: - self.logError(_("Could not send response."), e + self.logError(_("Could not send response"), e) + def newCaptchaTask(self, task): if "service" in task.data: @@ -109,14 +116,17 @@ class BypassCaptcha(Hook): else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) + def captchaCorrect(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], True) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], False) + def processCaptcha(self, task): c = task.captchaFile try: diff --git a/pyload/plugins/hook/Captcha9kw.py b/pyload/plugins/hook/Captcha9kw.py index c37bfc61f..f131aa21e 100644 --- a/pyload/plugins/hook/Captcha9kw.py +++ b/pyload/plugins/hook/Captcha9kw.py @@ -2,155 +2,252 @@ from __future__ import with_statement -import time +import re from base64 import b64encode from thread import start_new_thread +from time import sleep from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL + from pyload.plugins.base.Hook import Hook class Captcha9kw(Hook): - __name__ = "Captcha9kw" - __type__ = "hook" - __version__ = "0.09" - - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force CT even if client is connected", True), - ("https", "bool", "Enable HTTPS", False), - ("confirm", "bool", "Confirm Captcha (Cost +6)", False), - ("captchaperhour", "int", "Captcha per hour (max. 9999)", 9999), - ("prio", "int", "Prio 1-10 (Cost +1-10)", 0), - ("selfsolve", "bool", - "If enabled and you have a 9kw client active only you will get your captcha to solve it (Selfsolve)", - False), - ("timeout", "int", "Timeout (max. 300)", 300), - ("passkey", "password", "API key", "")] + __name__ = "Captcha9kw" + __type__ = "hook" + __version__ = "0.24" + + __config__ = [("activated", "bool", "Activated", True), + ("ssl", "bool", "Use HTTPS", True), + ("force", "bool", "Force captcha resolving even if client is connected", True), + ("confirm", "bool", "Confirm Captcha (cost +6 credits)", False), + ("captchaperhour", "int", "Captcha per hour", "9999"), + ("prio", "int", "Priority (max 10)(cost +0 -> +10 credits)", "0"), + ("queue", "int", "Max. Queue (max 999)", "50"), + ("hoster_options", "string", "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), + ("selfsolve", "bool", "Selfsolve (manually solve your captcha in your 9kw client if active)", "0"), + ("passkey", "password", "API key", ""), + ("timeout", "int", "Timeout in seconds (min 60, max 3999)", "900")] __description__ = """Send captchas to 9kw.eu""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] - API_URL = "://www.9kw.eu/index.cgi" + API_URL = "http://www.9kw.eu/index.cgi" def setup(self): - self.API_URL = "https" + self.API_URL if self.getConfig("https") else "http" + self.API_URL - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + if self.getConfig("ssl"): + self.API_URL = self.API_URL.replace("http://", "https://") - def getCredits(self): - response = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "pyload": "1", "source": "pyload", - "action": "usercaptchaguthaben"}) - if response.isdigit(): - self.logInfo(_("%s credits left") % response) - self.info['credits'] = credits = int(response) + def getCredits(self): + res = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'pyload': "1", + 'source': "pyload", + 'action': "usercaptchaguthaben"}) + + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + credits = self.info["credits"] = int(res) return credits else: - self.logError(response) + self.logError(res) return 0 - def processCaptcha(self, task): - result = None - with open(task.captchaFile, 'rb') as f: - data = f.read() + def _processCaptcha(self, task): + try: + with open(task.captchaFile, 'rb') as f: + data = f.read() + + except IOError, e: + self.logError(e) + return + data = b64encode(data) - self.logDebug(task.captchaFile, data) - if task.isPositional(): - mouse = 1 - else: - mouse = 0 - - response = getURL(self.API_URL, post={ - "apikey": self.getConfig("passkey"), - "prio": self.getConfig("prio"), - "confirm": self.getConfig("confirm"), - "captchaperhour": self.getConfig("captchaperhour"), - "maxtimeout": self.getConfig("timeout"), - "selfsolve": self.getConfig("selfsolve"), - "pyload": "1", - "source": "pyload", - "base64": "1", - "mouse": mouse, - "file-upload-01": data, - "action": "usercaptchaupload"}) - - if response.isdigit(): - self.logInfo(_("New CaptchaID from upload: %s : %s") % (response, task.captchaFile)) - - for _ in xrange(1, 100, 1): - response2 = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "id": response, - "pyload": "1", "source": "pyload", - "action": "usercaptchacorrectdata"}) - - if response2 != "": + mouse = 1 if task.isPositional() else 0 + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) + + option = {'min' : 2, + 'max' : 50, + 'phrase' : 0, + 'numeric' : 0, + 'case_sensitive': 0, + 'math' : 0, + 'prio' : min(max(self.getConfig("prio"), 0), 10), + 'confirm' : self.getConfig("confirm"), + 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), + 'selfsolve' : self.getConfig("selfsolve"), + 'cph' : self.getConfig("captchaperhour")} + + for opt in str(self.getConfig("hoster_options").split('|')): + + details = map(str.strip, opt.split(':')) + + if not details or details[0].lower() != pluginname.lower(): + continue + + for d in details: + hosteroption = d.split("=") + + if len(hosteroption) < 2 or not hosteroption[1].isdigit(): + continue + + o = hosteroption[0].lower() + if o in option: + option[o] = hosteroption[1] + + break + + post_data = {'apikey' : self.getConfig("passkey"), + 'prio' : option['prio'], + 'confirm' : option['confirm'], + 'maxtimeout' : option['timeout'], + 'selfsolve' : option['selfsolve'], + 'captchaperhour': option['cph'], + 'case-sensitive': option['case_sensitive'], + 'min_len' : option['min'], + 'max_len' : option['max'], + 'phrase' : option['phrase'], + 'numeric' : option['numeric'], + 'math' : option['math'], + 'oldsource' : pluginname, + 'pyload' : "1", + 'source' : "pyload", + 'base64' : "1", + 'mouse' : mouse, + 'file-upload-01': data, + 'action' : "usercaptchaupload"} + + for _i in xrange(5): + try: + res = getURL(self.API_URL, post=post_data) + except BadHeader, e: + sleep(3) + else: + if res and res.isdigit(): break + else: + self.logError(_("Bad upload: %s") % res) + return + + self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile) + + task.data["ticket"] = res + + for _i in xrange(int(self.getConfig("timeout") / 5)): + result = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'id' : res, + 'pyload': "1", + 'info' : "1", + 'source': "pyload", + 'action': "usercaptchacorrectdata"}) + + if not result or result == "NO DATA": + sleep(5) + else: + break + else: + self.logDebug("Could not send request: %s" % res) + result = None - time.sleep(3) + self.logInfo(_("Captcha result for ticket %s: %s") % (res, result)) + + task.setResult(result) - result = response2 - task.data['ticket'] = response - self.logInfo(_("Result %s : %s") % (response, result)) - task.setResult(result) - else: - self.logError(_("Bad upload"), response) - return False def newCaptchaTask(self, task): if not task.isTextual() and not task.isPositional(): - return False + return if not self.getConfig("passkey"): - return False + return if self.core.isClientConnected() and not self.getConfig("force"): - return False + return - if self.getCredits() > 0: - task.handler.append(self) - task.setWaiting(self.getConfig("timeout")) - start_new_thread(self.processCaptcha, (task,)) + credits = self.getCredits() - else: - self.logError(_("Your Captcha 9kw.eu Account has not enough credits")) + if not credits: + self.logError(_("Your captcha 9kw.eu account has not enough credits")) + return - def captchaCorrect(self, task): - if "ticket" in task.data: + queue = min(self.getConfig("queue"), 999) + timeout = min(max(self.getConfig("timeout"), 300), 3999) + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) - try: - response = getURL(self.API_URL, - post={"action": "usercaptchacorrectback", - "apikey": self.getConfig("passkey"), - "api_key": self.getConfig("passkey"), - "correct": "1", - "pyload": "1", - "source": "pyload", - "id": task.data['ticket']}) - self.logInfo(_("Request correct", response) + for _i in xrange(5): + servercheck = getURL("http://www.9kw.eu/grafik/servercheck.txt") + if queue < re.search(r'queue=(\d+)', servercheck).group(1): + break - except BadHeader, e: - self.logError(_("Could not send correct request."), e) + sleep(10) else: - self.logError(_("No CaptchaID for correct request (task %s) found.") % task) + self.fail(_("Too many captchas in queue")) - def captchaInvalid(self, task): - if "ticket" in task.data: + for opt in str(self.getConfig("hoster_options").split('|')): + details = map(str.strip, opt.split(':')) - try: - response = getURL(self.API_URL, - post={"action": "usercaptchacorrectback", - "apikey": self.getConfig("passkey"), - "api_key": self.getConfig("passkey"), - "correct": "2", - "pyload": "1", - "source": "pyload", - "id": task.data['ticket']}) - self.logInfo(_("Request refund", response) + if not details or details[0].lower() != pluginname.lower(): + continue - except BadHeader, e: - self.logError(_("Could not send refund request."), e) + for d in details: + hosteroption = d.split("=") + + if (len(hosteroption) > 1 + and hosteroption[0].lower() == 'timeout' + and hosteroption[1].isdigit()): + timeout = int(hosteroption[1]) + + break + + task.handler.append(self) + + task.setWaiting(timeout) + + self._processCaptcha(task) + + + def _captchaResponse(self, task, correct): + type = "correct" if correct else "refund" + + if 'ticket' not in task.data: + self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task)) + return + + passkey = self.getConfig("passkey") + + for _i in xrange(3): + res = getURL(self.API_URL, + get={'action' : "usercaptchacorrectback", + 'apikey' : passkey, + 'api_key': passkey, + 'correct': "1" if correct else "2", + 'pyload' : "1", + 'source' : "pyload", + 'id' : task.data["ticket"]}) + + self.logDebug("Request %s: %s" % (type, res)) + + if res == "OK": + break + + sleep(5) else: - self.logError(_("No CaptchaID for not correct request (task %s) found.") % task) + self.logDebug("Could not send %s request: %s" % (type, res)) + + + def captchaCorrect(self, task): + self._captchaResponse(task, True) + + + def captchaInvalid(self, task): + self._captchaResponse(task, False) diff --git a/pyload/plugins/hook/CaptchaBrotherhood.py b/pyload/plugins/hook/CaptchaBrotherhood.py index 79216923e..03821b8b6 100644 --- a/pyload/plugins/hook/CaptchaBrotherhood.py +++ b/pyload/plugins/hook/CaptchaBrotherhood.py @@ -23,48 +23,53 @@ class CaptchaBrotherhoodException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<CaptchaBrotherhoodException %s>" % self.err + def __repr__(self): return "<CaptchaBrotherhoodException %s>" % self.err class CaptchaBrotherhood(Hook): - __name__ = "CaptchaBrotherhood" - __type__ = "hook" + __name__ = "CaptchaBrotherhood" + __type__ = "hook" __version__ = "0.05" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Password", "")] __description__ = """Send captchas to CaptchaBrotherhood.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://www.captchabrotherhood.com/" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response) + res = getURL(self.API_URL + "askCredits.aspx", + get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res) else: - credits = int(response[3:]) + credits = int(res[3:]) self.logInfo(_("%d credits left") % credits) self.info['credits'] = credits return credits + def submit(self, captcha, captchaType="file", match=None): try: img = Image.open(captcha) @@ -96,34 +101,36 @@ class CaptchaBrotherhood(Hook): try: req.c.perform() - response = req.getResponse() + res = req.getResponse() except Exception, e: raise CaptchaBrotherhoodException("Submit captcha image failed") req.close() - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response[1]) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res[1]) - ticket = response[3:] + ticket = res[3:] - for _ in xrange(15): + for _i in xrange(15): sleep(5) - response = self.get_api("askCaptchaResult", ticket) - if response.startswith("OK-answered"): - return ticket, response[12:] + res = self.get_api("askCaptchaResult", ticket) + if res.startswith("OK-answered"): + return ticket, res[12:] raise CaptchaBrotherhoodException("No solution received in time") + def get_api(self, api, ticket): - response = getURL("%s%s.aspx" % (self.API_URL, api), + res = getURL("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig("username"), "password": self.getConfig("passkey"), "captchaID": ticket}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException("Unknown response: %s" % response) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException("Unknown response: %s" % res) + + return res - return response def newCaptchaTask(self, task): if "service" in task.data: @@ -146,9 +153,11 @@ class CaptchaBrotherhood(Hook): else: self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = self.get_api("complainCaptcha", task.data['ticket']) + res = self.get_api("complainCaptcha", task.data['ticket']) + def processCaptcha(self, task): c = task.captchaFile diff --git a/pyload/plugins/hook/DeathByCaptcha.py b/pyload/plugins/hook/DeathByCaptcha.py index 293326d86..f3e4bb808 100644 --- a/pyload/plugins/hook/DeathByCaptcha.py +++ b/pyload/plugins/hook/DeathByCaptcha.py @@ -25,45 +25,51 @@ class DeathByCaptchaException(Exception): 'invalid-request': 'Invalid request', 'timed-out': 'No CAPTCHA solution received in time'} + def __init__(self, err): self.err = err + def getCode(self): return self.err + def getDesc(self): if self.err in self.DBC_ERRORS.keys(): return self.DBC_ERRORS[self.err] else: return self.err + def __str__(self): return "<DeathByCaptchaException %s>" % self.err + def __repr__(self): return "<DeathByCaptchaException %s>" % self.err class DeathByCaptcha(Hook): - __name__ = "DeathByCaptcha" - __type__ = "hook" + __name__ = "DeathByCaptcha" + __type__ = "hook" __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), ("force", "bool", "Force DBC even if client is connected", False)] __description__ = """Send captchas to DeathByCaptcha.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://api.dbcapi.me/api/" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def call_api(self, api="captcha", post=False, multipart=False): req = getRequest() @@ -75,18 +81,18 @@ class DeathByCaptcha(Hook): post.update({"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - response = None + res = None try: json = req.load("%s%s" % (self.API_URL, api), post=post, multipart=multipart) self.logDebug(json) - response = json_loads(json) + res = json_loads(json) - if "error" in response: - raise DeathByCaptchaException(response['error']) - elif "status" not in response: - raise DeathByCaptchaException(str(response)) + if "error" in res: + raise DeathByCaptchaException(res['error']) + elif "status" not in res: + raise DeathByCaptchaException(str(res)) except BadHeader, e: if 403 == e.code: @@ -103,27 +109,30 @@ class DeathByCaptcha(Hook): finally: req.close() - return response + return res + def getCredits(self): - response = self.call_api("user", True) + res = self.call_api("user", True) - if 'is_banned' in response and response['is_banned']: + if 'is_banned' in res and res['is_banned']: raise DeathByCaptchaException('banned') - elif 'balance' in response and 'rate' in response: - self.info.update(response) + elif 'balance' in res and 'rate' in res: + self.info.update(res) else: - raise DeathByCaptchaException(response) + raise DeathByCaptchaException(res) + def getStatus(self): - response = self.call_api("status", False) + res = self.call_api("status", False) - if 'is_service_overloaded' in response and response['is_service_overloaded']: + if 'is_service_overloaded' in res and res['is_service_overloaded']: raise DeathByCaptchaException('service-overload') + def submit(self, captcha, captchaType="file", match=None): #workaround multipart-post bug in HTTPRequest.py - if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) else: @@ -132,25 +141,26 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - response = self.call_api("captcha", {"captchafile": data}, multipart) + res = self.call_api("captcha", {"captchafile": data}, multipart) - if "captcha" not in response: - raise DeathByCaptchaException(response) - ticket = response['captcha'] + if "captcha" not in res: + raise DeathByCaptchaException(res) + ticket = res['captcha'] - for _ in xrange(24): + for _i in xrange(24): sleep(5) - response = self.call_api("captcha/%d" % ticket, False) - if response['text'] and response['is_correct']: + res = self.call_api("captcha/%d" % ticket, False) + if res['text'] and res['is_correct']: break else: raise DeathByCaptchaException('timed-out') - result = response['text'] + result = res['text'] self.logDebug("Result %s : %s" % (ticket, result)) return ticket, result + def newCaptchaTask(self, task): if "service" in task.data: return False @@ -182,15 +192,19 @@ class DeathByCaptcha(Hook): task.setWaiting(180) start_new_thread(self.processCaptcha, (task,)) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - response = self.call_api("captcha/%d/report" % task.data['ticket'], True) + res = self.call_api("captcha/%d/report" % task.data['ticket'], True) + except DeathByCaptchaException, e: self.logError(e.getDesc()) + except Exception, e: self.logError(e) + def processCaptcha(self, task): c = task.captchaFile try: diff --git a/pyload/plugins/hook/DebridItaliaCom.py b/pyload/plugins/hook/DebridItaliaCom.py index 4a12f052a..9c8f866f0 100644 --- a/pyload/plugins/hook/DebridItaliaCom.py +++ b/pyload/plugins/hook/DebridItaliaCom.py @@ -4,18 +4,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): - __name__ = "DebridItaliaCom" - __type__ = "hook" + __name__ = "DebridItaliaCom" + __type__ = "hook" __version__ = "0.07" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Debriditalia.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/EasybytezCom.py b/pyload/plugins/hook/EasybytezCom.py index c920f4069..15033c8e7 100644 --- a/pyload/plugins/hook/EasybytezCom.py +++ b/pyload/plugins/hook/EasybytezCom.py @@ -6,16 +6,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class EasybytezCom(MultiHoster): - __name__ = "EasybytezCom" - __type__ = "hook" + __name__ = "EasybytezCom" + __type__ = "hook" __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """EasyBytez.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def getHoster(self): diff --git a/pyload/plugins/hook/ExpertDecoders.py b/pyload/plugins/hook/ExpertDecoders.py index e843d8773..933355fbe 100644 --- a/pyload/plugins/hook/ExpertDecoders.py +++ b/pyload/plugins/hook/ExpertDecoders.py @@ -13,36 +13,38 @@ from pyload.plugins.base.Hook import Hook class ExpertDecoders(Hook): - __name__ = "ExpertDecoders" - __type__ = "hook" + __name__ = "ExpertDecoders" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force CT even if client is connected", False), + __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] __description__ = """Send captchas to expertdecoders.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] API_URL = "http://www.fasttypers.org/imagepost.ashx" def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) + res = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) - if response.isdigit(): - self.logInfo(_("%s credits left") % response) - self.info['credits'] = credits = int(response) + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + self.info['credits'] = credits = int(res) return credits else: - self.logError(response) + self.logError(res) return 0 + def processCaptcha(self, task): task.data['ticket'] = ticket = uuid4() result = None @@ -64,6 +66,7 @@ class ExpertDecoders(Hook): self.logDebug("Result %s : %s" % (ticket, result)) task.setResult(result) + def newCaptchaTask(self, task): if not task.isTextual(): return False @@ -82,13 +85,14 @@ class ExpertDecoders(Hook): else: self.logInfo(_("Your ExpertDecoders Account has not enough credits")) + def captchaInvalid(self, task): if "ticket" in task.data: try: - response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"), - "gen_task_id": task.data['ticket']}) - self.logInfo(_("Request refund"), response) + res = getURL(self.API_URL, + post={'action': "refund", 'key': self.getConfig("passkey"), 'gen_task_id': task.data['ticket']}) + self.logInfo(_("Request refund", res) except BadHeader, e: - self.logError(_("Could not send refund request."), e) + self.logError(_("Could not send refund request"), e) diff --git a/pyload/plugins/hook/FastixRu.py b/pyload/plugins/hook/FastixRu.py index 8247a592c..a7a5e6b8c 100644 --- a/pyload/plugins/hook/FastixRu.py +++ b/pyload/plugins/hook/FastixRu.py @@ -6,17 +6,17 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class FastixRu(MultiHoster): - __name__ = "FastixRu" - __type__ = "hook" + __name__ = "FastixRu" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Fastix.ru hook plugin""" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] + __license__ = "GPLv3" + __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] def getHoster(self): diff --git a/pyload/plugins/hook/FreeWayMe.py b/pyload/plugins/hook/FreeWayMe.py index 2db2a1a4d..b9955c90a 100644 --- a/pyload/plugins/hook/FreeWayMe.py +++ b/pyload/plugins/hook/FreeWayMe.py @@ -5,18 +5,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class FreeWayMe(MultiHoster): - __name__ = "FreeWayMe" - __type__ = "hook" + __name__ = "FreeWayMe" + __type__ = "hook" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """FreeWay.me hook plugin""" - __authors__ = [("Nicolas Giese", "james@free-way.me")] + __license__ = "GPLv3" + __authors__ = [("Nicolas Giese", "james@free-way.me")] def getHoster(self): diff --git a/pyload/plugins/hook/ImageTyperz.py b/pyload/plugins/hook/ImageTyperz.py index b26eaceea..b79fd42ba 100644 --- a/pyload/plugins/hook/ImageTyperz.py +++ b/pyload/plugins/hook/ImageTyperz.py @@ -17,29 +17,32 @@ class ImageTyperzException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<ImageTyperzException %s>" % self.err + def __repr__(self): return "<ImageTyperzException %s>" % self.err class ImageTyperz(Hook): - __name__ = "ImageTyperz" - __type__ = "hook" + __name__ = "ImageTyperz" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("username", "str", "Username", ""), + __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), ("force", "bool", "Force IT even if client is connected", False)] __description__ = """Send captchas to ImageTyperz.com""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] SUBMIT_URL = "http://captchatypers.com/Forms/UploadFileAndGetTextNEW.ashx" @@ -48,23 +51,27 @@ class ImageTyperz(Hook): def setup(self): - self.info = {} + self.info = {} #@TODO: Remove in 0.4.10 + def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"action": "REQUESTBALANCE", "username": self.getConfig("username"), - "password": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, + post={'action': "REQUESTBALANCE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey")}) - if response.startswith('ERROR'): - raise ImageTyperzException(response) + if res.startswith('ERROR'): + raise ImageTyperzException(res) try: - balance = float(response) + balance = float(res) except: - raise ImageTyperzException("invalid response") + raise ImageTyperzException("Invalid response") - self.logInfo(_("Account balance: $%s left") % response) + self.logInfo(_("Account balance: $%s left") % res) return balance + def submit(self, captcha, captchaType="file", match=None): req = getRequest() #raise timeout threshold @@ -72,7 +79,7 @@ class ImageTyperz(Hook): try: #workaround multipart-post bug in HTTPRequest.py - if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")): + if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) else: @@ -81,24 +88,26 @@ class ImageTyperz(Hook): data = f.read() data = b64encode(data) - response = req.load(self.SUBMIT_URL, post={"action": "UPLOADCAPTCHA", - "username": self.getConfig("username"), - "password": self.getConfig("passkey"), "file": data}, - multipart=multipart) + res = req.load(self.SUBMIT_URL, + post={'action': "UPLOADCAPTCHA", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), "file": data}, + multipart=multipart) finally: req.close() - if response.startswith("ERROR"): - raise ImageTyperzException(response) + if res.startswith("ERROR"): + raise ImageTyperzException(res) else: - data = response.split('|') + data = res.split('|') if len(data) == 2: ticket, result = data else: - raise ImageTyperzException("Unknown response %s" % response) + raise ImageTyperzException("Unknown response: %s" % res) return ticket, result + def newCaptchaTask(self, task): if "service" in task.data: return False @@ -121,16 +130,20 @@ class ImageTyperz(Hook): else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = getURL(self.RESPOND_URL, post={"action": "SETBADIMAGE", "username": self.getConfig("username"), - "password": self.getConfig("passkey"), - "imageid": task.data['ticket']}) + res = getURL(self.RESPOND_URL, + post={'action': "SETBADIMAGE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), + 'imageid': task.data['ticket']}) - if response == "SUCCESS": + if res == "SUCCESS": self.logInfo(_("Bad captcha solution received, requested refund")) else: - self.logError(_("Bad captcha solution received, refund request failed"), response) + self.logError(_("Bad captcha solution received, refund request failed"), res) + def processCaptcha(self, task): c = task.captchaFile diff --git a/pyload/plugins/hook/LinkdecrypterCom.py b/pyload/plugins/hook/LinkdecrypterCom.py index ea1e54b30..8455ed904 100644 --- a/pyload/plugins/hook/LinkdecrypterCom.py +++ b/pyload/plugins/hook/LinkdecrypterCom.py @@ -8,14 +8,13 @@ from pyload.utils import remove_chars class LinkdecrypterCom(Hook): - __name__ = "LinkdecrypterCom" - __type__ = "hook" - __version__ = "0.19" - - __config__ = [("activated", "bool", "Activated", False)] + __name__ = "LinkdecrypterCom" + __type__ = "hook" + __version__ = "0.20" __description__ = """Linkdecrypter.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def coreReady(self): @@ -24,9 +23,16 @@ class LinkdecrypterCom(Hook): except Exception, e: self.logError(e) + def loadPatterns(self): - page = getURL("http://linkdecrypter.com/") - m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page) + html = getURL("http://linkdecrypter.com/") + + m = re.search(r'<title>', html) + if m is None: + self.logError(_("Linkdecrypter site is down")) + return + + m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', html) if m is None: self.logError(_("Crypter list not found")) return @@ -45,10 +51,10 @@ class LinkdecrypterCom(Hook): self.logError(_("Crypter list is empty")) return - regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) + regexp = r'https?://([^.]+\.)*?(%s)/.*' % '|'.join(online) dict = self.core.pluginManager.crypterPlugins[self.__name__] dict['pattern'] = regexp dict['re'] = re.compile(regexp) - self.logDebug("REGEXP", regexp) + self.logDebug("Loaded pattern: %s" % regexp) diff --git a/pyload/plugins/hook/LinksnappyCom.py b/pyload/plugins/hook/LinksnappyCom.py index 0cf913f60..0957b6a91 100644 --- a/pyload/plugins/hook/LinksnappyCom.py +++ b/pyload/plugins/hook/LinksnappyCom.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class LinksnappyCom(MultiHoster): - __name__ = "LinksnappyCom" - __type__ = "hook" + __name__ = "LinksnappyCom" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Linksnappy.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/MegaDebridEu.py b/pyload/plugins/hook/MegaDebridEu.py index bf6997117..6c3e2b03a 100644 --- a/pyload/plugins/hook/MegaDebridEu.py +++ b/pyload/plugins/hook/MegaDebridEu.py @@ -6,15 +6,15 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class MegaDebridEu(MultiHoster): - __name__ = "MegaDebridEu" - __type__ = "hook" + __name__ = "MegaDebridEu" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("unloadFailing", "bool", "Revert to standard download if download fails", False)] + __config__ = [("unloadFailing", "bool", "Revert to standard download if download fails", False)] __description__ = """mega-debrid.eu hook plugin""" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] + __license__ = "GPLv3" + __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] def getHoster(self): diff --git a/pyload/plugins/hook/MultishareCz.py b/pyload/plugins/hook/MultishareCz.py index d8396b44f..f1a12acb8 100644 --- a/pyload/plugins/hook/MultishareCz.py +++ b/pyload/plugins/hook/MultishareCz.py @@ -7,16 +7,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class MultishareCz(MultiHoster): - __name__ = "MultishareCz" - __type__ = "hook" + __name__ = "MultishareCz" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")] __description__ = """MultiShare.cz hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"' diff --git a/pyload/plugins/hook/MyfastfileCom.py b/pyload/plugins/hook/MyfastfileCom.py index e476c10b5..affaa2261 100644 --- a/pyload/plugins/hook/MyfastfileCom.py +++ b/pyload/plugins/hook/MyfastfileCom.py @@ -6,18 +6,19 @@ from pyload.utils import json_loads class MyfastfileCom(MultiHoster): - __name__ = "MyfastfileCom" - __type__ = "hook" + __name__ = "MyfastfileCom" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Myfastfile.com hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugins/hook/OverLoadMe.py b/pyload/plugins/hook/OverLoadMe.py index 347509a8b..2766165fd 100644 --- a/pyload/plugins/hook/OverLoadMe.py +++ b/pyload/plugins/hook/OverLoadMe.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class OverLoadMe(MultiHoster): - __name__ = "OverLoadMe" - __type__ = "hook" + __name__ = "OverLoadMe" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", True), + __config__ = [("https", "bool", "Enable HTTPS", True), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 12)] __description__ = """Over-Load.me hook plugin""" - __authors__ = [("marley", "marley@over-load.me")] + __license__ = "GPLv3" + __authors__ = [("marley", "marley@over-load.me")] def getHoster(self): diff --git a/pyload/plugins/hook/PremiumTo.py b/pyload/plugins/hook/PremiumTo.py index eb5f16a83..e3c9823f6 100644 --- a/pyload/plugins/hook/PremiumTo.py +++ b/pyload/plugins/hook/PremiumTo.py @@ -5,18 +5,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class PremiumTo(MultiHoster): - __name__ = "PremiumTo" - __type__ = "hook" + __name__ = "PremiumTo" + __type__ = "hook" __version__ = "0.04" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Premium.to hook plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] @@ -25,6 +25,7 @@ class PremiumTo(MultiHoster): get={'username': self.account.username, 'password': self.account.password}) return [x.strip() for x in page.replace("\"", "").split(";")] + def coreReady(self): self.account = self.core.accountManager.getAccountPlugin("PremiumTo") diff --git a/pyload/plugins/hook/PremiumizeMe.py b/pyload/plugins/hook/PremiumizeMe.py index 9d18f45fc..a751e7b61 100644 --- a/pyload/plugins/hook/PremiumizeMe.py +++ b/pyload/plugins/hook/PremiumizeMe.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class PremiumizeMe(MultiHoster): - __name__ = "PremiumizeMe" - __type__ = "hook" + __name__ = "PremiumizeMe" + __type__ = "hook" __version__ = "0.12" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Premiumize.me hook plugin""" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] def getHoster(self): @@ -41,12 +41,13 @@ class PremiumizeMe(MultiHoster): # Extract hosters from json file return data['result']['hosterlist'] + def coreReady(self): # Get account plugin and check if there is a valid account available self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe") if not self.account.canUse(): self.account = None - self.logError(_("Please add a valid premiumize.me account first and restart pyLoad.")) + self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) return # Run the overwriten core ready which actually enables the multihoster hook diff --git a/pyload/plugins/hook/RPNetBiz.py b/pyload/plugins/hook/RPNetBiz.py index 9e04f1dfd..3bbdcf839 100644 --- a/pyload/plugins/hook/RPNetBiz.py +++ b/pyload/plugins/hook/RPNetBiz.py @@ -6,18 +6,18 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RPNetBiz(MultiHoster): - __name__ = "RPNetBiz" - __type__ = "hook" + __name__ = "RPNetBiz" + __type__ = "hook" __version__ = "0.1" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """RPNet.biz hook plugin""" - __authors__ = [("Dman", "dmanugm@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("Dman", "dmanugm@gmail.com")] def getHoster(self): @@ -28,9 +28,9 @@ class RPNetBiz(MultiHoster): # Get account data (user, data) = self.account.selectAccount() - response = getURL("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], "action": "showHosterList"}) - hoster_list = json_loads(response) + res = getURL("https://premium.rpnet.biz/client_api.php", + get={"username": user, "password": data['password'], "action": "showHosterList"}) + hoster_list = json_loads(res) # If account is not valid thera are no hosters available if 'error' in hoster_list: @@ -39,6 +39,7 @@ class RPNetBiz(MultiHoster): # Extract hosters from json file return hoster_list['hosters'] + def coreReady(self): # Get account plugin and check if there is a valid account available self.account = self.core.accountManager.getAccountPlugin("RPNetBiz") diff --git a/pyload/plugins/hook/RealdebridCom.py b/pyload/plugins/hook/RealdebridCom.py index 8329da7e7..a6f79a97d 100644 --- a/pyload/plugins/hook/RealdebridCom.py +++ b/pyload/plugins/hook/RealdebridCom.py @@ -5,19 +5,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RealdebridCom(MultiHoster): - __name__ = "RealdebridCom" - __type__ = "hook" + __name__ = "RealdebridCom" + __type__ = "hook" __version__ = "0.43" - __config__ = [("activated", "bool", "Activated", False), - ("https", "bool", "Enable HTTPS", False), + __config__ = [("https", "bool", "Enable HTTPS", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Real-Debrid.com hook plugin""" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + __license__ = "GPLv3" + __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] def getHoster(self): diff --git a/pyload/plugins/hook/RehostTo.py b/pyload/plugins/hook/RehostTo.py index f38074a7b..2c8739869 100644 --- a/pyload/plugins/hook/RehostTo.py +++ b/pyload/plugins/hook/RehostTo.py @@ -5,24 +5,25 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class RehostTo(MultiHoster): - __name__ = "RehostTo" - __type__ = "hook" + __name__ = "RehostTo" + __type__ = "hook" __version__ = "0.43" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Rehost.to hook plugin""" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org")] def getHoster(self): page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) return [x.strip() for x in page.replace("\"", "").split(",")] + def coreReady(self): self.account = self.core.accountManager.getAccountPlugin("RehostTo") diff --git a/pyload/plugins/hook/SimplyPremiumCom.py b/pyload/plugins/hook/SimplyPremiumCom.py index 62f5ba778..a0f41901c 100644 --- a/pyload/plugins/hook/SimplyPremiumCom.py +++ b/pyload/plugins/hook/SimplyPremiumCom.py @@ -6,8 +6,8 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class SimplyPremiumCom(MultiHoster): - __name__ = "SimplyPremiumCom" - __type__ = "hook" + __name__ = "SimplyPremiumCom" + __type__ = "hook" __version__ = "0.02" __config__ = [("activated", "bool", "Activated", "False"), @@ -17,7 +17,8 @@ class SimplyPremiumCom(MultiHoster): ("interval", "int", "Reload interval in hours (0 to disable)", "24")] __description__ = """Simply-Premium.com hook plugin""" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def getHoster(self): diff --git a/pyload/plugins/hook/SimplydebridCom.py b/pyload/plugins/hook/SimplydebridCom.py index 25373449b..4668da45b 100644 --- a/pyload/plugins/hook/SimplydebridCom.py +++ b/pyload/plugins/hook/SimplydebridCom.py @@ -5,16 +5,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class SimplydebridCom(MultiHoster): - __name__ = "SimplydebridCom" - __type__ = "hook" + __name__ = "SimplydebridCom" + __type__ = "hook" __version__ = "0.01" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Simply-Debrid.com hook plugin""" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] + __license__ = "GPLv3" + __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] def getHoster(self): diff --git a/pyload/plugins/hook/UnrestrictLi.py b/pyload/plugins/hook/UnrestrictLi.py index 4caedf550..cfe580048 100644 --- a/pyload/plugins/hook/UnrestrictLi.py +++ b/pyload/plugins/hook/UnrestrictLi.py @@ -6,19 +6,19 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class UnrestrictLi(MultiHoster): - __name__ = "UnrestrictLi" - __type__ = "hook" + __name__ = "UnrestrictLi" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), ("unloadFailing", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24), ("history", "bool", "Delete History", False)] __description__ = """Unrestrict.li hook plugin""" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] def getHoster(self): diff --git a/pyload/plugins/hook/XFileSharingPro.py b/pyload/plugins/hook/XFileSharingPro.py index d9ccda796..3f70f88f3 100644 --- a/pyload/plugins/hook/XFileSharingPro.py +++ b/pyload/plugins/hook/XFileSharingPro.py @@ -6,17 +6,42 @@ from pyload.plugins.base.Hook import Hook class XFileSharingPro(Hook): - __name__ = "XFileSharingPro" - __type__ = "hook" - __version__ = "0.12" + __name__ = "XFileSharingPro" + __type__ = "hook" + __version__ = "0.22" __config__ = [("activated", "bool", "Activated", True), - ("load_default", "bool", "Include default (built-in) hoster list", True), - ("include_hosters", "str", "Include hosters (comma separated)", ""), - ("exclude_hosters", "str", "Exclude hosters (comma separated)", "")] + ("use_hoster_list", "bool", "Load listed hosters only", False), + ("use_crypter_list", "bool", "Load listed crypters only", False), + ("use_builtin_list", "bool", "Load built-in plugin list", True), + ("hoster_list", "str", "Hoster list (comma separated)", ""), + ("crypter_list", "str", "Crypter list (comma separated)", "")] - __description__ = """XFileSharingPro hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __description__ = """Load XFileSharingPro based hosters and crypter which don't need a own plugin to run""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + # event_list = ["pluginConfigChanged"] + regexp = {'hoster' : (r'https?://(?:www\.)?([\w^_]+(?:\.[a-zA-Z]{2,})+(?:\:\d+)?)/(?:embed-)?\w{12}', + r'https?://(?:[^/]+\.)?(%s)/(?:embed-)?\w{12}\W?'), + 'crypter': (r'https?://(?:www\.)?([\w^_]+(?:\.[a-zA-Z]{2,})+(?:\:\d+)?)/(?:user|folder)s?/\w+', + r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')} + + HOSTER_LIST = [#WORKING HOSTERS: + "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", + "linestorage.com", "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + #NOT TESTED: + "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", + "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", + "vidbull.com", "zalaa.com", "zomgupload.com", + #NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] + CRYPTER_LIST = [] + + + # def pluginConfigChanged(self.__name__, plugin, name, value): + # self.loadPattern() def coreReady(self): @@ -24,56 +49,50 @@ class XFileSharingPro(Hook): def loadPattern(self): - hoster_list = self.getConfigSet('include_hosters') - exclude_list = self.getConfigSet('exclude_hosters') - - if self.getConfig('load_default'): - hoster_list |= set(( - #WORKING HOSTERS: - "aieshare.com", "asixfiles.com", "banashare.com", "cyberlocker.ch", "eyesfile.co", "eyesfile.com", - "fileband.com", "filedwon.com", "filedownloads.org", "hipfile.com", "kingsupload.com", "mlfat4arab.com", - "netuploaded.com", "odsiebie.pl", "q4share.com", "ravishare.com", "uptobox.com", "verzend.be", - "xvidstage.com", "thefile.me", "sharesix.com", "hostingbulk.com", - #NOT TESTED: - "bebasupload.com", "boosterking.com", "divxme.com", "filevelocity.com", "glumbouploads.com", - "grupload.com", "heftyfile.com", "host4desi.com", "laoupload.com", "linkzhost.com", "movreel.com", - "rockdizfile.com", "limfile.com", "share76.com", "sharebeast.com", "sharehut.com", "sharerun.com", - "shareswift.com", "sharingonline.com", "6ybh-upload.com", "skipfile.com", "spaadyshare.com", - "space4file.com", "uploadbaz.com", "uploadc.com", "uploaddot.com", "uploadfloor.com", "uploadic.com", - "uploadville.com", "vidbull.com", "zalaa.com", "zomgupload.com", "kupload.org", "movbay.org", - "multishare.org", "omegave.org", "toucansharing.org", "uflinq.org", "banicrazy.info", "flowhot.info", - "upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc", "farshare.to", - "filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com", "sharesix.com", - "thefile.me", "filenuke.com", "sharerepo.com", "mightyupload.com", - #WRONG FILE NAME: - "sendmyway.com", "upchi.co.il", - #NOT WORKING: - "amonshare.com", "imageporter.com", "file4safe.com", - #DOWN OR BROKEN: - "ddlanime.com", "fileforth.com", "loombo.com", "goldfile.eu", "putshare.com" - )) - - hoster_list -= (exclude_list) - hoster_list -= set(('', u'')) - - if not hoster_list: - self.unload() - return - - regexp = r"http://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}" % ("|".join(sorted(hoster_list)).replace('.', '\.')) - - dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] - dict['pattern'] = regexp - dict['re'] = re.compile(regexp) - self.logDebug("Pattern loaded - handling %d hosters" % len(hoster_list)) - - - def getConfigSet(self, option): - s = self.getConfig(option).lower().replace('|', ',').replace(';', ',') - return set([x.strip() for x in s.split(',')]) + use_builtin_list = self.getConfig('use_builtin_list') + for type, plugin in (("hoster", "XFileSharingPro"), + ("crypter", "XFileSharingProFolder")): + every_plugin = not self.getConfig("use_%s_list" % type) - def unload(self): - dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] + if every_plugin: + self.logInfo(_("Handling any %s I can!") % type) + pattern = self.regexp[type][0] + else: + s = self.getConfig('%s_list' % type).replace('\\', '').replace('|', ',').replace(';', ',').lower() + plugin_list = set([x.strip() for x in s.split(',')]) + + if use_builtin_list: + plugin_list |= set([x.lower() for x in getattr(self, "%s_LIST" % type.upper())]) + + plugin_list -= set(('', u'')) + + if not plugin_list: + self.logInfo(_("No %s to handle") % type) + self._unload(type, plugin) + return + + match_list = '|'.join(sorted(plugin_list)) + + len_match_list = len(plugin_list) + self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, "" if len_match_list is 1 else "s", match_list.replace('|', ', '))) + + pattern = self.regexp[type][1] % match_list.replace('.', '\.') + + dict = self.core.pluginManager.plugins[type][plugin] + dict['pattern'] = pattern + dict['re'] = re.compile(pattern) + + self.logDebug("Loaded %s pattern: %s" % (type, pattern)) + + + def _unload(self, type, plugin): + dict = self.core.pluginManager.plugins[type][plugin] dict['pattern'] = r'^unmatchable$' - dict['re'] = re.compile(r'^unmatchable$') + dict['re'] = re.compile(dict['pattern']) + + + def unload(self): + for type, plugin in (("hoster", "XFileSharingPro"), + ("crypter", "XFileSharingProFolder")): + self._unload(type, plugin) diff --git a/pyload/plugins/hook/ZeveraCom.py b/pyload/plugins/hook/ZeveraCom.py index 2a6168008..09e3953a2 100644 --- a/pyload/plugins/hook/ZeveraCom.py +++ b/pyload/plugins/hook/ZeveraCom.py @@ -5,16 +5,16 @@ from pyload.plugins.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): - __name__ = "ZeveraCom" - __type__ = "hook" + __name__ = "ZeveraCom" + __type__ = "hook" __version__ = "0.02" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Real-Debrid.com hook plugin""" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] def getHoster(self): |