diff options
-rw-r--r-- | module/plugins/accounts/LinksnappyCom.py | 5 | ||||
-rw-r--r-- | module/plugins/hooks/AndroidPhoneNotify.py | 9 | ||||
-rw-r--r-- | module/plugins/hooks/ClickAndLoad.py | 33 | ||||
-rw-r--r-- | module/plugins/hooks/SkipRev.py | 10 | ||||
-rw-r--r-- | module/plugins/hooks/WindowsPhoneNotify.py (renamed from module/plugins/hooks/WindowsPhoneToastNotify.py) | 13 | ||||
-rw-r--r-- | module/plugins/hoster/FileStoreTo.py | 12 | ||||
-rw-r--r-- | module/plugins/hoster/MystoreTo.py | 45 | ||||
-rw-r--r-- | module/plugins/hoster/UpleaCom.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 10 | ||||
-rw-r--r-- | module/plugins/internal/CaptchaService.py | 92 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/XFSHoster.py | 27 |
13 files changed, 146 insertions, 121 deletions
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index dff28a055..97e368285 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,8 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.04" - + __version__ = "0.05" __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -42,7 +41,7 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = self.parseTraffic(float(j['return']['trafficleft'] + "MB") + trafficleft = self.parseTraffic("%d MB" % j['return']['trafficleft']) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index fbc2acd5c..a3b24a255 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.05" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), @@ -33,14 +33,15 @@ class AndroidPhoneNotify(Hook): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 def newCaptchaTask(self, task): if not self.getConfig("notifycaptcha"): return False - if time() - float(self.getStorage("AndroidPhoneNotify", 0)) < self.getConf("timeout"): + if time() - self.last_notify < self.getConf("timeout"): return False self.notify(_("Captcha"), _("New request waiting user input")) @@ -76,4 +77,4 @@ class AndroidPhoneNotify(Hook): 'event' : event, 'description': msg}) - self.setStorage("AndroidPhoneNotify", time()) + self.last_notify = time() diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 0bcd6ddef..d0f340aae 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -3,23 +3,22 @@ import socket from threading import Thread, Lock -from time import sleep from module.plugins.Hook import Hook, threaded def forward(source, destination): try: - size = 1024 - data = source.recv(size) + bufsize = 1024 + data = source.recv(bufsize) while data: destination.sendall(data) - data = source.recv(size) + data = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) -#: socket.create_connection wrapper for python 2.5 +#: create_connection wrapper for python 2.5 socket module def create_connection(address, timeout=object(), source_address=None): if hasattr(socket, 'create_connection'): if type(timeout) == object: @@ -56,7 +55,7 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.33" + __version__ = "0.34" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -72,7 +71,7 @@ class ClickAndLoad(Hook): if not self.config['webinterface']['activated']: return - ip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" + ip = socket.gethostbyname(socket.gethostname()) if self.getConfig("extern") else "127.0.0.1" webport = int(self.config['webinterface']['port']) cnlport = self.getConfig('port') @@ -89,22 +88,24 @@ class ClickAndLoad(Hook): def server(self, ip, webport, cnlport): try: - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - dock_socket.bind((ip, cnlport)) - dock_socket.listen(5) + server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + server_socket.bind((ip, cnlport)) + server_socket.listen(5) while True: - client_socket = dock_socket.accept()[0] - server_socket = create_connection(("127.0.0.1", webport)) + client_socket = server_socket.accept()[0] + dock_socket = create_connection(("127.0.0.1", webport)) - self.manager.startThread(forward, client_socket, server_socket) - self.manager.startThread(forward, server_socket, client_socket) + self.manager.startThread(forward, client_socket, dock_socket) + self.manager.startThread(forward, dock_socket, client_socket) + + client_socket.close() + dock_socket.close() except socket.error, e: self.logDebug(e) self.server(ip, webport, cnlport) finally: - client_socket.close() server_socket.close() - dock_socket.close() diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 51d385bb4..0bbdec3b2 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.24" + __version__ = "0.25" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -60,10 +60,12 @@ class SkipRev(Hook): tokeep = self.getConfig("tokeep") if tokeep: - saved = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ - if link.name.endswith(".rev") and link.status in (0, 12)].count(True) + status_list = (1, 4, 8, 9, 14) if tokeep < 0 else (1, 3, 4, 8, 9, 14) - if not saved or saved < tokeep: #: keep one rev at least in auto mode + queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ + if link.name.endswith(".rev") and link.status not in status_list].count(True) + + if not queued or queued < tokeep: #: keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index 20686ee36..e0dd75f92 100644 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -7,10 +7,10 @@ from time import time from module.plugins.Hook import Hook -class WindowsPhoneToastNotify(Hook): - __name__ = "WindowsPhoneToastNotify" +class WindowsPhoneNotify(Hook): + __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.07" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), @@ -35,14 +35,15 @@ class WindowsPhoneToastNotify(Hook): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 def newCaptchaTask(self, task): if not self.getConfig("notifycaptcha"): return False - if time() - float(self.getStorage("WindowsPhoneToastNotify", 0)) < self.getConf("timeout"): + if time() - self.last_notify < self.getConf("timeout"): return False self.notify(_("Captcha"), _("New request waiting user input")) @@ -92,4 +93,4 @@ class WindowsPhoneToastNotify(Hook): webservice.send(request) webservice.close() - self.setStorage("WindowsPhoneToastNotify", time()) + self.last_notify = time() diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index 7b93c03f1..ad3feba1b 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' @@ -18,8 +18,9 @@ class FileStoreTo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - INFO_PATTERN = r'File: <span[^>]*>(?P<N>.+)</span><br />Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + INFO_PATTERN = r'File: <span.*?>(?P<N>.+?)<.*>Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + TEMP_OFFLINE_PATTERN = r'>Der Download ist nicht bereit !<' def setup(self): @@ -29,9 +30,8 @@ class FileStoreTo(SimpleHoster): def handleFree(self, pyfile): self.wait(10) - ldc = re.search(r'wert="(\w+)"', self.html).group(1) - link = self.load("http://filestore.to/ajax/download.php", get={"LDC": ldc}) - self.download(link) + self.link = self.load("http://filestore.to/ajax/download.php", + get={'D': re.search(r'"D=(\w+)', self.html).group(1)}) getInfo = create_getInfo(FileStoreTo) diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py new file mode 100644 index 000000000..3bb424d4d --- /dev/null +++ b/module/plugins/hoster/MystoreTo.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# Test link: +# http://mystore.to/dl/mxcA50jKfP + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class MystoreTo(SimpleHoster): + __name__ = "MystoreTo" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)?mystore\.to/dl/.+' + + __description__ = """Mystore.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "")] + + + NAME_PATTERN = r'<h1>(?P<N>.+?)<' + SIZE_PATTERN = r'FILESIZE: (?P<S>[\d\.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>file not found<' + + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + + + def handleFree(self, pyfile): + try: + fid = re.search(r'wert="(.+?)"', self.html).group(1) + + except AttributeError: + self.error(_("File-ID not found")) + + self.link = self.load("http://mystore.to/api/download", + post={'FID': fid}) + + +getInfo = create_getInfo(MystoreTo) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 8faad1d8f..59c593c93 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -52,8 +52,8 @@ class UpleaCom(XFSHoster): if m is None: self.error(_("LINK_PATTERN not found")) - self.wait(15) self.link = m.group(1) + self.wait(15) getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index c83814198..83a16c251 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.82" + __version__ = "0.84" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' @@ -56,7 +56,6 @@ class UploadedTo(SimpleHoster): def setup(self): self.multiDL = self.resumeDownload = self.premium self.chunkLimit = 1 # critical problems with more chunks - self.load("http://uploaded.net/language/en", just_header=True) def checkErrors(self): @@ -88,6 +87,8 @@ class UploadedTo(SimpleHoster): def handleFree(self, pyfile): + self.load("http://uploaded.net/language/en", just_header=True) + self.html = self.load("http://uploaded.net/js/download.js", decode=True) recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index ac5e744a7..47a4acd03 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.70" + __version__ = "0.71" __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' @@ -51,11 +51,9 @@ class ZippyshareCom(SimpleHoster): def get_checksum(self): try: - z = int(re.search(r'var z = (\d+)', self.html).group(1)) - n = (z - 3) % 2 - b = (z - 3) % 3 - - checksum = n + b + z - 3 + m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html) + a1, a2, c1, c2 = map(int, m.groups()) + checksum = (a1 % a2) + (c1 % c2) except Exception: self.error(_("Unable to calculate checksum")) diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 8f6a5086d..6f2c8e06d 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -8,11 +8,13 @@ from random import random, randint from urlparse import urljoin, urlparse from module.common.json_layer import json_loads +from module.plugins.Plugin import Base -class CaptchaService(object): +#@TODO: Extend (new) Plugin class; remove all `html` args +class CaptchaService(Base): __name__ = "CaptchaService" - __version__ = "0.24" + __version__ = "0.25" __description__ = """Base captcha service plugin""" __license__ = "GPLv3" @@ -24,6 +26,7 @@ class CaptchaService(object): def __init__(self, plugin): self.plugin = plugin + super(CaptchaService, self).__init__(plugin.core) def detect_key(self, html=None): @@ -40,7 +43,7 @@ class CaptchaService(object): class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" - __version__ = "0.13" + __version__ = "0.14" __description__ = """ReCaptcha captcha service plugin""" __license__ = "GPLv3" @@ -65,10 +68,10 @@ class ReCaptcha(CaptchaService): m = re.search(self.KEY_V2_PATTERN, html) or re.search(self.KEY_V1_PATTERN, html) if m: self.key = m.group(1).strip() - self.plugin.logDebug("ReCaptcha key: %s" % self.key) + self.logDebug("Key: %s" % self.key) return self.key else: - self.plugin.logDebug("ReCaptcha key not found") + self.logDebug("Key not found") return None @@ -82,7 +85,7 @@ class ReCaptcha(CaptchaService): raise TypeError(errmsg) if version in (1, 2): - return getattr(self, "_challenge_v%s" % version)(key, html) + return getattr(self, "_challenge_v%s" % version)(key) elif not html and hasattr(self.plugin, "html") and self.plugin.html: version = 2 if re.search(self.KEY_V2_PATTERN, self.plugin.html) else 1 @@ -106,7 +109,7 @@ class ReCaptcha(CaptchaService): self.plugin.fail(errmsg) raise AttributeError(errmsg) - self.plugin.logDebug("ReCaptcha challenge: %s" % challenge) + self.logDebug("Challenge: %s" % challenge) return self.result(server, challenge), challenge @@ -118,7 +121,7 @@ class ReCaptcha(CaptchaService): forceUser=True, imgtype="jpg") - self.plugin.logDebug("ReCaptcha result: %s" % result) + self.logDebug("Result: %s" % result) return result @@ -128,17 +131,17 @@ class ReCaptcha(CaptchaService): a = re.search(r'po.src = \'(.*?)\';', html).group(1) vers = a.split("/")[5] - self.plugin.logDebug("ReCaptcha API version: %s" %vers) + self.logDebug("API version: %s" %vers) language = a.split("__")[1].split(".")[0] - self.plugin.logDebug("ReCaptcha API language: %s" % language) + self.logDebug("API language: %s" % language) html = self.plugin.req.load("https://apis.google.com/js/api.js") b = re.search(r'"h":"(.*?)","', html).group(1) jsh = b.decode('unicode-escape') - self.plugin.logDebug("ReCaptcha API jsh-string: %s" % jsh) + self.logDebug("API jsh-string: %s" % jsh) return vers, language, jsh @@ -148,13 +151,13 @@ class ReCaptcha(CaptchaService): millis = int(round(time.time() * 1000)) - self.plugin.logDebug("ReCaptcha time: %s" % millis) + self.logDebug("Time: %s" % millis) rand = randint(1, 99999999) a = "0.%s" % str(rand * 2147483647) rpc = int(100000000 * float(a)) - self.plugin.logDebug("ReCaptcha rpc-token: %s" % rpc) + self.logDebug("Rpc-token: %s" % rpc) return millis, rpc @@ -182,7 +185,7 @@ class ReCaptcha(CaptchaService): 'rpctoken': rpc}) token1 = re.search(r'id="recaptcha-token" value="(.*?)">', html) - self.plugin.logDebug("ReCaptcha token #1: %s" % token1.group(1)) + self.logDebug("Token #1: %s" % token1.group(1)) html = self.plugin.req.load("https://www.google.com/recaptcha/api2/frame", get={'c' : token1.group(1), @@ -194,10 +197,10 @@ class ReCaptcha(CaptchaService): 'jsh' : jsh}).decode('unicode-escape') token2 = re.search(r'"finput","(.*?)",', html) - self.plugin.logDebug("ReCaptcha token #2: %s" % token2.group(1)) + self.logDebug("Token #2: %s" % token2.group(1)) token3 = re.search(r'."asconf".\s,".*?".\s,"(.*?)".', html) - self.plugin.logDebug("ReCaptcha token #3: %s" % token3.group(1)) + self.logDebug("Token #3: %s" % token3.group(1)) html = self.plugin.req.load("https://www.google.com/recaptcha/api2/reload", post={'k' : key, @@ -206,7 +209,7 @@ class ReCaptcha(CaptchaService): 'fbg' : token3.group(1)}) token4 = re.search(r'"rresp","(.*?)",', html) - self.plugin.logDebug("ReCaptcha token #4: %s" % token4.group(1)) + self.logDebug("Token #4: %s" % token4.group(1)) millis_captcha_loading = int(round(time.time() * 1000)) captcha_response = self.plugin.decryptCaptcha("https://www.google.com/recaptcha/api2/payload", @@ -215,7 +218,7 @@ class ReCaptcha(CaptchaService): forceUser=True) response = b64encode('{"response":"%s"}' % captcha_response) - self.plugin.logDebug("ReCaptcha result: %s" % response) + self.logDebug("Result: %s" % response) timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading timeToSolveMore = timeToSolve + int(float("0." + str(randint(1, 99999999))) * 500) @@ -229,7 +232,7 @@ class ReCaptcha(CaptchaService): 'bg' : botguardstring}) token5 = re.search(r'"uvresp","(.*?)",', html) - self.plugin.logDebug("ReCaptcha token #5: %s" % token5.group(1)) + self.logDebug("Token #5: %s" % token5.group(1)) result = token5.group(1) @@ -239,7 +242,7 @@ class ReCaptcha(CaptchaService): class AdsCaptcha(CaptchaService): __name__ = "AdsCaptcha" - __version__ = "0.07" + __version__ = "0.08" __description__ = """AdsCaptcha captcha service plugin""" __license__ = "GPLv3" @@ -263,10 +266,10 @@ class AdsCaptcha(CaptchaService): n = re.search(self.CAPTCHAID_PATTERN, html) if m and n: self.key = (m.group(1).strip(), n.group(1).strip()) #: key is the tuple(PublicKey, CaptchaId) - self.plugin.logDebug("AdsCaptcha key|id: %s | %s" % self.key) + self.logDebug("Key|id: %s | %s" % self.key) return self.key else: - self.plugin.logDebug("AdsCaptcha key or id not found") + self.logDebug("Key or id not found") return None @@ -293,7 +296,7 @@ class AdsCaptcha(CaptchaService): self.plugin.fail(errmsg) raise AttributeError(errmsg) - self.plugin.logDebug("AdsCaptcha challenge: %s" % challenge) + self.logDebug("Challenge: %s" % challenge) return self.result(server, challenge), challenge @@ -304,14 +307,14 @@ class AdsCaptcha(CaptchaService): cookies=True, imgtype="jpg") - self.plugin.logDebug("AdsCaptcha result: %s" % result) + self.logDebug("Result: %s" % result) return result class SolveMedia(CaptchaService): __name__ = "SolveMedia" - __version__ = "0.11" + __version__ = "0.12" __description__ = """SolveMedia captcha service plugin""" __license__ = "GPLv3" @@ -333,10 +336,10 @@ class SolveMedia(CaptchaService): m = re.search(self.KEY_PATTERN, html) if m: self.key = m.group(1).strip() - self.plugin.logDebug("SolveMedia key: %s" % self.key) + self.logDebug("Key: %s" % self.key) return self.key else: - self.plugin.logDebug("SolveMedia key not found") + self.logDebug("Key not found") return None @@ -361,17 +364,24 @@ class SolveMedia(CaptchaService): self.plugin.fail(errmsg) raise AttributeError(errmsg) - self.plugin.logDebug("SolveMedia challenge: %s" % challenge) + self.logDebug("Challenge: %s" % challenge) result = self.result(server, challenge) - if not self.verify(result, challenge, key): - self.plugin.logDebug("SolveMedia captcha code was invalid") + try: + magic = re.search(r'name="magic" value="(.+?)"', html).group(1) + + except AttributeError: + self.logDebug("Magic code not found") + + else: + if not self._verify(key, magic, result, challenge): + self.logDebug("Captcha code was invalid") return result, challenge - def verify(self, result, challenge, key, ref=None): + def _verify(self, key, magic, result, challenge, ref=None): #@TODO: Clean up if ref is None: try: ref = self.plugin.pyfile.url @@ -379,14 +389,6 @@ class SolveMedia(CaptchaService): except Exception: ref = "" - try: - magic = re.search(r'name="magic" value="(.+?)"', html).group(1) - - except AttributeError: - errmsg = _("SolveMedia magic key not found") - self.plugin.fail(errmsg) - raise AttributeError(errmsg) - html = self.plugin.req.load("http://api.solvemedia.com/papi/verify.noscript", post={'adcopy_response' : result, 'k' : key, @@ -413,14 +415,14 @@ class SolveMedia(CaptchaService): cookies=True, imgtype="gif") - self.plugin.logDebug("SolveMedia result: %s" % result) + self.logDebug("Result: %s" % result) return result class AdYouLike(CaptchaService): __name__ = "AdYouLike" - __version__ = "0.04" + __version__ = "0.05" __description__ = """AdYouLike captcha service plugin""" __license__ = "GPLv3" @@ -444,10 +446,10 @@ class AdYouLike(CaptchaService): n = re.search(self.CALLBACK_PATTERN, html) if m and n: self.key = (m.group(1).strip(), n.group(1).strip()) - self.plugin.logDebug("AdYouLike ayl|callback: %s | %s" % self.key) + self.logDebug("Ayl|callback: %s | %s" % self.key) return self.key #: key is the tuple(ayl, callback) else: - self.plugin.logDebug("AdYouLike ayl or callback not found") + self.logDebug("Ayl or callback not found") return None @@ -478,7 +480,7 @@ class AdYouLike(CaptchaService): self.plugin.fail(errmsg) raise AttributeError(errmsg) - self.plugin.logDebug("AdYouLike challenge: %s" % challenge) + self.logDebug("Challenge: %s" % challenge) return self.result(ayl, challenge), challenge @@ -515,6 +517,6 @@ class AdYouLike(CaptchaService): '_ayl_token_challenge': challenge['token'], '_ayl_response' : response} - self.plugin.logDebug("AdYouLike result: %s" % result) + self.logDebug("Result: %s" % result) return result diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index e820ab141..e4ff1a2d8 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -483,7 +483,7 @@ class SimpleHoster(Hoster): self.logDebug("Handled as free download") self.handleFree(pyfile) - self.downloadLink(self.link, self.DISPOSITION) #: Remove `DISPOSITION` in 0.4.10 + self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 self.checkFile() @@ -599,7 +599,7 @@ class SimpleHoster(Hoster): pass self.logDebug("File name: %s" % self.pyfile.name, - "File size: %s" % (self.pyfile.size if self.pyfile.size > 0 else "Unknown")) + "File size: %s byte" % self.pyfile.size if self.pyfile.size > 0 else "File size: Unknown") def checkInfo(self): diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 624db87b7..c4fc969ba 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -16,7 +16,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.44" __pattern__ = r'^unmatchable$' @@ -89,27 +89,6 @@ class XFSHoster(SimpleHoster): self.directDL = self.premium - def downloadLink(self, link, disposition=True): - if link and isinstance(link, basestring): - self.correctCaptcha() - - if not urlparse(link).scheme: - url_p = urlparse(self.pyfile.url) - baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) - link = urljoin(baseurl, link) - - self.download(link, ref=False, disposition=disposition) - - elif self.errmsg: - if 'captcha' in self.errmsg: - self.fail(_("No valid captcha code entered")) - else: - self.fail(self.errmsg) - - else: - self.fail(_("Download link not found")) - - def handleFree(self, pyfile): for i in xrange(1, 6): self.logDebug("Getting download link: #%d" % i) @@ -139,8 +118,6 @@ class XFSHoster(SimpleHoster): self.logError(data['op'] if 'op' in data else _("UNKNOWN")) return "" - self.errmsg = None - self.link = m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 @@ -204,8 +181,6 @@ class XFSHoster(SimpleHoster): if 'location' in header: #: Direct download link self.link = header['location'] - else: - self.fail(_("Download link not found")) def checkErrors(self): |