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


Python ReCaptcha.challenge方法代码示例

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


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

示例1: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        file_id = re.search(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.setWait(int(json['time']))
        self.wait()

        recaptcha = ReCaptcha(self)
        for i 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:4Christopher,项目名称:pyload,代码行数:33,代码来源:LuckyShareNet.py

示例2: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.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:4Christopher,项目名称:pyload,代码行数:35,代码来源:EgoFilesCom.py

示例3: decrypt

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.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:4Christopher,项目名称:pyload,代码行数:29,代码来源:LofCc.py

示例4: get_download_options

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.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
        
        # 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:4Christopher,项目名称:pyload,代码行数:27,代码来源:FreakshareCom.py

示例5: unlockProtection

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
 def unlockProtection(self):
     
     postData = {}
             
     form = re.search(r'''<form\ name="protected"(.*?)</form>''', self.cleanedHtml, re.DOTALL).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.captcha = True
         self.logDebug("Captcha protected, resolving captcha")
         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.captcha = True    
         id = re.search(r'\?k=(.*?)"', form).group(1)
         self.logDebug("Resolving ReCaptcha with key [%s]" % id)
         recaptcha = ReCaptcha(self)
         challenge, code = recaptcha.challenge(id)
         postData['recaptcha_challenge_field'] = challenge
         postData['recaptcha_response_field'] = code
                
     # Unlock protection
     postData['submit_protected'] = 'Continue to folder '
     return self.load(self.pyfile.url, post=postData)
开发者ID:4Christopher,项目名称:pyload,代码行数:36,代码来源:NCryptIn.py

示例6: freeDownload

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.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:fener06,项目名称:pyload,代码行数:32,代码来源:HotfileCom.py

示例7: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.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(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)
        check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN})
        if check == "limit-dl":
            self.setWait(60 * 60, True)
            self.wait()
            self.retry()
开发者ID:masterwaster,项目名称:pyload,代码行数:62,代码来源:UploadedTo.py

示例8: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.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:AlexandrePinheiro,项目名称:pyload,代码行数:35,代码来源:CloudzerNet.py

示例9: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        ukey = re.search(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 i in range(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:tetratec,项目名称:shareacc,代码行数:34,代码来源:IfileIt.py

示例10: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        #self.load("http://oron.com/?op=change_lang&lang=german")
        # already logged in, so the above line shouldn't be necessary
        self.html = self.load(self.pyfile.url, ref=False, decode=True).replace("\n", "")
        if "download1" in self.html:
            post_url = "http://oron.com/" + self.file_id
            post_dict = {'op': 'download1',
                         'usr_login': '',
                         'id': self.file_id,
                         'fname': self.pyfile.name,
                         'referer': '',
                         'method_free': ' Regular Download '}

            self.html = self.load(post_url, post=post_dict, ref=False, decode=True).encode("utf-8")
            if '<p class="err">' in self.html:
                time_list = re.findall(r'\d+(?=\s[a-z]+,)|\d+(?=\s.*?until)', self.html)
                tInSec = 0
                for t in time_list:
                    tInSec += int(t) * 60 ** (len(time_list) - time_list.index(t) - 1)
                self.setWait(tInSec, True)
                self.wait()
                self.retry()

            if "download2" in self.html:
                post_dict['op'] = 'download2'
                post_dict['method_free'] = 'Regular Download'
                post_dict['method_premium'] = ''
                post_dict['down_direct'] = '1'
                post_dict['btn_download'] = ' Create Download Link '
                del(post_dict['fname'])

                re_captcha = ReCaptcha(self)
                downloadLink = None
                for i in range(5):
                    m = re.search('name="rand" value="(.*?)">', self.html)
                    post_dict['rand'] = m.group(1)
                    challengeId = re.search(r'/recaptcha/api/challenge[?k=]+([^"]+)', self.html)
                    challenge, result = re_captcha.challenge(challengeId.group(1))
                    post_dict['recaptcha_challenge_field'] = challenge
                    post_dict['recaptcha_response_field'] = result
                    self.html = self.load(post_url, post=post_dict)
                    m = re.search('<p class="err">(.*?)</p>', self.html)
                    if m:
                        if m.group(1) == "Wrong captcha":
                            self.invalidCaptcha()
                            self.logDebug("Captcha failed")
                    if 'class="atitle">Download File' in self.html:
                        self.correctCaptcha()
                        downloadLink = re.search('href="(.*?)" class="atitle"', self.html)
                        break

                if not downloadLink:
                    self.fail("Could not find download link")

                self.logDebug("Download url found: %s" % downloadLink.group(1))
                self.download(downloadLink.group(1))
        else:
            self.logError("error in parsing site")
开发者ID:beefone,项目名称:pyload,代码行数:60,代码来源:OronCom.py

示例11: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    def handleFree(self):
        if "Currently only Premium Members can download files larger than" in self.html:
            self.fail("File too large for free download")
        elif "All free download slots on this server are currently in use" in self.html:
            self.retry(50, 900, "All free slots are busy")
             
        # Check Id
        self.check = re.search(self.FILE_CHECK_PATTERN, self.html).group('check')
        self.logDebug("File check code is [%s]" % self.check)
        
        # Resolve captcha
        found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
        recaptcha_key = found.group(1) if found else "6LeN8roSAAAAAPdC1zy399Qei4b1BwmSBSsBN8zm"
        recaptcha = ReCaptcha(self)
        
        # Try up to 5 times
        for i in range(5):           
            challenge, code = recaptcha.challenge(recaptcha_key)
            response = json_loads(self.load("http://www.filefactory.com/file/checkCaptcha.php",
                            post={"check" : self.check, "recaptcha_challenge_field" : challenge, "recaptcha_response_field" : code}))
            if response['status'] == 'ok':
                self.correctCaptcha()
                break
            else:
                self.invalidCaptcha()                            
        else:
            self.fail("No valid captcha after 5 attempts")

        # This will take us to a wait screen
        waiturl = "http://www.filefactory.com" + response['path']
        self.logDebug("Fetching wait with url [%s]" % waiturl)
        waithtml = self.load(waiturl, decode=True)
        found = re.search(r'<a href="(http://www.filefactory.com/dlf/.*?)"', waithtml)
        waithtml = self.load(found.group(1), decode=True)

        # Find the wait value and wait
        wait = int(re.search(self.WAIT_PATTERN, waithtml).group('wait'))
        self.logDebug("Waiting %d seconds." % wait)
        self.setWait(wait, True)
        self.wait()

        # Now get the real download url and retrieve the file
        url = re.search(self.FILE_URL_PATTERN,waithtml).group('url')
        # this may either download our file or forward us to an error page
        self.logDebug("Download URL: %s" % url)
        self.download(url)
        
        check = self.checkDownload({"multiple": "You are currently downloading too many files at once.",
                                    "error": '<div id="errorMessage">'})

        if check == "multiple":
            self.setWait(15*60)
            self.logDebug("Parallel downloads detected; waiting 15 minutes")
            self.wait()
            self.retry()
        elif check == "error":
            self.fail("Unknown error")
开发者ID:4Christopher,项目名称:pyload,代码行数:59,代码来源:FilefactoryCom.py

示例12: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    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:jmcabgam,项目名称:pyload,代码行数:56,代码来源:FilerNet.py

示例13: getDownloadUrl

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
    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:beefone,项目名称:pyload,代码行数:54,代码来源:BitshareCom.py

示例14: handleFree

# 需要导入模块: from module.plugins.ReCaptcha import ReCaptcha [as 别名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import challenge [as 别名]
 def handleFree(self):
     found = re.search(self.SECONDS_PATTERN, self.html)
     seconds = int(found.group(1))
     self.logDebug("Seconds found", seconds)
     self.setWait(seconds + 1)
     self.wait()
     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:4Christopher,项目名称:pyload,代码行数:17,代码来源:CatShareNet.py

示例15: downloadFree

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


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