def handle_multi(self, pyfile): if not self.account: self.fail(_("Only registered or premium users can use url leech feature")) #: Only tested with easybytez.com self.data = self.load("http://www.%s/" % self.PLUGIN_DOMAIN) action, inputs = self.parse_html_form() upload_id = "%012d" % int(random.random() * 10 ** 12) action += upload_id + "&js_on=1&utype=prem&upload_type=url" inputs['tos'] = '1' inputs['url_mass'] = pyfile.url inputs['up1oad_type'] = 'url' self.log_debug(action, inputs) self.req.setOption("timeout", 600) #: Wait for file to upload to easybytez.com self.data = self.load(action, post=inputs) self.check_errors() action, inputs = self.parse_html_form('F1') if not inputs: self.retry(msg=self.info.get('error') or _("TEXTAREA F1 not found")) self.log_debug(inputs) stmsg = inputs['st'] if stmsg == 'OK': self.data = self.load(action, post=inputs) elif 'Can not leech file' in stmsg: self.retry(20, 3 * 60, _("Can not leech file")) elif 'today' in stmsg: self.retry(wait=seconds_to_midnight(), msg=_("You've used all Leech traffic today")) else: self.fail(stmsg) #: Get easybytez.com link for uploaded file m = re.search(self.LINK_LEECH_PATTERN, self.data) if m is None: self.error(_("LINK_LEECH_PATTERN not found")) header = self.load(m.group(1), just_header=True) if 'location' in header: #: Direct download link self.link = header.get('location')
def check_errors(self): if '<valid>0</valid>' in self.data or ( "You are not allowed to download from this host" in self.data and self.premium): self.account.relogin() self.retry() elif "NOTFOUND" in self.data: self.offline() elif "downloadlimit" in self.data: self.log_warning(_("Reached maximum connctions")) self.retry(5, 60, _("Reached maximum connctions")) elif "trafficlimit" in self.data: self.log_warning(_("Reached daily limit for this host")) self.retry(wait=seconds_to_midnight(), msg="Daily limit for this host reached") elif "hostererror" in self.data: self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) self.retry(5, 60, _("Hoster is temporarily unavailable"))