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


Python ReCaptcha.challenge方法代码示例

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


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

示例1: handleFree

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

示例2: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True)

        self.logDebug("JSON: " + rep)

        json = self.parseJson(rep)
        self.wait(int(json['time']))

        recaptcha = ReCaptcha(self)

        for _i in xrange(5):
            response, challenge = recaptcha.challenge()
            rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
                            (challenge, response, json['hash']), decode=True)
            self.logDebug("JSON: " + rep)
            if 'link' in rep:
                json.update(self.parseJson(rep))
                self.correctCaptcha()
                break
            elif 'Verification failed' in rep:
                self.invalidCaptcha()
            else:
                self.error(_("Unable to get downlaod link"))

        if not json['link']:
            self.fail(_("No Download url retrieved/all captcha attempts failed"))

        self.download(json['link'])
开发者ID:kurtiss,项目名称:htpc,代码行数:30,代码来源:LuckyShareNet.py

示例3: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1]
        if 'token' not in inputs:
            self.error(_("Unable to detect token"))

        self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True)

        inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1]
        if 'hash' not in inputs:
            self.error(_("Unable to detect hash"))

        recaptcha           = ReCaptcha(self)
        response, challenge = recaptcha.challenge()

        #@NOTE: Work-around for v0.4.9 just_header issue
        #@TODO: Check for v0.4.10
        self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
        self.load(pyfile.url, post={'recaptcha_challenge_field': challenge,
                                    'recaptcha_response_field' : response,
                                    'hash'                     : inputs['hash']})
        self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)

        if 'location' in self.req.http.header.lower():
            self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1)
            self.correctCaptcha()
        else:
            self.invalidCaptcha()
开发者ID:kurtiss,项目名称:htpc,代码行数:29,代码来源:FilerNet.py

示例4: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        self.req.http.lastURL = pyfile.url
        self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])

        jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
                                      get={'a': "getLoadTimeToDownload"},
                                      post={'_go': ""},
                                      decode=True)

        if str(jsvars['timeToDownload']) is "stop":
            t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone

            self.logInfo("You've reach your daily download transfer")

            self.retry(10, 10 if t < 1 else None, _("Try tomorrow again"))  #@NOTE: check t in case of not synchronised clock

        else:
            self.wait(int(jsvars['timeToDownload']) - int(time.time()))

        recaptcha = ReCaptcha(self)
        response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)

        jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
                                      get={'a': "getCheckCaptcha"},
                                      post={'_go'     : "",
                                            'captcha1': challenge,
                                            'captcha2': response,
                                            'fileId'  : self.info['pattern']['ID']},
                                      decode=True)

        if jsvars['message'] == 'success':
            self.link = jsvars['url']
开发者ID:kurtiss,项目名称:htpc,代码行数:34,代码来源:RapiduNet.py

示例5: freeDownload

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def freeDownload(self):

        form_content = re.search(r"<form style=.*(\n<.*>\s*)*?[\n\t]?<tr>", self.html[0])
        if form_content is None:
            print self.html[0]
            self.fail("Form not found in HTML. Can not proceed.")

        form_content = form_content.group(0)
        form_posts = dict(re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content))

        self.html[1] = self.load(self.pyfile.url, post=form_posts)

        challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", self.html[1])

        if challenge:
            re_captcha = ReCaptcha(self)
            challenge, result = re_captcha.challenge(challenge.group(1))

            url = re.search(r'<form action="(/dl/[^"]+)', self.html[1])

            self.html[1] = self.load("http://hotfile.com" + url.group(1), post={"action": "checkcaptcha",
                                                                                "recaptcha_challenge_field": challenge,
                                                                                "recaptcha_response_field": result})

            if "Wrong Code. Please try again." in self.html[1]:
                self.freeDownload()
                return

        file_url = re.search(r'a href="(http://hotfile\.com/get/\S*)"', self.html[1]).group(1)
        self.download(file_url)
开发者ID:Tony763,项目名称:pyload,代码行数:32,代码来源:HotfileCom.py

示例6: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        self.html = self.load(self.pyfile.url, decode=True)

        if 'var free_enabled = false;' in self.html:
            self.logError("Free-download capacities exhausted.")
            self.retry(24, 300)

        found = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html)
        if not found:
            self.fail("File not downloadable for free users")
        self.setWait(int(found.group(1)))

        js = self.load("http://uploaded.net/js/download.js", decode=True)

        challengeId = re.search(r'Recaptcha\.create\("([^"]+)', js)

        url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID
        downloadURL = ""

        for i in range(5):
            #self.req.lastURL = str(self.url)
            re_captcha = ReCaptcha(self)
            challenge, result = re_captcha.challenge(challengeId.group(1))
            options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": result}
            self.wait()

            result = self.load(url, post=options)
            self.logDebug("result: %s" % result)

            if "limit-size" in result:
                self.fail("File too big for free download")
            elif "limit-slot" in result:  # Temporary restriction so just wait a bit
                self.setWait(30 * 60, True)
                self.wait()
                self.retry()
            elif "limit-parallel" in result:
                self.fail("Cannot download in parallel")
            elif self.DL_LIMIT_PATTERN in result:  # limit-dl
                self.setWait(3 * 60 * 60, True)
                self.wait()
                self.retry()
            elif 'err:"captcha"' in result:
                self.logError("ul.net captcha is disabled")
                self.invalidCaptcha()
            elif "type:'download'" in result:
                self.correctCaptcha()
                downloadURL = re.search("url:'([^']+)", result).group(1)
                break
            else:
                self.fail("Unknown error '%s'")

        if not downloadURL:
            self.fail("No Download url retrieved/all captcha attempts failed")

        self.download(downloadURL, disposition=True)
        check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN})
        if check == "limit-dl":
            self.setWait(3 * 60 * 60, True)
            self.wait()
            self.retry()
开发者ID:Dmanugm,项目名称:pyload,代码行数:62,代码来源:UploadedTo.py

示例7: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        ukey = re.match(self.__pattern__, self.pyfile.url).group(1)
        json_url = 'http://ifile.it/new_download-request.json'
        post_data = {"ukey": ukey, "ab": "0"}

        json_response = json_loads(self.load(json_url, post=post_data))
        self.logDebug(json_response)
        if json_response['status'] == 3:
            self.offline()

        if json_response["captcha"]:
            captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
            recaptcha = ReCaptcha(self)
            post_data["ctype"] = "recaptcha"

            for _ in xrange(5):
                post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key)
                json_response = json_loads(self.load(json_url, post=post_data))
                self.logDebug(json_response)

                if json_response["retry"]:
                    self.invalidCaptcha()
                else:
                    self.correctCaptcha()
                    break
            else:
                self.fail("Incorrect captcha")

        if not "ticket_url" in json_response:
            self.parseError("Download URL")

        self.download(json_response["ticket_url"])
开发者ID:3DMeny,项目名称:pyload,代码行数:34,代码来源:IfileIt.py

示例8: do_recaptcha

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def do_recaptcha(self):
        self.logDebug('Trying to solve captcha')
        captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
        shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1)
        url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)

        recaptcha = ReCaptcha(self)

        for i in range(5):
            challenge, code = recaptcha.challenge(captcha_key)

            response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test',
                                            post={'challenge': challenge,
                                                  'response': code,
                                                  'shortencode': shortencode}))
            self.logDebug("reCaptcha response : %s" % response)
            if response == True:
                self.correctCaptcha()
                break
            else:
                self.invalidCaptcha()
        else:
            self.fail("Invalid captcha")

        return url
开发者ID:DasLampe,项目名称:pyload,代码行数:27,代码来源:ZippyshareCom.py

示例9: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        file_id = re.match(self.__pattern__, self.pyfile.url).group('ID')
        self.logDebug('File ID: ' + file_id)
        rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True)
        self.logDebug('JSON: ' + rep)
        json = self.parseJson(rep)

        self.wait(int(json['time']))

        recaptcha = ReCaptcha(self)
        for _ in xrange(5):
            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
            rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
                            (challenge, response, json['hash']), decode=True)
            self.logDebug('JSON: ' + rep)
            if 'link' in rep:
                json.update(self.parseJson(rep))
                self.correctCaptcha()
                break
            elif 'Verification failed' in rep:
                self.logInfo('Wrong captcha')
                self.invalidCaptcha()
            else:
                self.parseError('Unable to get downlaod link')

        if not json['link']:
            self.fail("No Download url retrieved/all captcha attempts failed")

        self.logDebug('Direct URL: ' + json['link'])
        self.download(json['link'])
开发者ID:3DMeny,项目名称:pyload,代码行数:32,代码来源:LuckyShareNet.py

示例10: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        self.html = self.load(self.pyfile.url, decode=True)
        self.getFileInfo()

        # Wait time between free downloads
        if 'For next free download you have to wait' in self.html:
            m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0')
            waittime = int(m['m']) * 60 + int(m['s'])
            self.setWait(waittime, True)
            self.wait()

        downloadURL = ''
        recaptcha = ReCaptcha(self)
        for i in xrange(5):
            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
            post_data = {'recaptcha_challenge_field': challenge,
                         'recaptcha_response_field': response}
            self.html = self.load(self.pyfile.url, post=post_data, decode=True)
            m = re.search(self.DIRECT_LINK_PATTERN, self.html)
            if not m:
                self.logInfo('Wrong captcha')
                self.invalidCaptcha()
            elif hasattr(m, 'group'):
                downloadURL = m.group('link')
                self.correctCaptcha()
                break
            else:
                self.fail('Unknown error - Plugin may be out of date')

        if not downloadURL:
            self.fail("No Download url retrieved/all captcha attempts failed")

        self.download(downloadURL, disposition=True)
开发者ID:DasLampe,项目名称:pyload,代码行数:35,代码来源:EgoFilesCom.py

示例11: handleFree

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        found = re.search(self.WAIT_PATTERN, self.html)
        seconds = int(found.group(1))
        self.logDebug("Found wait", seconds)
        self.setWait(seconds + 1)
        self.wait()
        response = self.load('http://cloudzer.net/io/ticket/slot/%s' % self.file_info['ID'], post=' ', cookies=True)
        self.logDebug("Download slot request response", response)
        response = json_loads(response)
        if response["succ"] is not True:
            self.fail("Unable to get a download slot")

        recaptcha = ReCaptcha(self)
        challenge, response = recaptcha.challenge(self.CAPTCHA_KEY)
        post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}
        response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'],
                                        post=post_data, cookies=True))
        self.logDebug("Captcha check response", response)
        self.logDebug("First check")

        if "err" in response:
            if response["err"] == "captcha":
                self.logDebug("Wrong captcha")
                self.invalidCaptcha()
                self.retry()
            elif "Sie haben die max" in response["err"] or "You have reached the max" in response["err"]:
                self.logDebug("Download limit reached, waiting an hour")
                self.setWait(3600, True)
                self.wait()
        if "type" in response:
            if response["type"] == "download":
                url = response["url"]
                self.logDebug("Download link", url)
                self.download(url, disposition=True)
开发者ID:BlackSmith,项目名称:pyload,代码行数:36,代码来源:CloudzerNet.py

示例12: handleFree

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

示例13: decrypt

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def decrypt(self, pyfile):
        html = self.req.load(self.pyfile.url, cookies=True)

        m = re.search(r"src=\"http://www.google.com/recaptcha/api/challenge\?k=(.*?)\"></script>", html)
        if not m:
            self.offline()

        recaptcha = ReCaptcha(self)
        challenge, code = recaptcha.challenge(m.group(1))

        resultHTML = self.req.load(self.pyfile.url,
                                   post={"recaptcha_challenge_field": challenge, "recaptcha_response_field": code},
                                   cookies=True)

        if re.search("class=\"error\"", resultHTML):
            self.retry()

        self.correctCaptcha()

        dlc = self.req.load(self.pyfile.url + "/dlc", cookies=True)

        name = re.search(self.__pattern__, self.pyfile.url).group(1) + ".dlc"

        dlcFile = join(self.config["general"]["download_folder"], name)
        f = open(dlcFile, "wb")
        f.write(dlc)
        f.close()

        self.packages.append((self.pyfile.package().name, [dlcFile], self.pyfile.package().folder))
开发者ID:Dmanugm,项目名称:pyload,代码行数:31,代码来源:LofCc.py

示例14: get_download_options

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def get_download_options(self):
        re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>",
                                self.html).group(0)  # get the whole request
        to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
        request_options = dict((n, v) for (v, n) in to_sort)

        herewego = self.load(self.pyfile.url, None, request_options)  # the actual download-Page

        # comment this in, when it doesnt work
        # with open("DUMP__FS_.HTML", "w") as fp:
        # fp.write(herewego)

        to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
        request_options = dict((n, v) for (v, n) in to_sort)

        # comment this in, when it doesnt work as well
        #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort])

        challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego)

        if challenge:
            re_captcha = ReCaptcha(self)
            (request_options["recaptcha_challenge_field"], 
             request_options["recaptcha_response_field"]) = re_captcha.challenge(challenge.group(1))

        return request_options
开发者ID:fragonib,项目名称:pyload,代码行数:28,代码来源:FreakshareCom.py

示例15: solveCaptcha

# 需要导入模块: from module.plugins.internal.CaptchaService import ReCaptcha [as 别名]
# 或者: from module.plugins.internal.CaptchaService.ReCaptcha import challenge [as 别名]
    def solveCaptcha(self):
        recaptcha = ReCaptcha(self)
        for _ in xrange(5):
            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
            apiUrl = "https://www.oboom.com/1.0/download/ticket"
            params = {"recaptcha_challenge_field": challenge,
                      "recaptcha_response_field": response,
                      "download_id": self.fileId,
                      "token": self.sessionToken}
            result = self.loadUrl(apiUrl, params)

            if result[0] == 200:
                self.downloadToken = result[1]
                self.downloadAuth = result[2]
                self.correctCaptcha()
                self.setWait(30)
                self.wait()
                break
            elif result[0] == 400:
                if result[1] == "incorrect-captcha-sol":
                    self.invalidCaptcha()
                elif result[1] == "captcha-timeout":
                    self.invalidCaptcha()
                elif result[1] == "forbidden":
                    self.retry(5, 15 * 60, "Service unavailable")
            elif result[0] == 403:
                if result[1] == -1:  # another download is running
                    self.setWait(15 * 60)
                else:
                    self.setWait(result[1], reconnect=True)
                self.wait()
                self.retry(5)
        else:
            self.invalidCaptcha()
            self.fail("Received invalid captcha 5 times")
开发者ID:3DMeny,项目名称:pyload,代码行数:37,代码来源:OboomCom.py


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