Exemplo n.º 1
0
    def handleFree(self):
        captchas = {
            "1": "jkeG",
            "2": "hMJQ",
            "3": "vmEK",
            "4": "ePQM",
            "5": "blBd"
        }

        for i in range(60):
            action, inputs = self.parseHtmlForm('free_download_form')
            self.logDebug(action, inputs)
            if not action or not inputs:
                raise PluginParseError('free_download_form')

            if "captchaId" in inputs and inputs["captchaId"] in captchas:
                inputs['captchaCode'] = captchas[inputs["captchaId"]]
            else:
                raise PluginParseError('captcha')

            self.html = self.download("http://www.dataport.cz%s" % action,
                                      post=inputs)

            check = self.checkDownload({
                "captcha":
                'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',
                "slot":
                'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'
            })
            if check == "captcha":
                raise PluginParseError('invalid captcha')
            elif check == "slot":
                self.logDebug("No free slots - wait 60s and retry")
                self.setWait(60, False)
                self.wait()
                self.html = self.load(self.pyfile.url, decode=True)
                continue
            else:
                break
Exemplo n.º 2
0
    def handleFree(self):
        data = {"ukey": self.file_info['ID']}

        found = re.search(self.AB1_PATTERN, self.html)
        if not found:
            raise PluginParseError("__AB1")
        data["__ab1"] = found.group(1)

        if not self.account:
            self.fail("User not logged in")
        elif not self.account.logged_in:
            recaptcha = ReCaptcha(self)
            captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY)
            self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
                                      "recaptcha_response_field": captcha_response}
            self.account.relogin(self.user)
            self.retry(max_tries=2)

        json_url = "http://filecloud.io/download-request.json"
        response = self.load(json_url, post=data)
        self.logDebug(response)
        response = json_loads(response)

        if "error" in response and response["error"]:
            self.fail(response)

        self.logDebug(response)
        if response["captcha"]:
            recaptcha = ReCaptcha(self)
            found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
            captcha_key = found.group(1) if found else self.RECAPTCHA_KEY
            data["ctype"] = "recaptcha"

            for i in range(5):
                data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key)

                json_url = "http://filecloud.io/download-request.json"
                response = self.load(json_url, post=data)
                self.logDebug(response)
                response = json_loads(response)

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

        if response["dl"]:
            self.html = self.load('http://filecloud.io/download.html')
            found = re.search(self.DOWNLOAD_LINK_PATTERN % self.file_info['ID'], self.html)
            if not found:
                raise PluginParseError("Download URL")
            download_url = found.group(1)
            self.logDebug("Download URL: %s" % download_url)

            if "size" in self.file_info and self.file_info['size']:
                self.check_data = {"size": int(self.file_info['size'])}
            self.download(download_url)
        else:
            self.fail("Unexpected server response")
Exemplo n.º 3
0
                self.longWait(5 * 60, 12)
            else:
                self.correctCaptcha()
                break
        else:
            self.fail("No valid captcha code entered")

        found = re.search("countdown_number = (\d+);", self.html)
        self.setWait(int(found.group(1)) if found else 50)

        # download the file, destination is determined by pyLoad
        self.logDebug("WAIT URL", self.req.lastEffectiveURL)
        found = re.search("free_wait.php\?server=(.*?)&(.*)",
                          self.req.lastEffectiveURL)
        if not found:
            raise PluginParseError('Download URL')

        url = "http://%s/download.php?%s" % (found.group(1), found.group(2))

        self.wait()
        self.download(url)
        self.checkDownloadedFile()

    def checkDownloadedFile(self):
        # check download
        check = self.checkDownload({
            "tempoffline":
            re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
            "credit":
            re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
            "multi_dl":