diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-10 00:19:51 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-10 00:19:51 +0100 |
commit | c9e31d875d32de31e54959b82bc35eff2b3e0f3f (patch) | |
tree | 5022eadf2ac5c65ba075f172af873b737310ed66 /module/plugins/accounts | |
parent | [Keep2shareCc] Fix account __name__ (diff) | |
download | pyload-c9e31d875d32de31e54959b82bc35eff2b3e0f3f.tar.xz |
Code cosmetics
Diffstat (limited to 'module/plugins/accounts')
20 files changed, 83 insertions, 83 deletions
diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py index b32003688..b2295c3f1 100644 --- a/module/plugins/accounts/BayfilesCom.py +++ b/module/plugins/accounts/BayfilesCom.py @@ -18,20 +18,20 @@ class BayfilesCom(Account): def loadAccountInfo(self, user, req): for _i in xrange(2): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(response) - if not response['error']: + res = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) + self.logDebug(res) + if not res['error']: break - self.logWarning(response['error']) + self.logWarning(res['error']) self.relogin(user) - return {"premium": bool(response['premium']), "trafficleft": -1, - "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} + return {"premium": bool(res['premium']), "trafficleft": -1, + "validuntil": res['expires'] if res['expires'] >= int(time()) else -1} def login(self, user, data, req): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) - self.logDebug(response) - if response['error']: - self.logError(response['error']) + res = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) + self.logDebug(res) + if res['error']: + self.logError(res['error']) self.wrongPassword() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index cb4396d02..437265c3f 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -20,8 +20,8 @@ class DepositfilesCom(Account): def loadAccountInfo(self, user, req): - src = req.load("https://dfiles.eu/de/gold/") - validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", src).group(1) + html = req.load("https://dfiles.eu/de/gold/") + validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) @@ -29,7 +29,7 @@ class DepositfilesCom(Account): def login(self, user, data, req): - src = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}) - if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src: + html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, + post={"login": user, "password": data['password']}) + if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: self.wrongPassword() diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index c001d4513..f62d95301 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -42,7 +42,7 @@ class FilecloudIo(Account): def login(self, user, data, req): - req.cj.setCookie("secure.filecloud.io", "lang", "en") + req.cj.setCookie(".secure.filecloud.io", "lang", "en") html = req.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index fe25ccc0e..565a00cf2 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -21,13 +21,13 @@ class FourSharedCom(Account): def login(self, user, data, req): - req.cj.setCookie("4shared.com", "4langcookie", "en") - response = req.load('http://www.4shared.com/web/login', - post={"login": user, - "password": data['password'], - "remember": "on", - "_remember": "on", - "returnTo": "http://www.4shared.com/account/home.jsp"}) - - if 'Please log in to access your 4shared account' in response: + req.cj.setCookie(".4shared.com", "4langcookie", "en") + res = req.load('http://www.4shared.com/web/login', + post={'login': user, + 'password': data['password'], + 'remember': "on", + '_remember': "on", + 'returnTo': "http://www.4shared.com/account/home.jsp"}) + + if 'Please log in to access your 4shared account' in res: self.wrongPassword() diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index f0692ca5c..685740a5c 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -44,7 +44,7 @@ class HellshareCz(Account): trafficleft = int(credit) * 1024 validuntil = -1 except Exception, e: - self.logError(_("Unable to parse credit info"), str(e)) + self.logError(_("Unable to parse credit info"), e) validuntil = -1 trafficleft = -1 diff --git a/module/plugins/accounts/Keep2shareCc.py b/module/plugins/accounts/Keep2shareCc.py index 22682e247..de9b9b5d8 100644 --- a/module/plugins/accounts/Keep2shareCc.py +++ b/module/plugins/accounts/Keep2shareCc.py @@ -39,7 +39,7 @@ class Keep2shareCc(Account): validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) except Exception, e: - self.logError(str(e)) + self.logError(e) else: if validuntil > mktime(gmtime()): @@ -54,7 +54,7 @@ class Keep2shareCc(Account): trafficleft = self.parseTraffic(m.group(1)) except Exception, e: - self.logError(str(e)) + self.logError(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index b1b3368a6..e7e22048b 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -22,18 +22,18 @@ class MegaDebridEu(Account): data = self.getAccountData(user) jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - return {"premium": True, "validuntil": float(response['vip_end']), "status": True} + if res['response_code'] == "ok": + return {"premium": True, "validuntil": float(res['vip_end']), "status": True} else: - self.logError(response) + self.logError(res) return {"status": False, "premium": False} def login(self, user, data, req): jsonResponse = req.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) - response = json_loads(jsonResponse) - if response['response_code'] != "ok": + res = json_loads(jsonResponse) + if res['response_code'] != "ok": self.wrongPassword() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 440eba8da..41da7ac73 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -25,19 +25,19 @@ class MegaRapidCz(Account): def loadAccountInfo(self, user, req): - src = req.load("http://megarapid.cz/mujucet/", decode=True) + html = req.load("http://megarapid.cz/mujucet/", decode=True) - m = re.search(self.LIMITDL_PATTERN, src) + m = re.search(self.LIMITDL_PATTERN, html) if m: data = self.getAccountData(user) data['options']['limitDL'] = [int(m.group(1))] - m = re.search(self.VALID_UNTIL_PATTERN, src) + m = re.search(self.VALID_UNTIL_PATTERN, html) if m: validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - m = re.search(self.TRAFFIC_LEFT_PATTERN, src) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: trafficleft = float(m.group(1)) * (1 << 20) return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index dae892c05..2f1c914c1 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -38,7 +38,7 @@ class OneFichierCom(Account): try: validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) except Exception, e: - self.logError(str(e)) + self.logError(e) else: premium = True diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 35ad58d2d..4daa56a75 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -16,11 +16,11 @@ class RPNetBiz(Account): def loadAccountInfo(self, user, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) try: - if response['accountInfo']['isPremium']: + if res['accountInfo']['isPremium']: # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(response['accountInfo']['premiumExpiry']), + account_info = {"validuntil": int(res['accountInfo']['premiumExpiry']), "trafficleft": -1, "premium": True} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} @@ -34,18 +34,18 @@ class RPNetBiz(Account): def login(self, user, data, req): # Get account information from rpnet.biz - response = self.getAccountStatus(user, req) + res = self.getAccountStatus(user, req) - # If we have an error in the response, we have wrong login information - if 'error' in response: + # If we have an error in the res, we have wrong login information + if 'error' in res: self.wrongPassword() def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account - response = req.load("https://premium.rpnet.biz/client_api.php", + res = req.load("https://premium.rpnet.biz/client_api.php", get={"username": user, "password": self.accounts[user]['password'], "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % response) + self.logDebug("JSON data: %s" % res) - return json_loads(response) + return json_loads(res) diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index c14a56f7d..5c2ce66f5 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -18,10 +18,10 @@ class RapidshareCom(Account): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src) - fields = src.split("\n") + html = req.load(api_url_base, cookies=False, get=api_param_prem) + if html.startswith("ERROR"): + raise Exception(html) + fields = html.split("\n") info = {} for t in fields: if not t.strip(): @@ -41,10 +41,10 @@ class RapidshareCom(Account): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, "password": data['password'], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - raise Exception(src + "### Note you have to use your account number for login, instead of name") - fields = src.split("\n") + html = req.load(api_url_base, cookies=False, get=api_param_prem) + if html.startswith("ERROR"): + raise Exception(html + "### Note you have to use your account number for login, instead of name") + fields = html.split("\n") info = {} for t in fields: if not t.strip(): @@ -52,4 +52,4 @@ class RapidshareCom(Account): k, v = t.split("=") info[k] = v cj = self.getAccountCookies(user) - cj.setCookie("rapidshare.com", "enc", info['cookie']) + cj.setCookie(".rapidshare.com", "enc", info['cookie']) diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index b0833f7af..331bb9f74 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -20,19 +20,19 @@ class ShareonlineBiz(Account): def loadAccountInfo(self, user, req): - src = self.getUserAPI(user, req) + html = self.getUserAPI(user, req) info = {} - for line in src.splitlines(): + for line in html.splitlines(): if "=" in line: key, value = line.split("=") info[key] = value self.logDebug(info) if "dl" in info and info['dl'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info['dl']) + req.cj.setCookie(".share-online.biz", "dl", info['dl']) if "a" in info and info['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info['a']) + req.cj.setCookie(".share-online.biz", "a", info['a']) return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, "trafficleft": -1, @@ -40,6 +40,6 @@ class ShareonlineBiz(Account): def login(self, user, data, req): - src = self.getUserAPI(user, req) - if "EXCEPTION" in src: + html = self.getUserAPI(user, req) + if "EXCEPTION" in html: self.wrongPassword() diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 979ce73aa..ab9474955 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -33,7 +33,7 @@ class SimplyPremiumCom(Account): def login(self, user, data, req): - req.cj.setCookie("simply-premium.com", "lang", "EN") + req.cj.setCookie(".simply-premium.com", "lang", "EN") if data['password'] == '' or data['password'] == '0': post_data = {"key": user} diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 784a90ae3..7979fd5d5 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -17,8 +17,8 @@ class SimplydebridCom(Account): def loadAccountInfo(self, user, req): get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - data = [x.strip() for x in response.split(";")] + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + data = [x.strip() for x in res.split(";")] if str(data[0]) != "1": return {"premium": False} else: @@ -29,6 +29,6 @@ class SimplydebridCom(Account): self.loginname = user self.password = data['password'] get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - if response != "02: loggin success": + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + if res != "02: loggin success": self.wrongPassword() diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index f87d234a7..b26cad1af 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -31,7 +31,7 @@ class TurbobitNet(Account): def login(self, user, data, req): - req.cj.setCookie("turbobit.net", "user_lang", "en") + req.cj.setCookie(".turbobit.net", "user_lang", "en") html = req.load("http://turbobit.net/user/login", post={ "user[login]": user, diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 178d9a47d..2632d2535 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -23,7 +23,7 @@ class UlozTo(Account): #this cookie gets lost somehow after each request self.phpsessid = req.cj.getCookie("ULOSESSID") html = req.load("http://www.ulozto.net/", decode=True) - req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid) + req.cj.setCookie(".ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) trafficleft = int(float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048) if m else 0 diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index e43d6bbd7..60e501d2e 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -29,7 +29,7 @@ class UnrestrictLi(Account): def login(self, user, data, req): - req.cj.setCookie("unrestrict.li", "lang", "EN") + req.cj.setCookie(".unrestrict.li", "lang", "EN") html = req.load("https://unrestrict.li/sign_in") if 'solvemedia' in html: diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 6cb09e44b..2d9d268c9 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -51,7 +51,7 @@ class UploadedTo(Account): def login(self, user, data, req): - req.cj.setCookie("uploaded.net", "lang", "en") + req.cj.setCookie(".uploaded.net", "lang", "en") page = req.load("http://uploaded.net/io/login", post={'id': user, 'pw': data['password'], '_': ""}) diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index e9e233a95..8747af133 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -40,7 +40,7 @@ class UploadingCom(Account): validuntil = mktime(strptime(expiredate, "%b %d, %Y")) except Exception, e: - self.logError(str(e)) + self.logError(e) else: if validuntil > mktime(gmtime()): @@ -53,10 +53,10 @@ class UploadingCom(Account): def login(self, user, data, req): - set_cookies([("uploading.com", "lang", "1"), - ("uploading.com", "language", "1"), - ("uploading.com", "setlang", "en"), - ("uploading.com", "_lang", "en")] + set_cookies([(".uploading.com", "lang", "1"), + (".uploading.com", "language", "1"), + (".uploading.com", "setlang", "en"), + (".uploading.com", "_lang", "en")] req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 01f9ef692..dbec6984d 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -43,14 +43,14 @@ class ZeveraCom(Account): } get_data.update(kwargs) - response = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, + res = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, decode=True, just_header=just_header) - self.logDebug(response) + self.logDebug(res) - if ':' in response: + if ':' in res: if not just_header: - response = response.replace(',', '\n') + res = res.replace(',', '\n') return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in response.splitlines() if ':' in x]) + [x.split(':', 1) for x in res.splitlines() if ':' in x]) else: - return response + return res |