• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python CaptchaService.ReCaptcha类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: handleFree

    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,代码行数:32,代码来源:RapiduNet.py


示例2: decrypt

    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,代码行数:29,代码来源:LofCc.py


示例3: handleFree

    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,代码行数:60,代码来源:UploadedTo.py


示例4: do_recaptcha

    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,代码行数:25,代码来源:ZippyshareCom.py


示例5: handleFree

    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,代码行数:33,代码来源:EgoFilesCom.py


示例6: handleFree

    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,代码行数:32,代码来源:IfileIt.py


示例7: handleFree

    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,代码行数:30,代码来源:LuckyShareNet.py


示例8: handleFree

    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,代码行数:27,代码来源:DepositfilesCom.py


示例9: handleFree

    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,代码行数:34,代码来源:CloudzerNet.py


示例10: get_download_options

    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,代码行数:26,代码来源:FreakshareCom.py


示例11: freeDownload

    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,代码行数:30,代码来源:HotfileCom.py


示例12: handleFree

    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,代码行数:28,代码来源:LuckyShareNet.py


示例13: solveCaptcha

    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,代码行数:35,代码来源:OboomCom.py


示例14: handleFree

    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,代码行数:27,代码来源:FilerNet.py


示例15: handleFree

    def handleFree(self):
        self.req.setOption("timeout", 120)
        self.html = self.load(self.pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES)

        # Wait between downloads
        m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html)
        if m:
            waittime = int(m.group(1))
            self.retry(3, waittime, 'Wait between free downloads')

        self.getFileInfo()

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

        inputs = self.parseHtmlForm(input_names='token')[1]
        if 'token' not in inputs:
            self.parseError('Unable to detect token')
        token = inputs['token']
        self.logDebug('Token: ' + token)

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

        inputs = self.parseHtmlForm(input_names='hash')[1]
        if 'hash' not in inputs:
            self.parseError('Unable to detect hash')
        hash_data = inputs['hash']
        self.logDebug('Hash: ' + hash_data)

        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,
                         'hash': hash_data}

            # Workaround for 0.4.9 just_header issue. In 0.5 clean the code using just_header
            self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
            self.load(self.pyfile.url, post=post_data)
            self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)

            if 'location' in self.req.http.header:
                location = re.search(r'location: (\S+)', self.req.http.header).group(1)
                downloadURL = 'http://filer.net' + location
                self.correctCaptcha()
                break
            else:
                self.logInfo('Wrong captcha')
                self.invalidCaptcha()

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

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


示例16: handleFree

    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,代码行数:11,代码来源:ZippyshareCom.py


示例17: getDownloadUrl

    def getDownloadUrl(self):
        # Return location if direct download is active
        if self.premium:
            header = self.load(self.pyfile.url, cookies=True, just_header=True)
            if 'location' in header:
                return header['location']

        # Get download info
        self.logDebug("Getting download info")
        response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
                             post={"request": "generateID", "ajaxid": self.ajaxid})
        self.handleErrors(response, ':')
        parts = response.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.setWait(wait, False)
                self.wait()
            else:
                self.setWait(wait - 55, True)
                self.wait()
                self.retry()

        # Resolve captcha
        if captcha == 1:
            self.logDebug("File is captcha protected")
            id = re.search(BitshareCom.CAPTCHA_KEY_PATTERN, self.html).group(1)
            # Try up to 3 times
            for i in range(3):
                self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1))
                recaptcha = ReCaptcha(self)
                challenge, code = recaptcha.challenge(id)
                response = 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": code})
                if self.handleCaptchaErrors(response):
                    break

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

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


示例18: handleFree

    def handleFree(self):
        self.loadAPIData()
        self.pyfile.name = self.api_data["filename"]
        self.pyfile.size = int(self.api_data["size"])

        self.html = self.load(self.pyfile.url, cookies=True)  # refer, stuff
        self.setWait(3)
        self.wait()

        self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True)
        self.checkErrors()

        found = re.search(r'var wait=(\d+);', self.html)

        recaptcha = ReCaptcha(self)
        for _ in xrange(5):
            challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
            self.setWait(int(found.group(1)) if found else 30)
            response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={
                'dl_free': '1',
                'recaptcha_challenge_field': challenge,
                'recaptcha_response_field': response})

            if not response == '0':
                self.correctCaptcha()
                break
            else:
                self.invalidCaptcha()
        else:
            self.invalidCaptcha()
            self.fail("No valid captcha solution received")

        download_url = response.decode("base64")
        self.logDebug(download_url)
        if not download_url.startswith("http://"):
            self.parseError("download url")

        self.wait()
        self.download(download_url)
        # check download
        check = self.checkDownload({
            "cookie": re.compile(r'<div id="dl_failure"'),
            "fail": re.compile(r"<title>Share-Online")
        })
        if check == "cookie":
            self.invalidCaptcha()
            self.retry(5, 60, "Cookie failure")
        elif check == "fail":
            self.invalidCaptcha()
            self.retry(5, 5 * 60, "Download failed")
        else:
            self.correctCaptcha()
开发者ID:3DMeny,项目名称:pyload,代码行数:52,代码来源:ShareonlineBiz.py


示例19: handleFree

 def handleFree(self):
     found = re.search(self.SECONDS_PATTERN, self.html)
     seconds = int(found.group(1))
     self.logDebug("Seconds found", seconds)
     self.wait(seconds + 1)
     recaptcha = ReCaptcha(self)
     challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY)
     post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code}
     self.download(self.pyfile.url, post=post_data)
     check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")})
     if check == "html":
         self.logDebug("Wrong captcha entered")
         self.invalidCaptcha()
         self.retry()
开发者ID:3DMeny,项目名称:pyload,代码行数:14,代码来源:CatShareNet.py


示例20: downloadFree

    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))
开发者ID:Tony763,项目名称:pyload,代码行数:48,代码来源:WuploadCom.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python DeadHoster.create_getInfo函数代码示例发布时间:2022-05-27
下一篇:
Python XFileSharingPro.create_getInfo函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap