本文整理汇总了Python中pyload.plugin.captcha.ReCaptcha.ReCaptcha.detect_key方法的典型用法代码示例。如果您正苦于以下问题:Python ReCaptcha.detect_key方法的具体用法?Python ReCaptcha.detect_key怎么用?Python ReCaptcha.detect_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyload.plugin.captcha.ReCaptcha.ReCaptcha
的用法示例。
在下文中一共展示了ReCaptcha.detect_key方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_free
# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import detect_key [as 别名]
def handle_free(self, pyfile):
self.html = self.load(pyfile.url, post={'gateway_result': "1"})
self.checkErrors()
m = re.search(r"var fid = '(\w+)';", self.html)
if m is None:
self.retry(wait_time=5)
params = {'fid': m.group(1)}
self.logDebug("FID: %s" % params['fid'])
self.checkErrors()
recaptcha = ReCaptcha(self)
captcha_key = recaptcha.detect_key()
if captcha_key is None:
return
self.html = self.load("https://dfiles.eu/get_file.php", get=params)
if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
params['response'], params['challenge'] = recaptcha.challenge(captcha_key)
self.html = self.load("https://dfiles.eu/get_file.php", get=params)
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m:
self.link = urllib.unquote(m.group(1))
示例2: handleFree
# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import detect_key [as 别名]
def handleFree(self, pyfile):
recaptcha = ReCaptcha(self)
captcha_key = recaptcha.detect_key()
if captcha_key:
try:
self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html)
recaptcha.challenge()
except Exception, e:
self.error(e)
示例3: handleCaptcha
# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import detect_key [as 别名]
def handleCaptcha(self, inputs):
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m:
captcha_url = m.group(1)
inputs['code'] = self.decryptCaptcha(captcha_url)
return 1
m = re.search(self.CAPTCHA_BLOCK_PATTERN, self.html, re.S)
if m:
captcha_div = m.group(1)
numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
self.logDebug(captcha_div)
inputs['code'] = "".join(a[1] for a in sorted(numerals, key=lambda num: int(num[0])))
self.logDebug("Captcha code: %s" % inputs['code'], numerals)
return 2
recaptcha = ReCaptcha(self)
try:
captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
except Exception:
captcha_key = recaptcha.detect_key()
else:
self.logDebug("ReCaptcha key: %s" % captcha_key)
if captcha_key:
inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key)
return 3
solvemedia = SolveMedia(self)
try:
captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1)
except Exception:
captcha_key = solvemedia.detect_key()
else:
self.logDebug("SolveMedia key: %s" % captcha_key)
if captcha_key:
inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key)
return 4
return 0
示例4: handleCaptcha
# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import detect_key [as 别名]
def handleCaptcha(self):
m = re.search(self.CAPTCHA_PATTERN, self.html)
m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)
if m: #: normal captcha
self.logDebug("Captcha-URL: %s" % m.group(1))
captcha_code = self.decryptCaptcha(urlparse.urljoin(self.base_url, m.group(1)),
forceUser=True,
imgtype="gif")
self.siteWithLinks = self.load(self.pyfile.url,
post={'recaptcha_response_field': captcha_code},
decode=True)
elif m2: #: circle captcha
self.logDebug("Captcha-URL: %s" % m2.group(1))
captcha_code = self.decryptCaptcha('%s%s?c=abc' %(self.base_url, m2.group(1)),
result_type='positional')
self.siteWithLinks = self.load(self.pyfile.url,
post={'button.x': captcha_code[0], 'button.y': captcha_code[1]},
decode=True)
else:
recaptcha = ReCaptcha(self)
captcha_key = recaptcha.detect_key()
if captcha_key:
response, challenge = recaptcha.challenge(captcha_key)
self.siteWithLinks = self.load(self.pyfile.url,
post={'g-recaptcha-response': response},
decode=True)
else:
self.logInfo(_("No captcha found"))
self.siteWithLinks = self.html
if "recaptcha_image" in self.siteWithLinks or "data-sitekey" in self.siteWithLinks:
self.invalidCaptcha()
self.retry()
示例5: handle_free
# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import detect_key [as 别名]
def handle_free(self, pyfile):
data = {"ukey": self.info['pattern']['ID']}
m = re.search(self.AB1_PATTERN, self.html)
if m is None:
self.error(_("__AB1"))
data['__ab1'] = m.group(1)
recaptcha = ReCaptcha(self)
m = re.search(self.RECAPTCHA_PATTERN, self.html)
captcha_key = m.group(1) if m else recaptcha.detect_key()
if captcha_key is None:
self.error(_("ReCaptcha key not found"))
response, challenge = recaptcha.challenge(captcha_key)
self.account.form_data = {"recaptcha_challenge_field": challenge,
"recaptcha_response_field" : response}
self.account.relogin(self.user)
self.retry(2)
json_url = "http://filecloud.io/download-request.json"
res = self.load(json_url, post=data)
self.logDebug(res)
res = json_loads(res)
if "error" in res and res['error']:
self.fail(res)
self.logDebug(res)
if res['captcha']:
data['ctype'] = "recaptcha"
for _i in xrange(5):
data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key)
json_url = "http://filecloud.io/download-request.json"
res = self.load(json_url, post=data)
self.logDebug(res)
res = json_loads(res)
if "retry" in res and res['retry']:
self.invalidCaptcha()
else:
self.correctCaptcha()
break
else:
self.fail(_("Incorrect captcha"))
if res['dl']:
self.html = self.load('http://filecloud.io/download.html')
m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.html)
if m is None:
self.error(_("LINK_FREE_PATTERN not found"))
if "size" in self.info and self.info['size']:
self.check_data = {"size": int(self.info['size'])}
self.link = m.group(1)
else:
self.fail(_("Unexpected server response"))