本文整理汇总了Python中module.plugins.internal.CaptchaService.ReCaptcha.result方法的典型用法代码示例。如果您正苦于以下问题:Python ReCaptcha.result方法的具体用法?Python ReCaptcha.result怎么用?Python ReCaptcha.result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module.plugins.internal.CaptchaService.ReCaptcha
的用法示例。
在下文中一共展示了ReCaptcha.result方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: downloadFree
# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import result [as 别名]
def downloadFree(self):
self.logDebug("Free download")
# Get initial page
self.html = self.load(self.pyfile.url)
url = self.pyfile.url + "?start=1"
self.html = self.load(url)
self.handleErrors()
finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
if not finalUrl:
self.doWait(url)
chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
if chall or chall2:
for i in range(5):
re_captcha = ReCaptcha(self)
if chall:
self.logDebug("Captcha type1")
challenge, result = re_captcha.challenge(chall.group(1))
else:
self.logDebug("Captcha type2")
server = chall2.group(1)
challenge = chall2.group(2)
result = re_captcha.result(server, challenge)
postData = {"recaptcha_challenge_field": challenge,
"recaptcha_response_field": result}
self.html = self.load(url, post=postData)
self.handleErrors()
chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
if chall or chall2:
self.invalidCaptcha()
else:
self.correctCaptcha()
break
finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
if not finalUrl:
self.fail("Couldn't find free download link")
self.logDebug("got download url %s" % finalUrl.group(1))
self.download(finalUrl.group(1))