diff options
Diffstat (limited to 'module/plugins')
63 files changed, 392 insertions, 365 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index b2010019b..4ac62e602 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -73,7 +73,7 @@ class AccountManager(): return except IOError, e: - self.logError(str(e)) + self.logError(e) return plugin = "" @@ -123,7 +123,7 @@ class AccountManager(): chmod(f.name, 0600) except Exception, e: - self.logError(str(e)) + self.logError(e) #---------------------------------------------------------------------- diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index a8eca5003..f296533e1 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -517,7 +517,7 @@ class Plugin(Base): del frame #: delete the frame or it wont be cleaned f.write(fs_encode(res)) except IOError, e: - self.logError(str(e)) + self.logError(e) if just_header: #parse header diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py index 82702eb7f..9ef211f35 100644 --- a/module/plugins/PluginManager.py +++ b/module/plugins/PluginManager.py @@ -83,7 +83,7 @@ class PluginManager: pfolder = join(pypath, "module", "plugins", folder) except Exception, e: - self.logCritical(str(e)) + self.logCritical(e) return plugins for f in listdir(pfolder): 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 diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 418c11ffe..b67ce9b9e 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -66,7 +66,7 @@ class OCR(object): tmpTxt.close() except IOError, e: - self.logError(str(e)) + self.logError(e) return self.logger.debug("save tiff") diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 16931984b..192c5962c 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -48,7 +48,7 @@ class DevhostStFolder(SimpleCrypter): name = folder = m.group(1) except Exception, e: - self.logDebug(str(e)) + self.logDebug(e) name = folder = re.match(self.__pattern__, self.pyfile.url).group('USER') return {'name': name, 'folder': folder} diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 5bd20711e..07cc5cdc4 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -37,11 +37,11 @@ class DuckCryptInfo(Crypter): def handleFolder(self, m): - src = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2))) - m = re.match(self.__pattern__, src) + html = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2))) + m = re.match(self.__pattern__, html) self.logDebug("Redirectet to " + str(m.group(0))) - src = self.load(str(m.group(0))) - soup = BeautifulSoup(src) + html = self.load(str(m.group(0))) + soup = BeautifulSoup(html) cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) self.logDebug("Redirectet to " + str(cryptlinks)) if not cryptlinks: @@ -52,8 +52,8 @@ class DuckCryptInfo(Crypter): def handleLink(self, url): - src = self.load(url) - soup = BeautifulSoup(src) + html = self.load(url) + soup = BeautifulSoup(html) self.urls = [soup.find("iframe")['src']] if not self.urls: self.logInfo(_("No link found")) diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index ab4e76092..92e9620f6 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -21,7 +21,7 @@ class FilefactoryComFolder(SimpleCrypter): NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+)</span></h1>' PAGES_PATTERN = r'data-paginator-totalPages="(\d+)"' - COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')] + COOKIES = [(".filefactory.com", "locale", "en_US.utf8")] def loadPage(self, page_n): diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index ed4adef58..4d4b8fbef 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -30,8 +30,8 @@ class HoerbuchIn(Crypter): self.pyfile = pyfile if self.article.match(pyfile.url): - src = self.load(pyfile.url) - soup = BeautifulSoup(src, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) + html = self.load(pyfile.url) + soup = BeautifulSoup(html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) abookname = soup.find("a", attrs={"rel": "bookmark"}).text for a in soup.findAll("a", attrs={"href": self.protection}): @@ -50,11 +50,11 @@ class HoerbuchIn(Crypter): url = m.group(0) self.pyfile.url = url - src = self.load(url, post={"viewed": "adpg"}) + html = self.load(url, post={"viewed": "adpg"}) links = [] pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") - for hoster, lid in pattern.findall(src): + for hoster, lid in pattern.findall(html): self.req.lastURL = url self.load("http://www.hoerbuch.in/protection/%s/%s" % (hoster, lid)) links.append(self.req.lastEffectiveURL) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 23a8a6512..67b1a3f02 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -216,12 +216,12 @@ class LinkCryptWs(Crypter): try: self.logDebug("Decrypting Web link %d, %s" % (idx + 1, weblink_id)) - response = self.load("http://linkcrypt.ws/out.html", post = {'file':weblink_id}) + res = self.load("http://linkcrypt.ws/out.html", post = {'file':weblink_id}) - indexs = response.find("window.location =") + 19 - indexe = response.find('"', indexs) + indexs = res.find("window.location =") + 19 + indexe = res.find('"', indexs) - link2= response[indexs:indexe] + link2 = res[indexs:indexe] self.logDebug(link2) diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 72ce32810..7015f2ed3 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -155,18 +155,25 @@ class LinkSaveIn(SimpleCrypter): for i, weblink_id in enumerate(ids): try: webLink = "http://linksave.in/%s" % weblink_id + self.logDebug("Decrypting Web link %d, %s" % (i + 1, webLink)) + fwLink = "http://linksave.in/fw-%s" % weblink_id - response = self.load(fwLink) - jscode = re.findall(r'<script type="text/javascript">(.*)</script>', response)[-1] + res = self.load(fwLink) + + jscode = re.findall(r'<script type="text/javascript">(.*)</script>', res)[-1] jseval = self.js.eval("document = { write: function(e) { return e; } }; %s" % jscode) dlLink = re.search(r'http://linksave\.in/dl-\w+', jseval).group(0) self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) - response = self.load(dlLink) - link = unescape(re.search(r'<iframe src="(.+?)"', response).group(1)) + + res = self.load(dlLink) + link = unescape(re.search(r'<iframe src="(.+?)"', res).group(1)) + package_links.append(link) + except Exception, detail: self.logDebug("Error decrypting Web link %s, %s" % (webLink, detail)) + return package_links diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 26d05fee1..d2e8138f6 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -192,17 +192,22 @@ class ShareLinksBiz(Crypter): for i, ID in enumerate(ids): try: self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, ID)) + dwLink = self.baseUrl + "/get/lnk/" + ID - response = self.load(dwLink) - code = re.search(r'frm/(\d+)', response).group(1) + res = self.load(dwLink) + + code = re.search(r'frm/(\d+)', res).group(1) fwLink = self.baseUrl + "/get/frm/" + code - response = self.load(fwLink) - jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', response, - re.S).group(1) + res = self.load(fwLink) + + jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', res, re.S).group(1) jscode = self.js.eval("f = %s" % jscode) jslauncher = "window=''; parent={frames:{Main:{location:{href:''}}},location:''}; %s; parent.frames.Main.location.href" + dlLink = self.js.eval(jslauncher % jscode) + self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) + package_links.append(dlLink) except Exception, detail: self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail)) @@ -237,10 +242,10 @@ class ShareLinksBiz(Crypter): def _getCipherParams(self): # Request CNL2 - code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) - url = "%s/get/cnl2/%s" % (self.baseUrl, code) - response = self.load(url) - params = response.split(";;") + code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) + url = "%s/get/cnl2/%s" % (self.baseUrl, code) + res = self.load(url) + params = res.split(";;") # Get jk strlist = list(base64.standard_b64decode(params[1])) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index b8b55ac63..7e1ea6424 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -53,9 +53,9 @@ class BypassCaptcha(Hook): def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) return int(data['Left']) @@ -66,18 +66,18 @@ class BypassCaptcha(Hook): req.c.setopt(LOW_SPEED_TIME, 80) try: - response = req.load(self.SUBMIT_URL, - post={"vendor_key": self.PYLOAD_KEY, - "key": self.getConfig("passkey"), - "gen_task_id": "1", - "file": (FORM_FILE, captcha)}, - multipart=True) + res = req.load(self.SUBMIT_URL, + post={'vendor_key': self.PYLOAD_KEY, + 'key': self.getConfig("passkey"), + 'gen_task_id': "1", + 'file': (FORM_FILE, captcha)}, + multipart=True) finally: req.close() - data = dict([x.split(' ', 1) for x in response.splitlines()]) + data = dict([x.split(' ', 1) for x in res.splitlines()]) if not data or "Value" not in data: - raise BypassCaptchaException(response) + raise BypassCaptchaException(res) result = data['Value'] ticket = data['TaskId'] @@ -88,10 +88,10 @@ class BypassCaptcha(Hook): def respond(self, ticket, success): try: - response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), + res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), "cv": 1 if success else 0}) except BadHeader, e: - self.logError(_("Could not send response"), str(e)) + self.logError(_("Could not send response"), e) def newCaptchaTask(self, task): diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index e831d977c..c8f034847 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -64,7 +64,7 @@ class Captcha9kw(Hook): with open(task.captchaFile, 'rb') as f: data = f.read() except IOError, e: - self.logError(str(e)) + self.logError(e) return data = b64encode(data) diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index eb0bd9e67..2ebeb1734 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -59,12 +59,12 @@ class CaptchaBrotherhood(Hook): def getCredits(self): - response = getURL(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response) + res = getURL(self.API_URL + "askCredits.aspx", + get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res) else: - credits = int(response[3:]) + credits = int(res[3:]) self.logInfo(_("%d credits left") % credits) self.info['credits'] = credits return credits @@ -101,35 +101,35 @@ class CaptchaBrotherhood(Hook): try: req.c.perform() - response = req.getResponse() + res = req.getResponse() except Exception, e: raise CaptchaBrotherhoodException("Submit captcha image failed") req.close() - if not response.startswith("OK"): - raise CaptchaBrotherhoodException(response[1]) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException(res[1]) - ticket = response[3:] + ticket = res[3:] for _i in xrange(15): sleep(5) - response = self.get_api("askCaptchaResult", ticket) - if response.startswith("OK-answered"): - return ticket, response[12:] + res = self.get_api("askCaptchaResult", ticket) + if res.startswith("OK-answered"): + return ticket, res[12:] raise CaptchaBrotherhoodException("No solution received in time") def get_api(self, api, ticket): - response = getURL("%s%s.aspx" % (self.API_URL, api), + res = getURL("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig("username"), "password": self.getConfig("passkey"), "captchaID": ticket}) - if not response.startswith("OK"): - raise CaptchaBrotherhoodException("Unknown response: %s" % response) + if not res.startswith("OK"): + raise CaptchaBrotherhoodException("Unknown response: %s" % res) - return response + return res def newCaptchaTask(self, task): @@ -156,7 +156,7 @@ class CaptchaBrotherhood(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = self.get_api("complainCaptcha", task.data['ticket']) + res = self.get_api("complainCaptcha", task.data['ticket']) def processCaptcha(self, task): diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 42495f5fb..df09769ce 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -81,18 +81,18 @@ class DeathByCaptcha(Hook): post.update({"username": self.getConfig("username"), "password": self.getConfig("passkey")}) - response = None + res = None try: json = req.load("%s%s" % (self.API_URL, api), post=post, multipart=multipart) self.logDebug(json) - response = json_loads(json) + res = json_loads(json) - if "error" in response: - raise DeathByCaptchaException(response['error']) - elif "status" not in response: - raise DeathByCaptchaException(str(response)) + if "error" in res: + raise DeathByCaptchaException(res['error']) + elif "status" not in res: + raise DeathByCaptchaException(str(res)) except BadHeader, e: if 403 == e.code: @@ -109,24 +109,24 @@ class DeathByCaptcha(Hook): finally: req.close() - return response + return res def getCredits(self): - response = self.call_api("user", True) + res = self.call_api("user", True) - if 'is_banned' in response and response['is_banned']: + if 'is_banned' in res and res['is_banned']: raise DeathByCaptchaException('banned') - elif 'balance' in response and 'rate' in response: - self.info.update(response) + elif 'balance' in res and 'rate' in res: + self.info.update(res) else: - raise DeathByCaptchaException(response) + raise DeathByCaptchaException(res) def getStatus(self): - response = self.call_api("status", False) + res = self.call_api("status", False) - if 'is_service_overloaded' in response and response['is_service_overloaded']: + if 'is_service_overloaded' in res and res['is_service_overloaded']: raise DeathByCaptchaException('service-overload') @@ -141,21 +141,21 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - response = self.call_api("captcha", {"captchafile": data}, multipart) + res = self.call_api("captcha", {"captchafile": data}, multipart) - if "captcha" not in response: - raise DeathByCaptchaException(response) - ticket = response['captcha'] + if "captcha" not in res: + raise DeathByCaptchaException(res) + ticket = res['captcha'] for _i in xrange(24): sleep(5) - response = self.call_api("captcha/%d" % ticket, False) - if response['text'] and response['is_correct']: + res = self.call_api("captcha/%d" % ticket, False) + if res['text'] and res['is_correct']: break else: raise DeathByCaptchaException('timed-out') - result = response['text'] + result = res['text'] self.logDebug("Result %s : %s" % (ticket, result)) return ticket, result @@ -196,9 +196,11 @@ class DeathByCaptcha(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - response = self.call_api("captcha/%d/report" % task.data['ticket'], True) + res = self.call_api("captcha/%d/report" % task.data['ticket'], True) + except DeathByCaptchaException, e: self.logError(e.getDesc()) + except Exception, e: self.logError(e) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index faaba6906..1b9459eb6 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -34,14 +34,14 @@ class ExpertDecoders(Hook): def getCredits(self): - response = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) + res = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) - if response.isdigit(): - self.logInfo(_("%s credits left") % response) - self.info['credits'] = credits = int(response) + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + self.info['credits'] = credits = int(res) return credits else: - self.logError(response) + self.logError(res) return 0 @@ -90,9 +90,9 @@ class ExpertDecoders(Hook): if "ticket" in task.data: try: - response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"), - "gen_task_id": task.data['ticket']}) - self.logInfo(_("Request refund"), response) + res = getURL(self.API_URL, + post={'action': "refund", 'key': self.getConfig("passkey"), 'gen_task_id': task.data['ticket']}) + self.logInfo(_("Request refund", res) except BadHeader, e: - self.logError(_("Could not send refund request"), str(e)) + self.logError(_("Could not send refund request"), e) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f5f30fc52..11c44a6d1 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -98,12 +98,12 @@ class ExtractArchive(Hook): if e.errno == 2: self.logInfo(_("No %s installed") % p) else: - self.logWarning(_("Could not activate %s") % p, str(e)) + self.logWarning(_("Could not activate %s") % p, e) if self.core.debug: print_exc() except Exception, e: - self.logWarning(_("Could not activate %s") % p, str(e)) + self.logWarning(_("Could not activate %s") % p, e) if self.core.debug: print_exc() @@ -202,7 +202,7 @@ class ExtractArchive(Hook): password = p.password.strip().splitlines() new_files = self._extract(klass, fid, password, thread) except Exception, e: - self.logError(basename(target), str(e)) + self.logError(basename(target), e) success = False continue @@ -289,13 +289,13 @@ class ExtractArchive(Hook): return extracted_files except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), str(e)) + self.logError(basename(plugin.file), _("Archive Error"), e) except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) except Exception, e: if self.core.debug: print_exc() - self.logError(basename(plugin.file), _("Unknown Error"), str(e)) + self.logError(basename(plugin.file), _("Unknown Error"), e) self.manager.dispatchEvent("archive_extract_failed", pyfile) raise Exception(_("Extract failed")) @@ -317,7 +317,7 @@ class ExtractArchive(Hook): passwords.append(pw) except IOError, e: - self.logError(str(e)) + self.logError(e) else: self.passwords = passwords @@ -338,7 +338,7 @@ class ExtractArchive(Hook): for pw in self.passwords: f.write(pw + "\n") except IOError, e: - self.logError(str(e)) + self.logError(e) def setPermissions(self, files): @@ -357,4 +357,4 @@ class ExtractArchive(Hook): gid = getgrnam(self.config['permission']['group'])[2] chown(f, uid, gid) except Exception, e: - self.logWarning(_("Setting User and Group failed"), str(e)) + self.logWarning(_("Setting User and Group failed"), e) diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index 15a8f43d5..518bbac2b 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -61,4 +61,4 @@ class HotFolder(Hook): self.core.api.addPackage(f, [newpath], 1) except IOError, e: - self.logError(str(e)) + self.logError(e) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 4d0cd1619..98edc2f7f 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -187,7 +187,7 @@ class IRCInterface(Thread, Hook): for line in res: self.response(line, msg['origin']) except Exception, e: - self.logError(str(e)) + self.logError(e) def response(self, msg, origin=""): diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 8d253c249..b00c5118f 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -55,18 +55,20 @@ class ImageTyperz(Hook): def getCredits(self): - response = getURL(self.GETCREDITS_URL, post={"action": "REQUESTBALANCE", "username": self.getConfig("username"), - "password": self.getConfig("passkey")}) + res = getURL(self.GETCREDITS_URL, + post={'action': "REQUESTBALANCE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey")}) - if response.startswith('ERROR'): - raise ImageTyperzException(response) + if res.startswith('ERROR'): + raise ImageTyperzException(res) try: - balance = float(response) + balance = float(res) except: - raise ImageTyperzException("invalid response") + raise ImageTyperzException("Invalid response") - self.logInfo(_("Account balance: $%s left") % response) + self.logInfo(_("Account balance: $%s left") % res) return balance @@ -86,21 +88,22 @@ class ImageTyperz(Hook): data = f.read() data = b64encode(data) - response = req.load(self.SUBMIT_URL, post={"action": "UPLOADCAPTCHA", - "username": self.getConfig("username"), - "password": self.getConfig("passkey"), "file": data}, - multipart=multipart) + res = req.load(self.SUBMIT_URL, + post={'action': "UPLOADCAPTCHA", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), "file": data}, + multipart=multipart) finally: req.close() - if response.startswith("ERROR"): - raise ImageTyperzException(response) + if res.startswith("ERROR"): + raise ImageTyperzException(res) else: - data = response.split('|') + data = res.split('|') if len(data) == 2: ticket, result = data else: - raise ImageTyperzException("Unknown response %s" % response) + raise ImageTyperzException("Unknown response: %s" % res) return ticket, result @@ -130,14 +133,16 @@ class ImageTyperz(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - response = getURL(self.RESPOND_URL, post={"action": "SETBADIMAGE", "username": self.getConfig("username"), - "password": self.getConfig("passkey"), - "imageid": task.data['ticket']}) + res = getURL(self.RESPOND_URL, + post={'action': "SETBADIMAGE", + 'username': self.getConfig("username"), + 'password': self.getConfig("passkey"), + 'imageid': task.data['ticket']}) - if response == "SUCCESS": + if res == "SUCCESS": self.logInfo(_("Bad captcha solution received, requested refund")) else: - self.logError(_("Bad captcha solution received, refund request failed"), response) + self.logError(_("Bad captcha solution received, refund request failed"), res) def processCaptcha(self, task): diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index 6194f67f1..0c5f6e754 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -21,7 +21,7 @@ class LinkdecrypterCom(Hook): try: self.loadPatterns() except Exception, e: - self.logError(str(e)) + self.logError(e) def loadPatterns(self): diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 94c7dbff7..01591354d 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -28,9 +28,9 @@ class RPNetBiz(MultiHoster): # Get account data (user, data) = self.account.selectAccount() - response = getURL("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], "action": "showHosterList"}) - hoster_list = json_loads(response) + res = getURL("https://premium.rpnet.biz/client_api.php", + get={"username": user, "password": data['password'], "action": "showHosterList"}) + hoster_list = json_loads(res) # If account is not valid thera are no hosters available if 'error' in hoster_list: diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index e23398023..bbeab4341 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -168,7 +168,7 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.logError(str(e)) + self.logError(e) return messages diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 06a2c4fc6..24c86f5be 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -41,18 +41,18 @@ class BayfilesCom(SimpleHoster): self.error(_("VARS_PATTERN not found")) vfid, delay = m.groups() - response = json_loads(self.load('http://bayfiles.com/ajax_download', get={ - "_": time() * 1000, - "action": "startTimer", - "vfid": vfid}, decode=True)) + res = json_loads(self.load('http://bayfiles.com/ajax_download', + get={"_": time() * 1000, + "action": "startTimer", + "vfid": vfid}, decode=True)) - if not "token" in response or not response['token']: + if not "token" in res or not res['token']: self.fail(_("No token")) self.wait(int(delay)) self.html = self.load('http://bayfiles.com/ajax_download', get={ - "token": response['token'], + "token": res['token'], "action": "getLink", "vfid": vfid}) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b2fe2c48a..35aff7c1e 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -90,10 +90,10 @@ class BitshareCom(SimpleHoster): # Get download info self.logDebug("Getting download info") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "generateID", "ajaxid": self.ajaxid}) - self.handleErrors(response, ':') - parts = response.split(":") + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "generateID", "ajaxid": self.ajaxid}) + self.handleErrors(res, ':') + parts = res.split(":") filetype = parts[0] wait = int(parts[1]) captcha = int(parts[2]) @@ -116,37 +116,37 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): challenge, code = recaptcha.challenge() - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "validateCaptcha", "ajaxid": self.ajaxid, "recaptcha_challenge_field": challenge, "recaptcha_response_field": code}) - if self.handleCaptchaErrors(response): + if self.handleCaptchaErrors(res): break # Get download URL self.logDebug("Getting download url") - response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) - self.handleErrors(response, '#') - url = response.split("#")[-1] + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + self.handleErrors(res, '#') + url = res.split("#")[-1] return url - def handleErrors(self, response, separator): - self.logDebug("Checking response [%s]" % response) - if "ERROR:Session timed out" in response: + def handleErrors(self, res, separator): + self.logDebug("Checking response [%s]" % res) + if "ERROR:Session timed out" in res: self.retry() - elif "ERROR" in response: - msg = response.split(separator)[-1] + elif "ERROR" in res: + msg = res.split(separator)[-1] self.fail(msg) - def handleCaptchaErrors(self, response): - self.logDebug("Result of captcha resolving [%s]" % response) - if "SUCCESS" in response: + def handleCaptchaErrors(self, res): + self.logDebug("Result of captcha resolving [%s]" % res) + if "SUCCESS" in res: self.correctCaptcha() return True - elif "ERROR:SESSION ERROR" in response: + elif "ERROR:SESSION ERROR" in res: self.retry() self.invalidCaptcha() diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 76efda3b9..72f1bb45d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -58,7 +58,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError(str(e)) + self.logError(e) return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster): form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError(str(e)) + self.logError(e) self.resetAccount() # download the file, destination is determined by pyLoad diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 1cfddd64d..fc38a79a9 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -52,8 +52,8 @@ class ExtabitCom(SimpleHoster): for _i in xrange(5): get_data = {"type": "recaptcha"} 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: + res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + if "ok" in res: self.correctCaptcha() break else: @@ -63,10 +63,10 @@ class ExtabitCom(SimpleHoster): else: self.error(_("Captcha")) - if not "href" in response: + if not "href" in res: self.error(_("Bad JSON response")) - self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) + self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) m = re.search(self.LINK_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index f31be155d..819a7faf3 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -64,26 +64,26 @@ class FilecloudIo(SimpleHoster): self.retry(2) json_url = "http://filecloud.io/download-request.json" - response = self.load(json_url, post=data) - self.logDebug(response) - response = json_loads(response) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "error" in response and response['error']: - self.fail(response) + if "error" in res and res['error']: + self.fail(res) - self.logDebug(response) - if response['captcha']: + self.logDebug(res) + if res['captcha']: data['ctype'] = "recaptcha" for _i in xrange(5): 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) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "retry" in response and response['retry']: + if "retry" in res and res['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -91,7 +91,7 @@ class FilecloudIo(SimpleHoster): else: self.fail(_("Incorrect captcha")) - if response['dl']: + if res['dl']: self.html = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index fda67a554..92ff5a02a 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -11,15 +11,15 @@ def getInfo(urls): result = [] for chunk in chunks(urls, 10): for url in chunk: - src = getURL(url) - if r'<div class="errorMessage mb10">' in src: + html = getURL(url) + if r'<div class="errorMessage mb10">' in html: result.append((url, 0, 1, url)) - elif r'Page cannot be displayed' in src: + elif r'Page cannot be displayed' in html: result.append((url, 0, 1, url)) else: try: url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0] + file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0] result.append((file_name, 0, 2, url)) except: pass diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 9707090a4..2266e49b0 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -108,9 +108,9 @@ class FileserveCom(Hoster): self.error(_("Unknown server response")) # show download link - response = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("Show downloadLink response : %s" % response) - if "fail" in response: + res = self.load(self.url, post={"downloadLink": "show"}, decode=True) + self.logDebug("Show downloadLink response: %s" % res) + if "fail" in res: self.error(_("Couldn't retrieve download url")) # this may either download our file or forward us to an error page @@ -136,19 +136,19 @@ class FileserveCom(Hoster): def doTimmer(self): - response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("Wait response : %s" % response[:80]) + res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) + self.logDebug("Wait response: %s" % res[:80]) - if "fail" in response: + if "fail" in res: self.fail(_("Failed getting wait time")) if self.__name__ == "FilejungleCom": - m = re.search(r'"waitTime":(\d+)', response) + m = re.search(r'"waitTime":(\d+)', res) if m is None: self.fail(_("Cannot get wait time")) wait_time = int(m.group(1)) else: - wait_time = int(response) + 3 + wait_time = int(res) + 3 self.setWait(wait_time) self.wait() @@ -160,11 +160,11 @@ class FileserveCom(Hoster): for _i in xrange(5): challenge, code = recaptcha.challenge(captcha_key) - response = json_loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': code, - 'recaptcha_shortencode_field': self.file_id})) - if not response['success']: + res = json_loads(self.load(self.URLS[2], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': code, + 'recaptcha_shortencode_field': self.file_id})) + if not res['success']: self.invalidCaptcha() else: self.correctCaptcha() @@ -184,23 +184,23 @@ class FileserveCom(Hoster): premium_url = None if self.__name__ == "FileserveCom": #try api download - response = self.load("http://app.fileserve.com/api/download/premium/", - post={"username": self.user, - "password": self.account.getAccountData(self.user)['password'], - "shorten": self.file_id}, - decode=True) - if response: - response = json_loads(response) - if response['error_code'] == "302": - premium_url = response['next'] - elif response['error_code'] in ["305", "500"]: + res = self.load("http://app.fileserve.com/api/download/premium/", + post={"username": self.user, + "password": self.account.getAccountData(self.user)['password'], + "shorten": self.file_id}, + decode=True) + if res: + res = json_loads(res) + if res['error_code'] == "302": + premium_url = res['next'] + elif res['error_code'] in ["305", "500"]: self.tempOffline() - elif response['error_code'] in ["403", "605"]: + elif res['error_code'] in ["403", "605"]: self.resetAccount() - elif response['error_code'] in ["606", "607", "608"]: + elif res['error_code'] in ["606", "607", "608"]: self.offline() else: - self.logError(response['error_code'], response['error_message']) + self.logError(res['error_code'], res['error_message']) self.download(premium_url or self.pyfile.url) diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index fc082f66c..e1fcdab26 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -49,8 +49,8 @@ class FourSharedCom(SimpleHoster): try: m = re.search(self.FID_PATTERN, self.html) - response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) - self.logDebug(response) + res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) + self.logDebug(res) except: pass diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 5b8ed1ab8..9f79d80b5 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -53,14 +53,14 @@ class Ftp(Hoster): self.req.http.c.setopt(pycurl.NOBODY, 1) try: - response = self.load(pyfile.url) + res = self.load(pyfile.url) except pycurl.error, e: self.fail(_("Error %d: %s") % e.args) self.req.http.c.setopt(pycurl.NOBODY, 0) self.logDebug(self.req.http.header) - m = re.search(r"Content-Length:\s*(\d+)", response) + m = re.search(r"Content-Length:\s*(\d+)", res) if m: pyfile.size = int(m.group(1)) self.download(pyfile.url) @@ -71,8 +71,8 @@ class Ftp(Hoster): pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]) pyfile.url += '/' self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY - response = self.load(pyfile.url, decode=False) - links = [pyfile.url + quote(x) for x in response.splitlines()] + res = self.load(pyfile.url, decode=False) + links = [pyfile.url + quote(x) for x in res.splitlines()] self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index aacd74f7a..a1a812de4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -86,31 +86,32 @@ class LetitbitNet(SimpleHoster): self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds) - response = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) - if response != '1': + res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) + if res != '1': self.error(_("Unknown response - ajax_check_url")) - self.logDebug(response) + self.logDebug(res) recaptcha = ReCaptcha(self) challenge, response = recaptcha.challenge() - post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, + post_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) - self.logDebug(response) - if not response: + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + self.logDebug(res) + if not res: self.invalidCaptcha() - if response == "error_free_download_blocked": + if res == "error_free_download_blocked": self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) - if response == "error_wrong_captcha": + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() - elif response.startswith('['): - urls = json_loads(response) - elif response.startswith('http://'): - urls = [response] + elif res.startswith('['): + urls = json_loads(res) + elif res.startswith('http://'): + urls = [res] else: self.error(_("Unknown response - captcha check")) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index b9e4d38c5..4d1e1bcb7 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -57,10 +57,10 @@ class MegaDebridEu(Hoster): user, data = self.account.selectAccount() jsonResponse = self.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": - self.token = response['token'] + if res['response_code'] == "ok": + self.token = res['token'] return True else: return False @@ -73,10 +73,10 @@ class MegaDebridEu(Hoster): """ jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token}, post={"link": linkToDebrid}) - response = json_loads(jsonResponse) + res = json_loads(jsonResponse) - if response['response_code'] == "ok": - debridedLink = response['debridLink'][1:-1] + if res['response_code'] == "ok": + debridedLink = res['debridLink'][1:-1] return debridedLink else: self.exitOnFail("Unable to debrid %s" % linkToDebrid) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 486ff2b37..6b1472dd8 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -63,9 +63,9 @@ class MegasharesCom(SimpleHoster): "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))) self.logDebug(url) - response = self.load(url) + res = self.load(url) - if 'Thank you for reactivating your passport.' in response: + if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() self.retry() else: diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index bfa1cc932..549ecb667 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -110,18 +110,18 @@ class NetloadIn(Hoster): return apiurl = "http://api.netload.in/info.php" - src = self.load(apiurl, cookies=False, + html = self.load(apiurl, cookies=False, get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() - if not src and n <= 3: + if not html and n <= 3: sleep(0.2) self.download_api_data(n + 1) return - self.logDebug("APIDATA: " + src) + self.logDebug("APIDATA: " + html) 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(";") + if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): + lines = html.split(";") self.api_data['exists'] = True self.api_data['fileid'] = lines[0] self.api_data['filename'] = lines[1] diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index f179db13a..c1e536d39 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -35,12 +35,14 @@ class RPNetBiz(Hoster): self.logDebug("Original URL: %s" % pyfile.url) # Get the download link - response = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], - "action": "generate", "links": pyfile.url}) + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "generate", + "links": pyfile.url}) - self.logDebug("JSON data: %s" % response) - link_status = json_loads(response)['links'][0] # get the first link... since we only queried one + self.logDebug("JSON data: %s" % res) + link_status = json_loads(res)['links'][0] # get the first link... since we only queried one # Check if we only have an id as a HDD link if 'id' in link_status: @@ -53,11 +55,13 @@ class RPNetBiz(Hoster): my_try = 0 while (my_try <= max_tries): self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) - response = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": data['password'], - "action": "downloadInformation", "id": link_status['id']}) - self.logDebug("JSON data hdd query: %s" % response) - download_status = json_loads(response)['download'] + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "downloadInformation", + "id": link_status['id']}) + self.logDebug("JSON data hdd query: %s" % res) + download_status = json_loads(res)['download'] if download_status['status'] == '100': link_status['generated'] = download_status['rpnet_link'] diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 61141416a..11d318333 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -67,7 +67,7 @@ class RapidgatorNet(SimpleHoster): msg = json['response_details'] except BadHeader, e: - self.logError("API: %s" % cmd, str(e), "SID: %s" % self.sid) + self.logError("API: %s" % cmd, e, "SID: %s" % self.sid) status = e.code msg = e @@ -189,11 +189,11 @@ class RapidgatorNet(SimpleHoster): def getJsonResponse(self, url): - response = self.load(url, decode=True) - if not response.startswith('{'): + res = self.load(url, decode=True) + if not res.startswith('{'): self.retry() - self.logDebug(url, response) - return json_loads(response) + self.logDebug(url, res) + return json_loads(res) getInfo = create_getInfo(RapidgatorNet) diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 2a81108cd..4ec5af67a 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -144,11 +144,11 @@ class RapidshareCom(Hoster): return api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name} - src = self.load(api_url_base, cookies=False, get=api_param_file).strip() - self.logDebug("RS INFO API: %s" % src) - if src.startswith("ERROR"): + html = self.load(api_url_base, cookies=False, get=api_param_file).strip() + self.logDebug("RS INFO API: %s" % html) + if html.startswith("ERROR"): return - fields = src.split(",") + fields = html.split(",") # status codes: # 0=File not found diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 2f4b04ce2..78a27558b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -18,9 +18,9 @@ def getInfo(urls): for chunk in chunks(urls, 90): api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in chunk)} # api only supports old style links - src = getURL(api_url_base, post=api_param_file, decode=True) + html = getURL(api_url_base, post=api_param_file, decode=True) result = [] - for i, res in enumerate(src.split("\n")): + for i, res in enumerate(html.split("\n")): if not res: continue fields = res.split(";") @@ -77,9 +77,9 @@ class ShareonlineBiz(Hoster): def loadAPIData(self): api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1" api_param_file = {"links": self.file_id} #: api only supports old style links - src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) + html = self.load(api_url_base, cookies=False, post=api_param_file, decode=True) - fields = src.split(";") + fields = html.split(";") self.api_data = {"fileid": fields[0], "status": fields[1]} if not self.api_data['status'] == "OK": @@ -108,12 +108,12 @@ class ShareonlineBiz(Hoster): for _i in xrange(5): challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX") self.setWait(int(m.group(1)) if m else 30) - response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={ - 'dl_free': '1', - 'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response}) + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), + post={'dl_free': '1', + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response}) - if not response == '0': + if not res == '0': self.correctCaptcha() break else: @@ -122,7 +122,7 @@ class ShareonlineBiz(Hoster): self.invalidCaptcha() self.fail(_("No valid captcha solution received")) - download_url = response.decode("base64") + download_url = res.decode("base64") if not download_url.startswith("http://"): self.error(_("Wrong download url")) @@ -145,12 +145,12 @@ 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", + html = self.load("http://api.share-online.biz/account.php", {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.file_id}) self.api_data = dlinfo = {} - for line in src.splitlines(): + for line in html.splitlines(): key, value = line.split(": ") dlinfo[key.lower()] = value diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index be9b2bc00..5510326d1 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -70,18 +70,19 @@ class UploadingCom(SimpleHoster): self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = self.pyfile.url - response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) - if 'answer' in response and 'wait_time' in response['answer']: - wait_time = int(response['answer']['wait_time']) + res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['ID']})) + + if 'answer' in res and 'wait_time' in res['answer']: + wait_time = int(res['answer']['wait_time']) self.logInfo(_("Waiting %d seconds") % wait_time) self.wait(wait_time) else: self.error(_("No AJAX/WAIT")) - response = json_loads( - self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) - if 'answer' in response and 'link' in response['answer']: - url = response['answer']['link'] + res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['ID'], 'pass': 'false'})) + + if 'answer' in res and 'link' in res['answer']: + url = res['answer']['link'] else: self.error(_("No AJAX/URL")) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index bed1d71ad..3b4692933 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -32,11 +32,11 @@ class YibaishiwuCom(SimpleHoster): url = m.group(1) self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) - response = json_loads(self.load("http://115.com" + url, decode=False)) - if "urls" in response: - mirrors = response['urls'] - elif "data" in response: - mirrors = response['data'] + res = json_loads(self.load("http://115.com" + url, decode=False)) + if "urls" in res: + mirrors = res['urls'] + elif "data" in res: + mirrors = res['data'] else: mirrors = None diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 8a2242018..ba2c00ec9 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -49,9 +49,9 @@ class XFSAccount(Account): def loadAccountInfo(self, user, req): - validuntil = None + validuntil = None trafficleft = None - premium = None + premium = None html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) @@ -64,8 +64,10 @@ class XFSAccount(Account): try: validuntil = mktime(strptime(expiredate, "%d %B %Y")) + except Exception, e: - self.logError(str(e)) + self.logError(e) + else: if validuntil > mktime(gmtime()): premium = True @@ -94,7 +96,7 @@ class XFSAccount(Account): trafficleft = self.parseTraffic(size + unit) except Exception, e: - self.logError(str(e)) + self.logError(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} |