RapiduNet.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:download-manager 作者: thispc 项目源码 文件源码
def handle_free(self, pyfile):
        self.req.http.lastURL = pyfile.url
        self.req.http.c.setopt(
            pycurl.HTTPHEADER,
            ["X-Requested-With: XMLHttpRequest"])

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

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

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

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

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

        self.captcha = ReCaptcha(pyfile)
        response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY)

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

        if jsvars['message'] == "success":
            self.link = jsvars['url']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号