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


Python ReCaptcha.challenge方法代码示例

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


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

示例1: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.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:torrero007,项目名称:pyload,代码行数:13,代码来源:ZippyshareCom.py

示例2: handleCaptcha

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleCaptcha(self):
        post_data = {'free'               : 1,
                     'freeDownloadRequest': 1,
                     'uniqueId'           : self.fid,
                     'yt0'                : ''}

        m = re.search(r'id="(captcha\-form)"', self.html)
        self.logDebug("captcha-form found %s" % m)

        m = re.search(self.CAPTCHA_PATTERN, self.html)
        self.logDebug("CAPTCHA_PATTERN found %s" % m)
        if m:
            captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1))
            post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url)
        else:
            recaptcha = ReCaptcha(self)
            response, challenge = recaptcha.challenge()
            post_data.update({'recaptcha_challenge_field': challenge,
                              'recaptcha_response_field' : response})

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

        if 'verification code is incorrect' not in self.html:
            self.correctCaptcha()
        else:
            self.invalidCaptcha()
开发者ID:reissdorf,项目名称:pyload,代码行数:28,代码来源:Keep2ShareCc.py

示例3: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        # Click the "free user" button and wait
        a = self.load(pyfile.url, post={'downloadLink': "wait"}, decode=True)
        self.logDebug(a)

        self.wait(30)

        # Make the recaptcha appear and show it the pyload interface
        b = self.load(pyfile.url, post={'checkDownload': "check"}, decode=True)
        self.logDebug(b)  #: Expected output: {"success":"showCaptcha"}

        recaptcha = ReCaptcha(self)

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

        # Submit the captcha solution
        self.load("http://www.uploadable.ch/checkReCaptcha.php",
                  post={'recaptcha_challenge_field'  : challenge,
                        'recaptcha_response_field'   : response,
                        'recaptcha_shortencode_field': self.info['pattern']['ID']},
                  decode=True)

        self.wait(3)

        # Get ready for downloading
        self.load(pyfile.url, post={'downloadLink': "show"}, decode=True)

        self.wait(3)

        # Download the file
        self.download(pyfile.url, post={'download': "normal"}, disposition=True)
开发者ID:PaddyPat,项目名称:pyload,代码行数:33,代码来源:UploadableCh.py

示例4: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.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(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.link = json['link']
开发者ID:PaddyPat,项目名称:pyload,代码行数:30,代码来源:LuckyShareNet.py

示例5: handle_free

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [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))
开发者ID:Bobbaone,项目名称:pyload,代码行数:29,代码来源:DepositfilesCom.py

示例6: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        self.req.http.lastURL = pyfile.url
        self.req.http.c.setopt(pycurl.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:reissdorf,项目名称:pyload,代码行数:34,代码来源:RapiduNet.py

示例7: getDownloadUrl

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def getDownloadUrl(self):
        # Return location if direct download is active
        if self.premium:
            header = self.load(self.pyfile.url, just_header=True)
            if 'location' in header:
                return header['location']

        # Get download info
        self.logDebug("Getting download info")
        res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
                        post={"request": "generateID", "ajaxid": self.ajaxid})

        self.handleErrors(res, ':')

        parts    = res.split(":")
        filetype = parts[0]
        wait     = int(parts[1])
        captcha  = int(parts[2])

        self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha))

        # Waiting
        if wait > 0:
            self.logDebug("Waiting %d seconds." % wait)
            if wait < 120:
                self.wait(wait, False)
            else:
                self.wait(wait - 55, True)
                self.retry()

        # Resolve captcha
        if captcha == 1:
            self.logDebug("File is captcha protected")
            recaptcha = ReCaptcha(self)

            # Try up to 3 times
            for _i in xrange(3):
                response, challenge = recaptcha.challenge()
                res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
                                     post={"request"                  : "validateCaptcha",
                                           "ajaxid"                   : self.ajaxid,
                                           "recaptcha_challenge_field": challenge,
                                           "recaptcha_response_field" : response})
                if self.handleCaptchaErrors(res):
                    break

        # Get download URL
        self.logDebug("Getting download url")
        res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
                        post={"request": "getDownloadURL", "ajaxid": self.ajaxid})

        self.handleErrors(res, '#')

        url = res.split("#")[-1]

        return url
开发者ID:Bobbaone,项目名称:pyload,代码行数:58,代码来源:BitshareCom.py

示例8: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        recaptcha = ReCaptcha(self)

        response, challenge = recaptcha.challenge()
        self.html = self.load(pyfile.url,
                              post={'recaptcha_challenge_field': challenge,
                                    'recaptcha_response_field' : response})

        m = re.search(self.LINK_FREE_PATTERN, self.html)
        if m:
            self.link = m.group(1)
开发者ID:PaddyPat,项目名称:pyload,代码行数:13,代码来源:CatShareNet.py

示例9: doCaptcha

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def doCaptcha(self):
        captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
        recaptcha = ReCaptcha(self)

        for _i in xrange(5):
            response, challenge = recaptcha.challenge(captcha_key)
            res = json_loads(self.load(self.URLS[2],
                                       post={'recaptcha_challenge_field'  : challenge,
                                             'recaptcha_response_field'   : response,
                                             'recaptcha_shortencode_field': self.file_id}))
            if not res['success']:
                self.invalidCaptcha()
            else:
                self.correctCaptcha()
                break
        else:
            self.fail(_("Invalid captcha"))
开发者ID:achimschneider,项目名称:pyload,代码行数:19,代码来源:FileserveCom.py

示例10: handle_free

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handle_free(self, pyfile):
        if r">Only premium users can download this file" in self.html:
            self.fail(_("Only premium users can download this file"))

        m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html)
        if m:
            self.wait(int(m.group(1)) * 60, True)
        elif "The daily downloads limit from your IP is exceeded" in self.html:
            self.logWarning(_("You have reached your daily downloads limit for today"))
            self.wait(secondsToMidnight(gmt=2), True)

        self.logDebug("URL: " + self.req.http.lastEffectiveURL)
        m = re.match(self.__pattern, self.req.http.lastEffectiveURL)
        fileID = m.group('ID') if m else self.info['pattern']['ID']

        m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html)
        if m:
            recaptcha = ReCaptcha(self)
            captcha_key = m.group(1)

            for _i in xrange(5):
                get_data = {"type": "recaptcha"}
                get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key)
                res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data))
                if "ok" in res:
                    self.correctCaptcha()
                    break
                else:
                    self.invalidCaptcha()
            else:
                self.fail(_("Invalid captcha"))
        else:
            self.error(_("Captcha"))

        if not "href" in res:
            self.error(_("Bad JSON response"))

        self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href']))

        m = re.search(self.LINK_FREE_PATTERN, self.html)
        if m is None:
            self.error(_("LINK_FREE_PATTERN not found"))

        self.link = m.group(1)
开发者ID:Bobbaone,项目名称:pyload,代码行数:46,代码来源:ExtabitCom.py

示例11: get_download_options

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.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

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

        challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", 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:Bobbaone,项目名称:pyload,代码行数:21,代码来源:FreakshareCom.py

示例12: unlockProtection

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def unlockProtection(self):
        postData = {}

        form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.S).group(1)

        # Submit package password
        if "password" in form:
            password = self.getPassword()
            self.logDebug("Submitting password [%s] for protected links" % password)
            postData['password'] = password

        # Resolve anicaptcha
        if "anicaptcha" in form:
            self.logDebug("Captcha protected")
            captchaUri = re.search(r'src="(/temp/anicaptcha/.+?)"', form).group(1)
            captcha = self.decryptCaptcha("http://ncrypt.in" + captchaUri)
            self.logDebug("Captcha resolved [%s]" % captcha)
            postData['captcha'] = captcha

        # Resolve recaptcha
        if "recaptcha" in form:
            self.logDebug("ReCaptcha protected")
            captcha_key = re.search(r'\?k=(.*?)"', form).group(1)
            self.logDebug("Resolving ReCaptcha with key [%s]" % captcha_key)
            recaptcha = ReCaptcha(self)
            response, challenge = recaptcha.challenge(captcha_key)
            postData['recaptcha_challenge_field'] = challenge
            postData['recaptcha_response_field']  = response

        # Resolve circlecaptcha
        if "circlecaptcha" in form:
            self.logDebug("CircleCaptcha protected")
            captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php"
            coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional')
            self.logDebug("Captcha resolved, coords [%s]" % str(coords))
            postData['circle.x'] = coords[0]
            postData['circle.y'] = coords[1]

        # Unlock protection
        postData['submit_protected'] = 'Continue to folder'
        return self.load(self.pyfile.url, post=postData, decode=True)
开发者ID:PaddyPat,项目名称:pyload,代码行数:43,代码来源:NCryptIn.py

示例13: handle_free

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handle_free(self, pyfile):
        # used here to load the cookies which will be required later
        self.load(pyfile.url, post={'goToFreePage': ""})

        self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']})
        self.html = self.load("http://nitroflare.com/ajax/freeDownload.php",
                              post={'method': "startTimer", 'fileId': self.info['pattern']['ID']})

        self.checkErrors()

        try:
            js_file   = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1")
            var_time  = re.search("var time = (\\d+);", js_file)
            wait_time = int(var_time.groups()[0])

        except Exception:
            wait_time = 60

        self.wait(wait_time)

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

        self.html = self.load("http://nitroflare.com/ajax/freeDownload.php",
                              post={'method'                   : "fetchDownload",
                                    'recaptcha_challenge_field': challenge,
                                    'recaptcha_response_field' : response})

        if "The captcha wasn't entered correctly" in self.html:
            self.logWarning("The captcha wasn't entered correctly")
            return

        if "You have to fill the captcha" in self.html:
            self.logWarning("Captcha unfilled")
            return

        m = re.search(self.LINK_FREE_PATTERN, self.html)
        if m:
            self.link = m.group(1)
        else:
            self.logError("Unable to detect direct link")
开发者ID:Bobbaone,项目名称:pyload,代码行数:43,代码来源:NitroflareCom.py

示例14: handleFree

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self, pyfile):
        # STAGE 1: get link to continue
        m = re.search(self.CHASH_PATTERN, self.html)
        if m is None:
            self.error(_("CHASH_PATTERN not found"))
        chash = m.group(1)
        self.logDebug("Read hash " + chash)
        # continue to stage2
        post_data = {'hash': chash, 'free': 'Slow download'}
        self.html = self.load(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)

        # try the captcha 5 times
        for i in xrange(5):
            m = re.search(self.WAIT_PATTERN, self.html)
            if m is None:
                self.error(_("Wait pattern not found"))
            wait_time = int(m.group(1))

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

            # then, handle the captcha
            response, challenge = recaptcha.challenge()
            post_data.update({'recaptcha_challenge_field': challenge,
                              'recaptcha_response_field' : response})

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

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

        if m is None:
            self.error(_("Download link not found"))

        self.link = m.group(1)
开发者ID:achimschneider,项目名称:pyload,代码行数:43,代码来源:UpstoreNet.py

示例15: handleCaptcha

# 需要导入模块: from pyload.plugin.captcha.ReCaptcha import ReCaptcha [as 别名]
# 或者: from pyload.plugin.captcha.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleCaptcha(self):
        recaptcha = ReCaptcha(self)

        for _i in xrange(5):
            response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)

            m = re.search(r'var wait=(\d+);', self.html)
            self.setWait(int(m.group(1)) if m else 30)

            res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),
                            post={'dl_free'                  : "1",
                                  'recaptcha_challenge_field': challenge,
                                  'recaptcha_response_field' : response})
            if not res == '0':
                self.correctCaptcha()
                return res
            else:
                self.invalidCaptcha()
        else:
            self.invalidCaptcha()
            self.fail(_("No valid captcha solution received"))
开发者ID:PaddyPat,项目名称:pyload,代码行数:23,代码来源:ShareonlineBiz.py


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