From eca20b701c411046e7ededb0462b310124ce3c18 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 13 Apr 2015 10:21:32 +0200 Subject: Cleanup + fixup + new lib --- pyload/plugin/captcha/AdsCaptcha.py | 4 ++-- pyload/plugin/captcha/ReCaptcha.py | 23 +++++++---------------- pyload/plugin/captcha/SolveMedia.py | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) (limited to 'pyload/plugin/captcha') diff --git a/pyload/plugin/captcha/AdsCaptcha.py b/pyload/plugin/captcha/AdsCaptcha.py index 5b23247c0..89579881f 100644 --- a/pyload/plugin/captcha/AdsCaptcha.py +++ b/pyload/plugin/captcha/AdsCaptcha.py @@ -17,8 +17,8 @@ class AdsCaptcha(Captcha): __authors__ = [("pyLoad Team", "admin@pyload.org")] - CAPTCHAID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(\d+)' - PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=([\w-]+)' + CAPTCHAID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?.*?CaptchaId=(\d+)' + PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?.*?PublicKey=([\w-]+)' def detect_key(self, html=None): diff --git a/pyload/plugin/captcha/ReCaptcha.py b/pyload/plugin/captcha/ReCaptcha.py index 6dcb09f55..4920262b2 100644 --- a/pyload/plugin/captcha/ReCaptcha.py +++ b/pyload/plugin/captcha/ReCaptcha.py @@ -13,7 +13,7 @@ from pyload.plugin.Captcha import Captcha class ReCaptcha(Captcha): __name__ = "ReCaptcha" __type__ = "captcha" - __version__ = "0.14" + __version__ = "0.15" __description__ = """ReCaptcha captcha service plugin""" __license__ = "GPLv3" @@ -161,21 +161,12 @@ class ReCaptcha(Captcha): token2 = re.search(r'"finput","(.*?)",', html) self.logDebug("Token #2: %s" % token2.group(1)) - token3 = re.search(r'."asconf".\s,".*?".\s,"(.*?)".', html) + token3 = re.search(r'"rresp","(.*?)",', html) self.logDebug("Token #3: %s" % token3.group(1)) - html = self.plugin.req.load("https://www.google.com/recaptcha/api2/reload", - post={'k' : key, - 'c' : token2.group(1), - 'reason': "fi", - 'fbg' : token3.group(1)}) - - token4 = re.search(r'"rresp","(.*?)",', html) - 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", - get={'c': token4.group(1), 'k': key}, + get={'c':token3.group(1), 'k':key}, cookies=True, forceUser=True) response = b64encode('{"response":"%s"}' % captcha_response) @@ -187,15 +178,15 @@ class ReCaptcha(Captcha): html = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify", post={'k' : key, - 'c' : token4.group(1), + 'c' : token3.group(1), 'response': response, 't' : timeToSolve, 'ct' : timeToSolveMore, 'bg' : botguardstring}) - token5 = re.search(r'"uvresp","(.*?)",', html) - self.logDebug("Token #5: %s" % token5.group(1)) + token4 = re.search(r'"uvresp","(.*?)",', html) + self.logDebug("Token #4: %s" % token4.group(1)) - result = token5.group(1) + result = token4.group(1) return result, None diff --git a/pyload/plugin/captcha/SolveMedia.py b/pyload/plugin/captcha/SolveMedia.py index 7f421f490..45f7a69e8 100644 --- a/pyload/plugin/captcha/SolveMedia.py +++ b/pyload/plugin/captcha/SolveMedia.py @@ -49,7 +49,7 @@ class SolveMedia(Captcha): html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}) try: - challenge = re.search(r'', + challenge = re.search(r'', html).group(1) server = "http://api.solvemedia.com/papi/media" -- cgit v1.2.3