diff options
Diffstat (limited to 'module/plugins/hoster')
39 files changed, 159 insertions, 159 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 11ee8b7d3..b2064f22f 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -48,17 +48,17 @@ class AlldebridCom(Hoster): self.logDebug("Json data: %s" % str(data)) - if data["error"]: - if data["error"] == "This link isn't available on the hoster website.": + if data['error']: + if data['error'] == "This link isn't available on the hoster website.": self.offline() else: - self.logWarning(data["error"]) + self.logWarning(data['error']) self.tempOffline() else: if pyfile.name and not pyfile.name.endswith('.tmp'): - pyfile.name = data["filename"] - pyfile.size = parseFileSize(data["filesize"]) - new_url = data["link"] + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + new_url = data['link'] if self.getConfig("https"): new_url = new_url.replace("http://", "https://") diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 68b98e0a7..9206aaabd 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -56,7 +56,7 @@ class BasePlugin(Hoster): if server in servers: self.logDebug("Logging on to %s" % server) - self.req.addAuth(account.accounts[server]["password"]) + self.req.addAuth(account.accounts[server]['password']) else: for pwd in pyfile.package().password.splitlines(): if ":" in pwd: diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index ba0f3d263..5f032ca8b 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -34,14 +34,14 @@ def getInfo(urls): info = json_loads(page) if "title" in info: - name = info["title"] + ".mp4" + name = info['title'] + ".mp4" else: name = url - if "error" in info or info["access_error"]: + if "error" in info or info['access_error']: status = "offline" else: - status = info["status"] + status = info['status'] if status in ("ready", "published"): status = "online" elif status in ("waiting", "processing"): diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ddcb13153..19be45f44 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -46,8 +46,8 @@ class DataportCz(SimpleHoster): if not action or not inputs: self.parseError('free_download_form') - if "captchaId" in inputs and inputs["captchaId"] in captchas: - inputs['captchaCode'] = captchas[inputs["captchaId"]] + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] else: self.parseError('captcha') diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index eed53b1e1..9122b094a 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -61,7 +61,7 @@ class DdlstorageCom(XFileSharingPro): data = {'client_id': 53472, 'file_code': file_id} if self.user: - passwd = self.account.getAccountData(self.user)["password"] + passwd = self.account.getAccountData(self.user)['password'] data['req_type'] = 'file_info_reg' data['user_login'] = self.user data['user_password'] = md5(passwd).hexdigest() diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 03c8f10cd..f0a8aa933 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -56,7 +56,7 @@ class AdYouLike: res = self.plugin.load( r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % { - "ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"], + "ayl_key": ayl_data[self.engine]['key'], "ayl_env": ayl_data['all']['env'], "callback": self.ADYOULIKE_CALLBACK}) found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res) @@ -83,7 +83,7 @@ class AdYouLike: """ response = None try: - instructions_visual = challenge["translations"][ayl["all"]["lang"]]["instructions_visual"] + instructions_visual = challenge['translations'][ayl['all']['lang']]['instructions_visual'] found = re.search(u".*«(.*)».*", instructions_visual) if found: response = found.group(1).strip() @@ -98,9 +98,9 @@ class AdYouLike: self.plugin.fail("AdYouLike result failed") return {"_ayl_captcha_engine": self.engine, - "_ayl_env": ayl["all"]["env"], - "_ayl_tid": challenge["tid"], - "_ayl_token_challenge": challenge["token"], + "_ayl_env": ayl['all']['env'], + "_ayl_tid": challenge['tid'], + "_ayl_token_challenge": challenge['token'], "_ayl_response": response} diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 874eeb824..b5fb9608e 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -62,7 +62,7 @@ class ExtabitCom(SimpleHoster): for _ in xrange(5): get_data = {"type": "recaptcha"} - get_data["challenge"], get_data["capture"] = recaptcha.challenge(captcha_key) + get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in response: self.correctCaptcha() diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 8eeabc17c..a59fae498 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -38,7 +38,7 @@ class FastixRu(Hoster): else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) - api_key = api_key["api"] + api_key = api_key['api'] url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) page = self.load(url) data = json_loads(page) @@ -46,7 +46,7 @@ class FastixRu(Hoster): if "error\":true" in page: self.offline() else: - new_url = data["downloadlink"] + new_url = data['downloadlink'] if new_url != pyfile.url: self.logDebug("New URL: %s" % new_url) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index c4112534c..4acbb12f8 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -72,7 +72,7 @@ class FastshareCz(SimpleHoster): def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if "location" in header: - url = header["location"] + url = header['location'] else: self.html = self.load(self.pyfile.url) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 13265e3e4..5d2d4b3c0 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -53,7 +53,7 @@ class FilecloudIo(SimpleHoster): found = re.search(self.AB1_PATTERN, self.html) if not found: self.parseError("__AB1") - data["__ab1"] = found.group(1) + data['__ab1'] = found.group(1) if not self.account: self.fail("User not logged in") @@ -70,25 +70,25 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) response = json_loads(response) - if "error" in response and response["error"]: + if "error" in response and response['error']: self.fail(response) self.logDebug(response) - if response["captcha"]: + 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" + data['ctype'] = "recaptcha" for _ in xrange(5): - data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key) + 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"]: + if "retry" in response and response['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -96,7 +96,7 @@ class FilecloudIo(SimpleHoster): else: self.fail("Incorrect captcha") - if response["dl"]: + if response['dl']: self.html = self.load('http://filecloud.io/download.html') found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if not found: diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 94babc97d..ab582b3a3 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -28,8 +28,8 @@ class FilejungleCom(FileserveCom): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - URLS = ['http://www.filejungle.com/f/', 'http://www.filejungle.com/check_links.php', - 'http://www.filejungle.com/checkReCaptcha.php'] + URLS = ["http://www.filejungle.com/f/", "http://www.filejungle.com/check_links.php", + "http://www.filejungle.com/checkReCaptcha.php"] LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>' LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>| )*([^<]*)' diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c56df23c8..a6f3fae14 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -90,10 +90,10 @@ class FilepostCom(SimpleHoster): for i in xrange(5): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' if i: - post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge( + post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( captcha_key) self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( - captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"])) + captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ebb6204c3..ac12a7892 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -55,8 +55,8 @@ class FileserveCom(Hoster): __author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz") - URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php', - 'http://www.fileserve.com/checkReCaptcha.php'] + URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", + "http://www.fileserve.com/checkReCaptcha.php"] LINKCHECK_TR = r'<tr>\s*(<td>http://www.fileserve\.com/file/.*?)</tr>' LINKCHECK_TD = r'<td>(?:<[^>]*>| )*([^<]*)' @@ -93,24 +93,24 @@ class FileserveCom(Hoster): self.logDebug(action) if "fail" in action: - if action["fail"] == "timeLimit": + if action['fail'] == "timeLimit": self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}, decode=True) self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) - elif action["fail"] == "parallelDownload": + elif action['fail'] == "parallelDownload": self.logWarning(_("Parallel download error, now waiting 60s.")) self.retry(wait_time=60, reason="parallelDownload") else: - self.fail("Download check returned %s" % action["fail"]) + self.fail("Download check returned %s" % action['fail']) elif "success" in action: - if action["success"] == "showCaptcha": + if action['success'] == "showCaptcha": self.doCaptcha() self.doTimmer() - elif action["success"] == "showTimmer": + elif action['success'] == "showTimmer": self.doTimmer() else: @@ -173,7 +173,7 @@ class FileserveCom(Hoster): 'recaptcha_response_field': code, 'recaptcha_shortencode_field': self.file_id})) self.logDebug("reCaptcha response : %s" % response) - if not response["success"]: + if not response['success']: self.invalidCaptcha() else: self.correctCaptcha() @@ -193,7 +193,7 @@ class FileserveCom(Hoster): #try api download response = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, - "password": self.account.getAccountData(self.user)["password"], + "password": self.account.getAccountData(self.user)['password'], "shorten": self.file_id}, decode=True) if response: diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index ddb5a9ec0..ff1056c9f 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -164,7 +164,7 @@ class FreakshareCom(Hoster): if challenge: re_captcha = ReCaptcha(self) - (request_options["recaptcha_challenge_field"], - request_options["recaptcha_response_field"]) = re_captcha.challenge(challenge.group(1)) + (request_options['recaptcha_challenge_field'], + request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) return request_options diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index c6ae75530..725126d17 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -50,7 +50,7 @@ class Ftp(Hoster): if netloc in servers: self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.accounts[netloc]["password"]) + self.req.addAuth(self.account.accounts[netloc]['password']) else: for pwd in pyfile.package().password.splitlines(): if ":" in pwd: diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 89f6cd35f..b44ecb6dd 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -48,17 +48,17 @@ class IfileIt(SimpleHoster): if json_response['status'] == 3: self.offline() - if json_response["captcha"]: + if json_response['captcha']: captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) - post_data["ctype"] = "recaptcha" + post_data['ctype'] = "recaptcha" for _ in xrange(5): - post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key) + post_data['recaptcha_challenge'], post_data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_response = json_loads(self.load(json_url, post=post_data)) self.logDebug(json_response) - if json_response["retry"]: + if json_response['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -69,7 +69,7 @@ class IfileIt(SimpleHoster): if not "ticket_url" in json_response: self.parseError("Download URL") - self.download(json_response["ticket_url"]) + self.download(json_response['ticket_url']) getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3df1e8330..1ebed3bd4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -31,9 +31,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster def api_download_info(url): - json_data = ['yw7XQy2v9', ["download/info", {"link": 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() + api_rep = urllib.urlopen("http://api.letitbit.net/json", data=post_data).read() return json_loads(api_rep) @@ -157,7 +157,7 @@ class LetitbitNet(SimpleHoster): def handlePremium(self): api_key = self.user - premium_key = self.account.getAccountData(self.user)["password"] + 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)}) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 2ed7744d7..3de19945b 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -34,7 +34,7 @@ class LinksnappyCom(Hoster): json_params = json_dumps({'link': pyfile.url, 'type': host, 'username': self.user, - 'password': self.account.getAccountData(self.user)["password"]}) + '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) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 23c698710..1e68cec22 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -64,11 +64,11 @@ class MegaDebridEu(Hoster): """ user, data = self.account.selectAccount() jsonResponse = self.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data["password"]}) + get={'action': 'connectUser', 'login': user, 'password': data['password']}) response = json_loads(jsonResponse) - if response["response_code"] == "ok": - self.token = response["token"] + if response['response_code'] == "ok": + self.token = response['token'] return True else: return False @@ -82,8 +82,8 @@ class MegaDebridEu(Hoster): post={"link": linkToDebrid}) response = json_loads(jsonResponse) - if response["response_code"] == "ok": - debridedLink = response["debridLink"][1:-1] + if response['response_code'] == "ok": + debridedLink = response['debridLink'][1:-1] return debridedLink else: self.exitOnFail("Unable to debrid %s" % linkToDebrid) diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py index a396204ab..cf35f2d2d 100644 --- a/module/plugins/hoster/MegaNz.py +++ b/module/plugins/hoster/MegaNz.py @@ -110,7 +110,7 @@ class MegaNz(Hoster): dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] if "e" in dl: - e = dl["e"] + e = dl['e'] # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later if e == -18: self.retry() @@ -121,12 +121,12 @@ class MegaNz(Hoster): # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) key = self.b64_decode(key) - attr = self.decryptAttr(dl["at"], key) + attr = self.decryptAttr(dl['at'], key) - pyfile.name = attr["n"] + self.FILE_SUFFIX + pyfile.name = attr['n'] + self.FILE_SUFFIX - self.download(dl["g"]) + self.download(dl['g']) self.decryptFile(key) # Everything is finished and final name can be set - pyfile.name = attr["n"] + pyfile.name = attr['n'] diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 378acd856..aa167ba30 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -36,15 +36,15 @@ class MegacrypterCom(MegaNz): dl = self.callApi(link=node, m="dl") # TODO: map error codes, implement password protection - # if info["pass"] is True: - # crypted_file_key, md5_file_key = info["key"].split("#") + # if info['pass'] is True: + # crypted_file_key, md5_file_key = info['key'].split("#") - key = self.b64_decode(info["key"]) + key = self.b64_decode(info['key']) - pyfile.name = info["name"] + self.FILE_SUFFIX + pyfile.name = info['name'] + self.FILE_SUFFIX - self.download(dl["url"]) + self.download(dl['url']) self.decryptFile(key) # Everything is finished and final name can be set - pyfile.name = info["name"] + pyfile.name = info['name'] diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index b2ae07ef1..c2fbaf46e 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -68,15 +68,15 @@ class MultishareCz(SimpleHoster): self.fail("Not enough credit left to download file") url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) - params = {"u_ID": self.acc_info["u_ID"], "u_hash": self.acc_info["u_hash"], "link": self.pyfile.url} + params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} self.logDebug(url, params) self.download(url, get=params) def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) - self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"] / 1024)) + self.logInfo("User %s has %i MB left" % (self.user, self.acc_info['trafficleft'] / 1024)) - return self.pyfile.size / 1024 <= self.acc_info["trafficleft"] + return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 043de5463..5431ebb9a 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -69,8 +69,8 @@ class NetloadIn(Hoster): def prepare(self): self.download_api_data() - if self.api_data and self.api_data["filename"]: - self.pyfile.name = self.api_data["filename"] + if self.api_data and self.api_data['filename']: + self.pyfile.name = self.api_data['filename'] if self.premium: self.logDebug("Netload: Use Premium Account") @@ -113,13 +113,13 @@ class NetloadIn(Hoster): self.api_data = {} if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): lines = src.split(";") - self.api_data["exists"] = True - self.api_data["fileid"] = lines[0] - self.api_data["filename"] = lines[1] - self.api_data["size"] = lines[2] - self.api_data["status"] = lines[3] - if self.api_data["status"] == "online": - self.api_data["checksum"] = lines[4].strip() + self.api_data['exists'] = True + self.api_data['fileid'] = lines[0] + self.api_data['filename'] = lines[1] + self.api_data['size'] = lines[2] + self.api_data['status'] = lines[3] + if self.api_data['status'] == "online": + self.api_data['checksum'] = lines[4].strip() else: self.api_data = False # check manually since api data is useless sometimes diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 2a6bf8759..2176f1cd5 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -34,7 +34,7 @@ class OboomCom(Hoster): if self.premium: accountInfo = self.account.getAccountInfo(self.user, True) if "session" in accountInfo: - self.sessionToken = accountInfo["session"] + self.sessionToken = accountInfo['session'] else: self.fail("Could not retrieve premium session") else: @@ -88,9 +88,9 @@ class OboomCom(Hoster): result = self.loadUrl(apiUrl, params) if result[0] == 200: item = result[1][0] - if item["state"] == "online": - self.fileSize = item["size"] - self.fileName = item["name"] + if item['state'] == "online": + self.fileSize = item['size'] + self.fileName = item['name'] else: self.offline() else: @@ -100,10 +100,10 @@ class OboomCom(Hoster): apiUrl = "https://api.oboom.com/1.0/dl" params = {"item": self.fileId, "http_errors": 0} if self.premium: - params["token"] = self.sessionToken + params['token'] = self.sessionToken else: - params["token"] = self.downloadToken - params["auth"] = self.downloadAuth + params['token'] = self.downloadToken + params['auth'] = self.downloadAuth result = self.loadUrl(apiUrl, params) if result[0] == 200: diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index aaa1442e4..f030c9e87 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -42,19 +42,19 @@ class OverLoadMe(Hoster): data = self.account.getAccountData(self.user) page = self.load("https://api.over-load.me/getdownload.php", - get={"auth": data["password"], "link": pyfile.url}) + get={"auth": data['password'], "link": pyfile.url}) data = json_loads(page) self.logDebug("Returned Data: %s" % data) - if data["err"] == 1: - self.logWarning(data["msg"]) + if data['err'] == 1: + self.logWarning(data['msg']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data["filename"]: - pyfile.name = data["filename"] - pyfile.size = parseFileSize(data["filesize"]) - new_url = data["downloadlink"] + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + new_url = data['downloadlink'] if self.getConfig("https"): new_url = new_url.replace("http://", "https://") diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index ce2b6f48e..f87405675 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -110,13 +110,13 @@ class RapidgatorNet(SimpleHoster): self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( - jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"]) + jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) self.wait(int(jsvars.get('secs', 45)) + 1, False) url = "http://rapidgator.net%s?sid=%s" % ( - jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"]) + jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) jsvars.update(self.getJsonResponse(url)) self.req.http.lastURL = self.pyfile.url diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 4ecd3c841..b50f1c568 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -87,7 +87,7 @@ class RapidshareCom(Hoster): self.name = m.group("name_new") self.download_api_data() - if self.api_data["status"] == "1": + if self.api_data['status'] == "1": self.pyfile.name = self.get_file_name() if self.premium: @@ -95,15 +95,15 @@ class RapidshareCom(Hoster): else: self.handleFree() - elif self.api_data["status"] == "2": + elif self.api_data['status'] == "2": self.logInfo(_("Rapidshare: Traffic Share (direct download)")) self.pyfile.name = self.get_file_name() self.download(self.pyfile.url, get={"directstart": 1}) - elif self.api_data["status"] in ("0", "4", "5"): + elif self.api_data['status'] in ("0", "4", "5"): self.offline() - elif self.api_data["status"] == "3": + elif self.api_data['status'] == "3": self.tempOffline() else: self.fail("Unknown response code.") @@ -133,7 +133,7 @@ class RapidshareCom(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%s: Use Premium Account" % self.__name__) - url = self.api_data["mirror"] + url = self.api_data['mirror'] self.download(url, get={"directstart": 1}) def download_api_data(self, force=False): @@ -163,12 +163,12 @@ class RapidshareCom(Hoster): self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3], "status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()} - if int(self.api_data["status"]) > 100: - self.api_data["status"] = str(int(self.api_data["status"]) - 100) - elif int(self.api_data["status"]) > 50: - self.api_data["status"] = str(int(self.api_data["status"]) - 50) + if int(self.api_data['status']) > 100: + self.api_data['status'] = str(int(self.api_data['status']) - 100) + elif int(self.api_data['status']) > 50: + self.api_data['status'] = str(int(self.api_data['status']) - 50) - self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data def freeWait(self): """downloads html with the important information @@ -214,14 +214,14 @@ class RapidshareCom(Hoster): "name": name, "host": data[0], "auth": data[1], - "server": self.api_data["serverid"], - "size": self.api_data["size"]} + "server": self.api_data['serverid'], + "size": self.api_data['size']} self.setWait(int(data[2]) + 2 + self.offset) self.wait() return dl_dict def get_file_name(self): - if self.api_data["filename"]: - return self.api_data["filename"] + if self.api_data['filename']: + return self.api_data['filename'] return self.url.split("/")[-1] diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 36fcd194c..17cd86ccd 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -54,16 +54,16 @@ class RealdebridCom(Hoster): self.logDebug("Returned Data: %s" % data) - if data["error"] != 0: - if data["message"] == "Your file is unavailable on the hoster.": + if data['error'] != 0: + if data['message'] == "Your file is unavailable on the hoster.": self.offline() else: - self.logWarning(data["message"]) + self.logWarning(data['message']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data["file_name"]: - pyfile.name = data["file_name"] - pyfile.size = parseFileSize(data["file_size"]) + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + pyfile.name = data['file_name'] + pyfile.size = parseFileSize(data['file_size']) new_url = data['generated_links'][0][-1] if self.getConfig("https"): diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 94e53520a..79c06f863 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -26,7 +26,7 @@ class RehostTo(Hoster): self.fail("No rehost.to account provided") data = self.account.getAccountInfo(self.user) - long_ses = data["long_ses"] + long_ses = data['long_ses'] self.logDebug("Rehost.to: Old URL: %s" % pyfile.url) new_url = "http://rehost.to/process_download.php?user=cookie&pass=%s&dl=%s" % (long_ses, quote(pyfile.url, "")) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index ecfe389e3..a26827401 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -31,7 +31,7 @@ class RyushareCom(XFileSharingPro): self.html = self.load(self.pyfile.url) action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) if "method_premium" in inputs: - del inputs["method_premium"] + del inputs['method_premium'] self.html = self.load(self.pyfile.url, post=inputs) action, inputs = self.parseHtmlForm('F1') @@ -45,7 +45,7 @@ class RyushareCom(XFileSharingPro): match = re.search(self.WAIT_PATTERN, self.html) if match: m = match.groupdict(0) - waittime = int(m["hour"]) * 60 * 60 + int(m["min"]) * 60 + int(m["sec"]) + waittime = int(m['hour']) * 60 * 60 + int(m['min']) * 60 + int(m['sec']) self.setWait(waittime, True) retry = True @@ -62,8 +62,8 @@ class RyushareCom(XFileSharingPro): captcha = SolveMedia(self) challenge, response = captcha.challenge(captchaKey) - inputs["adcopy_challenge"] = challenge - inputs["adcopy_response"] = response + inputs['adcopy_challenge'] = challenge + inputs['adcopy_response'] = response self.html = self.load(self.pyfile.url, post=inputs) if "WRONG CAPTCHA" in self.html: diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 78cc29fdb..0e0676626 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -84,17 +84,17 @@ class ShareonlineBiz(Hoster): fields = src.split(";") self.api_data = {"fileid": fields[0], "status": fields[1]} - if not self.api_data["status"] == "OK": + if not self.api_data['status'] == "OK": self.offline() else: - self.api_data["filename"] = fields[2] - self.api_data["size"] = fields[3] # in bytes - self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5 + self.api_data['filename'] = fields[2] + self.api_data['size'] = fields[3] # in bytes + self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") # md5 def handleFree(self): self.loadAPIData() - self.pyfile.name = self.api_data["filename"] - self.pyfile.size = int(self.api_data["size"]) + self.pyfile.name = self.api_data['filename'] + self.pyfile.size = int(self.api_data['size']) self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff self.setWait(3) @@ -147,7 +147,7 @@ class ShareonlineBiz(Hoster): def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) src = self.load("http://api.share-online.biz/account.php", - {"username": self.user, "password": self.account.accounts[self.user]["password"], + {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.file_id}) self.api_data = dlinfo = {} @@ -156,13 +156,13 @@ class ShareonlineBiz(Hoster): dlinfo[key.lower()] = value self.logDebug(dlinfo) - if not dlinfo["status"] == "online": + if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo["name"] - self.pyfile.size = int(dlinfo["size"]) + self.pyfile.name = dlinfo['name'] + self.pyfile.size = int(dlinfo['size']) - dlLink = dlinfo["url"] + dlLink = dlinfo['url'] if dlLink == "server_under_maintenance": self.tempOffline() else: diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 849f3797a..a9b2804e4 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -74,7 +74,7 @@ class StreamcloudEu(XFileSharingPro): self.logDebug(self.HOSTER_NAME, inputs) - if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'): + if 'op' in inputs and inputs['op'] in ("download1", "download2", "download3"): if "password" in inputs: if self.passwords: inputs['password'] = self.passwords.pop(0) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index a111240ca..a3da22fe4 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -103,7 +103,7 @@ class UlozTo(SimpleHoster): self.logDebug('Using "old" version') captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) - self.logDebug('CAPTCHA ID: ' + inputs['captcha_id'] + ', CAPTCHA VALUE: ' + captcha_value) + self.logDebug('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}) @@ -116,7 +116,7 @@ class UlozTo(SimpleHoster): data = json_loads(xapca) captcha_value = self.decryptCaptcha(str(data['image'])) - self.logDebug('CAPTCHA HASH: ' + data['hash'] + ', CAPTCHA SALT: ' + str(data['salt']) + ', CAPTCHA VALUE: ' + captcha_value) + self.logDebug("CAPTCHA HASH: " + data['hash'] + ", CAPTCHA SALT: " + str(data['salt']) + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) else: diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 4cf8b35b5..bfe28f158 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -148,8 +148,8 @@ class UploadedTo(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, - "left": info["trafficleft"] / 1024 / 1024}) - if int(self.data[1]) / 1024 > info["trafficleft"]: + "left": info['trafficleft'] / 1024 / 1024}) + if int(self.data[1]) / 1024 > info['trafficleft']: self.logInfo(_("%s: Not enough traffic left" % self.__name__)) self.account.empty(self.user) self.resetAccount() diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index d5d1e6507..896858cbc 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -258,7 +258,7 @@ class XFileSharingPro(SimpleHoster): self.logDebug(self.HOSTER_NAME, inputs) - if 'op' in inputs and inputs['op'] in ('download2', 'download3'): + if 'op' in inputs and inputs['op'] in ("download2", "download3"): if "password" in inputs: if self.passwords: inputs['password'] = self.passwords.pop(0) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index b5b548620..d11520cd5 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -54,13 +54,13 @@ class XHamsterCom(Hoster): j = clean_json(json_flashvar.group(1)) flashvars = json_loads(j) - if flashvars["srv"]: - srv_url = flashvars["srv"] + '/' + if flashvars['srv']: + srv_url = flashvars['srv'] + '/' else: self.fail("Parse error (srv_url)") - if flashvars["url_mode"]: - url_mode = flashvars["url_mode"] + if flashvars['url_mode']: + url_mode = flashvars['url_mode'] else: self.fail("Parse error (url_mode)") @@ -72,8 +72,8 @@ class XHamsterCom(Hoster): long_url = srv_url + file_url self.logDebug("long_url: %s" % long_url) else: - if flashvars["file"]: - file_url = unquote(flashvars["file"]) + if flashvars['file']: + file_url = unquote(flashvars['file']) else: self.fail("Parse error (file_url)") diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index d6083e4f7..8f3fb284f 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -166,31 +166,31 @@ class Xdcc(Hoster): "text": msg[3][1:] } - if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]: - if msg["text"] == "\x01VERSION\x01": + if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: + if msg['text'] == "\x01VERSION\x01": self.logDebug("XDCC: Sending CTCP VERSION.") sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) - elif msg["text"] == "\x01TIME\x01": + elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME.") sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) - elif msg["text"] == "\x01LAG\x01": + elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer - if not (bot == msg["origin"][0:len(bot)] - and nick == msg["target"][0:len(nick)] - and msg["action"] in ("PRIVMSG", "NOTICE")): + if not (bot == msg['origin'][0:len(bot)] + and nick == msg['target'][0:len(nick)] + and msg['action'] in ("PRIVMSG", "NOTICE")): continue if self.debug is 1: - print "%s: %s" % (msg["origin"], msg["text"]) + print "%s: %s" % (msg['origin'], msg['text']) - if "You already requested that pack" in msg["text"]: + if "You already requested that pack" in msg['text']: retry = time.time() + 300 - if "you must be on a known channel to request a pack" in msg["text"]: + if "you must be on a known channel to request a pack" in msg['text']: self.fail("Wrong channel") - m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"]) + m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text']) if m: done = True diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 0aca311ce..a7cd924bf 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -53,7 +53,7 @@ class YibaishiwuCom(SimpleHoster): for m in mirrors: try: - url = m['url'].replace('\\', '') + url = m['url'].replace("\\", "") self.logDebug("Trying URL: " + url) self.download(url) break diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 6505eac1a..eb260298b 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -23,7 +23,7 @@ def which(program): if is_exe(program): return program else: - for path in os.environ["PATH"].split(os.pathsep): + for path in os.environ['PATH'].split(os.pathsep): path = path.strip('"') exe_file = os.path.join(path, program) if is_exe(exe_file): |