def api_response(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.log_debug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) self.log_debug("API Response: " + res) return json_loads(res)
def handlePremium(self, pyfile): host = self._get_host(pyfile.url) json_params = json_dumps({ 'link': pyfile.url, 'type': host, 'username': self.user, 'password': self.account.getAccountData(self.user)['password'] }) r = self.load("http://gen.linksnappy.com/genAPI.php", post={'genLinks': json_params}) self.logDebug("JSON data: " + r) j = json_loads(r)['links'][0] if j['error']: self.error(_("Error converting the link")) pyfile.name = j['filename'] self.link = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup()
def handlePremium(self): api_key = self.user premium_key = self.account.getAccountData(self.user)["password"] json_data = [ api_key, [ "download/direct_links", { "pass": premium_key, "link": self.pyfile.url } ] ] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug('API Data: ' + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) direct_link = api_rep['data'][0][0] self.logDebug('Direct Link: ' + direct_link) self.download(direct_link, disposition=True)
def callApi(self, **kwargs): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ # generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) resp = self.load(self.API_URL % uid, post=json_dumps([kwargs])) self.logDebug("Api Response: " + resp) return json_loads(resp)
def handlePremium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) self.download(api_rep['data'][0][0], disposition=True)
def handle_premium(self, pyfile): api_key = self.user premium_key = self.account.get_info(self.user)['login']['password'] json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == "FAIL": self.fail(api_rep['data']) self.link = api_rep['data'][0][0]
def handlePremium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) self.link = api_rep['data'][0][0]
def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError( _("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") self.fail("No Linksnappy.com account provided") else: self.logDebug("Old URL: %s" % pyfile.url) host = self._get_host(pyfile.url) json_params = json_dumps({ 'link': pyfile.url, 'type': host, 'username': self.user, 'password': self.account.getAccountData(self.user)["password"] }) r = self.load('http://gen.linksnappy.com/genAPI.php', post={'genLinks': json_params}) self.logDebug("JSON data: " + r) j = json_loads(r)['links'][0] if j['error']: self.logError('Error converting the link: %s' % j['error']) self.fail('Error converting the link') pyfile.name = j['filename'] new_url = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup() if new_url != pyfile.url: self.logDebug("New URL: " + new_url) self.download(new_url, disposition=True) check = self.checkDownload({"html302": "<title>302 Found</title>"}) if check == "html302": self.retry(wait_time=5, reason="Linksnappy returns only HTML data.")
def handle_premium(self, pyfile): host = self._get_host(pyfile.url) json_params = json_dumps({'link' : pyfile.url, 'type' : host, 'username': self.user, 'password': self.account.get_info(self.user)['login']['password']}) r = self.load("http://linksnappy.com/api/linkgen", post={'genLinks': json_params}) self.log_debug("JSON data: " + r) j = json_loads(r)['links'][0] if j['error']: self.error(_("Error converting the link")) pyfile.name = j['filename'] self.link = j['generated']
def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") self.fail("No Linksnappy.com account provided") else: self.logDebug("Old URL: %s" % pyfile.url) host = self._get_host(pyfile.url) json_params = json_dumps({'link': pyfile.url, 'type': host, 'username': self.user, 'password': self.account.getAccountData(self.user)["password"]}) r = self.load('http://gen.linksnappy.com/genAPI.php', post={'genLinks': json_params}) self.logDebug("JSON data: " + r) j = json_loads(r)['links'][0] if j['error']: self.logError('Error converting the link: %s' % j['error']) self.fail('Error converting the link') pyfile.name = j['filename'] new_url = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup() if new_url != pyfile.url: self.logDebug("New URL: " + new_url) self.download(new_url, disposition=True) check = self.checkDownload({"html302": "<title>302 Found</title>"}) if check == "html302": self.retry(wait_time=5, reason="Linksnappy returns only HTML data.")
def handlePremium(self, pyfile): host = self._get_host(pyfile.url) json_params = json_dumps({'link' : pyfile.url, 'type' : host, 'username': self.user, 'password': self.account.getAccountData(self.user)['password']}) r = self.load("http://gen.linksnappy.com/genAPI.php", post={'genLinks': json_params}) self.logDebug("JSON data: " + r) j = json_loads(r)['links'][0] if j['error']: self.error(_("Error converting the link")) pyfile.name = j['filename'] self.link = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup()
def callApi(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.logDebug("JSON request: " + json_dumps(kwargs)) resp = self.load(self.API_URL, post=json_dumps(kwargs)) self.logDebug("API Response: " + resp) return json_loads(resp)
def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] api_rep = getURL("http://api.letitbit.net/json", post={'r': json_dumps(json_data)}) return json_loads(api_rep)
def api_download_info(url): json_data = ['yw7XQy2v9', ["download/info", {"link": url}]] post_data = urllib.urlencode({'r': json_dumps(json_data)}) api_rep = urllib.urlopen('http://api.letitbit.net/json', data=post_data).read() return json_loads(api_rep)