def get_rt_update(self): rtUpdate = self.retrieve("rtUpdate") if rtUpdate: return rtUpdate if ( self.retrieve("version") is not self.__version__ or int(self.retrieve("timestamp", 0)) + 86400000 < timestamp() ): #: that's right, we are even using jdownloader updates rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js") rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) #: But we still need to fix the syntax to work with other engines than rhino rtUpdate = re.sub( r"for each\(var (\w+) in(\[[^\]]+\])\)\{", r"zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];", rtUpdate, ) rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) self.store("rtUpdate", rtUpdate) self.store("timestamp", timestamp()) self.store("version", self.__version__) else: self.log_error(_("Unable to download, wait for update...")) self.temp_offline() return rtUpdate
def handle_free(self, pyfile): action, inputs = self.parse_html_form('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: self.error(_("Free download form not found")) self.log_debug("inputs.keys = %s" % inputs.keys()) #: Get and decrypt captcha if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): #: Old version - last seen 9.12.2013 self.log_debug('Using "old" version') captcha_value = self.captcha.decrypt("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) self.log_debug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")): #: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.log_debug('Using "new" version') xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': timestamp()}) xapca = xapca.replace('sound":"', 'sound":"http:').replace('image":"', 'image":"http:') self.log_debug("xapca: %s" % xapca) data = json.loads(xapca) captcha_value = self.captcha.decrypt(data['image']) self.log_debug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: %s" % data['salt'], "CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) else: self.error(_("CAPTCHA form changed")) self.download("http://www.ulozto.net" + action, post=inputs)
def handle_premium(self, pyfile): postData = {'action': 'get_link', 'code' : self.info['pattern']['ID'], 'pass' : 'undefined'} self.data = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) url = re.search(r'"link"\s*:\s*"(.*?)"', self.data) if url: self.link = url.group(1).replace("\\/", "/") raise Exception("Plugin defect")