当前位置: 首页>>代码示例>>Python>>正文


Python ReCaptcha.detect_key方法代码示例

本文整理汇总了Python中module.plugins.internal.CaptchaService.ReCaptcha.detect_key方法的典型用法代码示例。如果您正苦于以下问题:Python ReCaptcha.detect_key方法的具体用法?Python ReCaptcha.detect_key怎么用?Python ReCaptcha.detect_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module.plugins.internal.CaptchaService.ReCaptcha的用法示例。


在下文中一共展示了ReCaptcha.detect_key方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import detect_key [as 别名]
    def handleFree(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 = unquote(m.group(1))
开发者ID:kurtiss,项目名称:htpc,代码行数:29,代码来源:DepositfilesCom.py

示例2: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.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)
开发者ID:kurtiss,项目名称:htpc,代码行数:13,代码来源:ZippyshareCom.py

示例3: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import detect_key [as 别名]
    def handleFree(self):
        # STAGE 1: get link to continue
        m = re.search(self.CHASH_PATTERN, self.html)
        if not m:
            self.parseError("could not detect hash")
        chash = m.group(1)
        self.logDebug("read hash " + chash)
        # continue to stage2
        post_data = {"hash": chash, "free": "Slow download"}
        self.html = self.load(self.pyfile.url, post=post_data, decode=True)

        # STAGE 2: solv captcha and wait
        # first get the infos we need: recaptcha key and wait time
        recaptcha = ReCaptcha(self)
        if not recaptcha.detect_key(self.html):
            self.parseError("could not find recaptcha pattern")
        self.logDebug("using captcha key " + recaptcha.recaptcha_key)
        # try the captcha 5 times
        for i in xrange(5):
            m = re.search(self.WAIT_PATTERN, self.html)
            if not m:
                self.parseError("could not find wait pattern")
            wait_time = m.group(1)

            # then, do the waiting
            self.wait(wait_time)

            # then, handle the captcha
            challenge, code = recaptcha.challenge()
            post_data["recaptcha_challenge_field"] = challenge
            post_data["recaptcha_response_field"] = code

            self.html = self.load(self.pyfile.url, post=post_data, decode=True)

            # STAGE 3: get direct link
            m = re.search(self.DIRECT_LINK_PATTERN, self.html, re.DOTALL)
            if m:
                break

        if not m:
            self.parseError("could not detect direct link")

        direct = m.group(1)
        self.logDebug("found direct link: " + direct)
        self.download(direct, disposition=True)
开发者ID:JeRiKo1,项目名称:pyload,代码行数:47,代码来源:UpstoreNet.py

示例4: handleCaptcha

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.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

        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

        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

        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)
开发者ID:kurtiss,项目名称:htpc,代码行数:47,代码来源:XFSHoster.py

示例5: handleCaptcha

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.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(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()
开发者ID:kurtiss,项目名称:htpc,代码行数:42,代码来源:FilecryptCc.py

示例6: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import detect_key [as 别名]
    def handleFree(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'])}

            download_url = m.group(1)
            self.download(download_url)
        else:
            self.fail(_("Unexpected server response"))
开发者ID:kurtiss,项目名称:htpc,代码行数:66,代码来源:FilecloudIo.py


注:本文中的module.plugins.internal.CaptchaService.ReCaptcha.detect_key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。