diff options
Diffstat (limited to 'module/plugins/accounts')
96 files changed, 1291 insertions, 1017 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index f9c1f2ca6..6a2f09c9c 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -4,60 +4,63 @@ import re import time import xml.dom.minidom as dom -from BeautifulSoup import BeautifulSoup +import BeautifulSoup -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class AlldebridCom(Account): __name__ = "AlldebridCom" __type__ = "account" - __version__ = "0.23" + __version__ = "0.26" + __status__ = "testing" __description__ = """AllDebrid.com account plugin""" __license__ = "GPLv3" __authors__ = [("Andy Voigt", "spamsales@online.de")] - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - html = req.load("http://www.alldebrid.com/account/") - soup = BeautifulSoup(html) + def parse_info(self, user, password, data, req): + data = self.get_data(user) + html = self.load("http://www.alldebrid.com/account/") + soup = BeautifulSoup.BeautifulSoup(html) - #Try to parse expiration date directly from the control panel page (better accuracy) + #: Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string - self.logDebug("Account expires in: %s" % time_text) + self.log_debug("Account expires in: %s" % time_text) p = re.compile('\d+') exp_data = p.findall(time_text) exp_time = time.time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 - #Get expiration date from API + #: Get expiration date from API except Exception: - data = self.getAccountData(user) - html = req.load("http://www.alldebrid.com/api.php", - get={'action': "info_user", 'login': user, 'pw': data['password']}) + data = self.get_data(user) + html = self.load("https://www.alldebrid.com/api.php", + get={'action': "info_user", + 'login' : user, + 'pw' : password}) - self.logDebug(html) + self.log_debug(html) xml = dom.parseString(html) exp_time = time.time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 - account_info = {"validuntil": exp_time, "trafficleft": -1} - return account_info + return {'validuntil' : exp_time, + 'trafficleft': -1 , + 'premium' : True } - def login(self, user, data, req): - html = req.load("http://www.alldebrid.com/register/", - get={'action' : "login", - 'login_login' : user, - 'login_password': data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://www.alldebrid.com/register/", + get={'action' : "login", + 'login_login' : user, + 'login_password': password}) if "This login doesn't exist" in html \ or "The password is not valid" in html \ or "Invalid captcha" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/AniStreamCom.py b/module/plugins/accounts/AniStreamCom.py new file mode 100644 index 000000000..53ca1d5b8 --- /dev/null +++ b/module/plugins/accounts/AniStreamCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class AniStreamCom(XFSAccount): + __name__ = "AniStreamCom" + __type__ = "account" + __version__ = "0.01" + __status__ = "testing" + + __description__ = """Ani-Stream.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "ani-stream.com" diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py index 46c8d7ac5..58939c13a 100644 --- a/module/plugins/accounts/BackinNet.py +++ b/module/plugins/accounts/BackinNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class BackinNet(XFSAccount): __name__ = "BackinNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __description__ = """Backin.net account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 00e546f6d..280f008b2 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -1,34 +1,36 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" __type__ = "account" - __version__ = "0.13" + __version__ = "0.15" + __status__ = "testing" __description__ = """Bitshare account plugin""" __license__ = "GPLv3" __authors__ = [("Paul King", None)] - def loadAccountInfo(self, user, req): - html = req.load("http://bitshare.com/mysettings.html") + def parse_info(self, user, password, data, req): + html = self.load("http://bitshare.com/mysettings.html") if "\"http://bitshare.com/myupgrade.html\">Free" in html: - return {"validuntil": -1, "trafficleft": -1, "premium": False} + return {'validuntil': -1, 'trafficleft': -1, 'premium': False} if not '<input type="checkbox" name="directdownload" checked="checked" />' in html: - self.logWarning(_("Activate direct Download in your Bitshare Account")) + self.log_warning(_("Activate direct Download in your Bitshare Account")) - return {"validuntil": -1, "trafficleft": -1, "premium": True} + return {'validuntil': -1, 'trafficleft': -1, 'premium': True} - def login(self, user, data, req): - html = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://bitshare.com/login.html", + post={'user' : user, + 'password': password, + 'submit' : "Login"}) if "login" in req.lastEffectiveURL: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index bb42f443f..92f1cb27e 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -3,15 +3,16 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.08" + __status__ = "testing" - __description__ = """CatShareNet account plugin""" + __description__ = """Catshare.net account plugin""" __license__ = "GPLv3" __authors__ = [("prOq", None)] @@ -21,19 +22,19 @@ class CatShareNet(Account): TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium = False validuntil = -1 trafficleft = -1 - html = req.load("http://catshare.net/", decode=True) + html = self.load("http://catshare.net/") if re.search(self.PREMIUM_PATTERN, html): premium = True try: expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) @@ -41,7 +42,7 @@ class CatShareNet(Account): pass try: - trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + trafficleft = self.parse_traffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) except Exception: pass @@ -49,13 +50,12 @@ class CatShareNet(Account): return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} - def login(self, user, data, req): - html = req.load("http://catshare.net/login", - post={'user_email': user, - 'user_password': data['password'], - 'remindPassword': 0, - 'user[submit]': "Login"}, - decode=True) + def login(self, user, password, data, req): + html = self.load("http://catshare.net/login", #@TODO: Revert to `https` in 0.4.10 + post={'user_email' : user, + 'user_password' : password, + 'remindPassword': 0, + 'user[submit]' : "Login"}) if not '<a href="/logout">Wyloguj</a>' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/CloudsixMe.py b/module/plugins/accounts/CloudsixMe.py new file mode 100644 index 000000000..973e37044 --- /dev/null +++ b/module/plugins/accounts/CloudsixMe.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class CloudsixMe(XFSAccount): + __name__ = "CloudsixMe" + __type__ = "account" + __version__ = "0.01" + __status__ = "testing" + + __description__ = """Cloudsix.me account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "cloudsix.me" diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index d22d5e4b3..0d473eb7d 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -2,13 +2,14 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class CloudzillaTo(Account): __name__ = "CloudzillaTo" __type__ = "account" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __description__ = """Cloudzilla.to account plugin""" __license__ = "GPLv3" @@ -18,20 +19,19 @@ class CloudzillaTo(Account): PREMIUM_PATTERN = r'<h2>account type</h2>\s*Premium Account' - def loadAccountInfo(self, user, req): - html = req.load("http://www.cloudzilla.to/") + def parse_info(self, user, password, data, req): + html = self.load("http://www.cloudzilla.to/") premium = True if re.search(self.PREMIUM_PATTERN, html) else False return {'validuntil': -1, 'trafficleft': -1, 'premium': premium} - def login(self, user, data, req): - html = req.load("http://www.cloudzilla.to/", - post={'lusername': user, - 'lpassword': data['password'], - 'w' : "dologin"}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://www.cloudzilla.to/", + post={'lusername': user, + 'lpassword': password, + 'w' : "dologin"}) if "ERROR" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index a9e2274a2..d3f2e0d77 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class CramitIn(XFSAccount): __name__ = "CramitIn" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """Cramit.in account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 300943828..e9a34cb83 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.18" + __version__ = "0.20" + __status__ = "testing" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -20,20 +21,20 @@ class CzshareCom(Account): CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([\d ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium = False validuntil = None trafficleft = None - html = req.load("http://sdilej.cz/prehled_kreditu/") + html = self.load("http://sdilej.cz/prehled_kreditu/") try: m = re.search(self.CREDIT_LEFT_PATTERN, html) - trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2) + trafficleft = self.parse_traffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2) validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M')) except Exception, e: - self.logError(e) + self.log_error(e) else: premium = True @@ -43,12 +44,11 @@ class CzshareCom(Account): 'trafficleft': trafficleft} - def login(self, user, data, req): - html = req.load('https://sdilej.cz/index.php', - post={"Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user}, - decode=True) + def login(self, user, password, data, req): + html = self.load('https://sdilej.cz/index.php', + post={'Prihlasit' : "Prihlasit", + "login-password": password, + "login-name" : user}) if '<div class="login' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 3df99101a..9c0956668 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class DebridItaliaCom(Account): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.13" + __version__ = "0.15" + __status__ = "testing" __description__ = """Debriditalia.com account plugin""" __license__ = "GPLv3" @@ -20,25 +21,25 @@ class DebridItaliaCom(Account): WALID_UNTIL_PATTERN = r'Premium valid till: (.+?) \|' - def loadAccountInfo(self, user, req): - info = {"premium": False, "validuntil": None, "trafficleft": None} - html = req.load("http://debriditalia.com/") + def parse_info(self, user, password, data, req): + info = {'premium': False, 'validuntil': None, 'trafficleft': None} + html = self.load("http://debriditalia.com/") if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: validuntil = time.mktime(time.strptime(m.group(1), "%d/%m/%Y %H:%M")) - info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} + info = {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: - self.logError(_("Unable to retrieve account information")) + self.log_error(_("Unable to retrieve account information")) return info - def login(self, user, data, req): - html = req.load("http://debriditalia.com/login.php", - get={'u': user, 'p': data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://debriditalia.com/login.php", + get={'u': user, + 'p': password}) if 'NO' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index a0bd6a37c..848529bc3 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class DepositfilesCom(Account): __name__ = "DepositfilesCom" __type__ = "account" - __version__ = "0.32" + __version__ = "0.34" + __status__ = "testing" __description__ = """Depositfiles.com account plugin""" __license__ = "GPLv3" @@ -18,19 +19,20 @@ class DepositfilesCom(Account): ("Walter Purcaro", "vuolter@gmail.com")] - def loadAccountInfo(self, user, req): - html = req.load("https://dfiles.eu/de/gold/") + def parse_info(self, user, password, data, req): + html = self.load("https://dfiles.eu/de/gold/") validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) validuntil = time.mktime(time.strptime(validuntil, "%Y-%m-%d %H:%M:%S")) - return {"validuntil": validuntil, "trafficleft": -1} + return {'validuntil': validuntil, 'trafficleft': -1} - def login(self, user, data, req): - html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://dfiles.eu/de/login.php", + get={'return': "/de/gold/payment.php"}, + post={'login' : user, + 'password': password}) if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 93d3e2c19..5e1a4f962 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -8,7 +8,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class EasybytezCom(XFSAccount): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" + __status__ = "testing" __description__ = """EasyBytez.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index db4539e2e..bc8618250 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -3,39 +3,40 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class EuroshareEu(Account): __name__ = "EuroshareEu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __description__ = """Euroshare.eu account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): self.relogin(user) - html = req.load("http://euroshare.eu/customer-zone/settings/") + html = self.load("http://euroshare.eu/customer-zone/settings/") m = re.search('id="input_expire_date" value="(\d+\.\d+\.\d+ \d+:\d+)"', html) if m is None: - premium, validuntil = False, -1 + premium = False + validuntil = -1 else: premium = True validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y %H:%M")) - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, data, req): - html = req.load('http://euroshare.eu/customer-zone/login/', - post={"trvale": "1", - "login": user, - "password": data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load('http://euroshare.eu/customer-zone/login/', + post={'trvale' : "1", + 'login' : user, + 'password': password}) if u">Nesprávne prihlasovacie meno alebo heslo" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/ExashareCom.py b/module/plugins/accounts/ExashareCom.py index 431798522..26594c702 100644 --- a/module/plugins/accounts/ExashareCom.py +++ b/module/plugins/accounts/ExashareCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class ExashareCom(XFSAccount): __name__ = "ExashareCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __description__ = """Exashare.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 51be3880f..13edbbb44 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -1,36 +1,41 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class FastixRu(Account): __name__ = "FastixRu" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" + __status__ = "testing" __description__ = """Fastix account plugin""" __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - html = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) + def parse_info(self, user, password, data, req): + data = self.get_data(user) + html = json_loads(self.load("http://fastix.ru/api_v2/", + get={'apikey': data['api'], + 'sub' : "getaccountdetails"})) points = html['points'] kb = float(points) * 1024 ** 2 / 1000 if points > 0: - account_info = {"validuntil": -1, "trafficleft": kb} + account_info = {'validuntil': -1, 'trafficleft': kb} else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} return account_info - def login(self, user, data, req): - html = req.load("http://fastix.ru/api_v2/", - get={'sub': "get_apikey", 'email': user, 'password': data['password']}) + def login(self, user, password, data, req): + html = self.load("https://fastix.ru/api_v2/", + get={'sub' : "get_apikey", + 'email' : user, + 'password': password}) api = json_loads(html) api = api['apikey'] @@ -38,4 +43,4 @@ class FastixRu(Account): data['api'] = api if "error_code" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index b946e29ba..3a3769a1c 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -2,13 +2,15 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class FastshareCz(Account): __name__ = "FastshareCz" __type__ = "account" - __version__ = "0.06" + __version__ = "0.09" + __status__ = "testing" __description__ = """Fastshare.cz account plugin""" __license__ = "GPLv3" @@ -19,16 +21,16 @@ class FastshareCz(Account): CREDIT_PATTERN = r'Credit\s*:\s*</td>\s*<td>(.+?)\s*<' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = -1 trafficleft = None premium = False - html = req.load("http://www.fastshare.cz/user", decode=True) + html = self.load("http://www.fastshare.cz/user") m = re.search(self.CREDIT_PATTERN, html) if m: - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) premium = bool(trafficleft) @@ -37,14 +39,14 @@ class FastshareCz(Account): 'premium' : premium} - def login(self, user, data, req): - req.cj.setCookie("fastshare.cz", "lang", "en") + def login(self, user, password, data, req): + set_cookie(req.cj, "fastshare.cz", "lang", "en") - req.load('http://www.fastshare.cz/login') # Do not remove or it will not login + self.load('http://www.fastshare.cz/login') #@NOTE: Do not remove or it will not login - html = req.load("http://www.fastshare.cz/sql.php", - post={'login': user, 'heslo': data['password']}, - decode=True) + html = self.load("https://www.fastshare.cz/sql.php", + post={'login': user, + 'heslo': password}) if ">Wrong username or password" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py index 50fe1aac8..54c3a2359 100644 --- a/module/plugins/accounts/File4SafeCom.py +++ b/module/plugins/accounts/File4SafeCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class File4SafeCom(XFSAccount): __name__ = "File4SafeCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __description__ = """File4Safe.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/FileParadoxIn.py b/module/plugins/accounts/FileParadoxIn.py index c12d99d6a..21f43be6e 100644 --- a/module/plugins/accounts/FileParadoxIn.py +++ b/module/plugins/accounts/FileParadoxIn.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class FileParadoxIn(XFSAccount): __name__ = "FileParadoxIn" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """FileParadox.in account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 8ca55b1bc..bdb13bd3d 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,13 +1,15 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.04" + __version__ = "0.07" + __status__ = "testing" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" @@ -15,45 +17,44 @@ class FilecloudIo(Account): ("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): - # It looks like the first API request always fails, so we retry 5 times, it should work on the second try + def parse_info(self, user, password, data, req): + #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): - rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.getAccountData(user)['password']}) + rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", + post={'username': user, 'password': password}) rep = json_loads(rep) - if rep['status'] == 'ok': + if rep['status'] == "ok": break - elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': - self.logError(_("Wrong username or password")) - return {"valid": False, "premium": False} + elif rep['status'] == "error" and rep['message'] == "no such user or wrong password": + self.log_error(_("Wrong username or password")) + return {'valid': False, 'premium': False} else: - return {"premium": False} + return {'premium': False} akey = rep['akey'] - self.accounts[user]['akey'] = akey # Saved for hoster plugin - rep = req.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}) + self.accounts[user]['akey'] = akey #: Saved for hoster plugin + rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", + post={'akey': akey}) rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": float(rep['premium_until']), "trafficleft": -1} + return {'validuntil': float(rep['premium_until']), 'trafficleft': -1} else: - return {"premium": False} + return {'premium': False} - def login(self, user, data, req): - req.cj.setCookie("secure.filecloud.io", "lang", "en") - html = req.load('https://secure.filecloud.io/user-login.html') + def login(self, user, password, data, req): + set_cookie(req.cj, "secure.filecloud.io", "lang", "en") + html = self.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): self.form_data = {} self.form_data['username'] = user - self.form_data['password'] = data['password'] + self.form_password = password - html = req.load('https://secure.filecloud.io/user-login_p.html', - post=self.form_data, - multipart=True) + html = self.load('https://secure.filecloud.io/user-login_p.html', + post=self.form_data) if "you have successfully logged in" not in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 37b6f97a8..e3d0c8491 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -4,13 +4,14 @@ import pycurl import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FilefactoryCom(Account): __name__ = "FilefactoryCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.17" + __status__ = "testing" __description__ = """Filefactory.com account plugin""" __license__ = "GPLv3" @@ -21,8 +22,8 @@ class FilefactoryCom(Account): VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<D>\d{1,2})\w{1,2} (?P<M>\w{3}), (?P<Y>\d{4})</strong>' - def loadAccountInfo(self, user, req): - html = req.load("http://www.filefactory.com/account/") + def parse_info(self, user, password, data, req): + html = self.load("http://www.filefactory.com/account/") m = re.search(self.VALID_UNTIL_PATTERN, html) if m: @@ -33,16 +34,16 @@ class FilefactoryCom(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, data, req): + def login(self, user, password, data, req): req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") - html = req.load("http://www.filefactory.com/member/signin.php", - post={"loginEmail" : user, - "loginPassword": data['password'], - "Submit" : "Sign In"}) + html = self.load("https://www.filefactory.com/member/signin.php", + post={'loginEmail' : user, + 'loginPassword': password, + 'Submit' : "Sign In"}) if req.lastEffectiveURL != "http://www.filefactory.com/account/": - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index b92a371a5..fb251ac5f 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -2,14 +2,16 @@ import re import time +import urlparse -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FilejungleCom(Account): __name__ = "FilejungleCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __description__ = """Filejungle.com account plugin""" __license__ = "GPLv3" @@ -23,8 +25,8 @@ class FilejungleCom(Account): LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' - def loadAccountInfo(self, user, req): - html = req.load(self.URL + "dashboard.php") + def parse_info(self, user, password, data, req): + html = self.load(self.URL + "dashboard.php") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: premium = True @@ -33,18 +35,17 @@ class FilejungleCom(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, data, req): - html = req.load(self.URL + "login.php", - post={"loginUserName": user, - "loginUserPassword": data['password'], - "loginFormSubmit": "Login", - "recaptcha_challenge_field": "", - "recaptcha_response_field": "", - "recaptcha_shortencode_field": ""}, - decode=True) + def login(self, user, password, data, req): + html = self.load(urlparse.urljoin(self.URL, "login.php"), + post={'loginUserName' : user, + 'loginUserPassword' : password, + 'loginFormSubmit' : "Login", + 'recaptcha_challenge_field' : "", + 'recaptcha_response_field' : "", + 'recaptcha_shortencode_field': ""}) if re.search(self.LOGIN_FAILED_PATTERN, html): - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py index 7c743f56a..957f4ef05 100644 --- a/module/plugins/accounts/FileomCom.py +++ b/module/plugins/accounts/FileomCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class FileomCom(XFSAccount): __name__ = "FileomCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Fileom.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index ac5fd11da..674c7a5dd 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -3,57 +3,57 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.07" + __status__ = "testing" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - TOKEN_PATTERN = r'_csrf_token" value="(.+?)" />' + TOKEN_PATTERN = r'name="_csrf_token" value="(.+?)"' WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gültig bis (.+)\.\s*</td>' TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>' FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' - def loadAccountInfo(self, user, req): - html = req.load("https://filer.net/profile") + def parse_info(self, user, password, data, req): + html = self.load("https://filer.net/profile") - # Free user + #: Free user if re.search(self.FREE_PATTERN, html): - return {"premium": False, "validuntil": None, "trafficleft": None} + return {'premium': False, 'validuntil': None, 'trafficleft': None} until = re.search(self.WALID_UNTIL_PATTERN, html) traffic = re.search(self.TRAFFIC_PATTERN, html) if until and traffic: validuntil = time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S")) - trafficleft = self.parseTraffic(traffic.group(1)) - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + trafficleft = self.parse_traffic(traffic.group(1)) + return {'premium': True, 'validuntil': validuntil, 'trafficleft': trafficleft} else: - self.logError(_("Unable to retrieve account information")) - return {"premium": False, "validuntil": None, "trafficleft": None} + self.log_error(_("Unable to retrieve account information")) + return {'premium': False, 'validuntil': None, 'trafficleft': None} - def login(self, user, data, req): - html = req.load("https://filer.net/login") + def login(self, user, password, data, req): + html = self.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, html).group(1) - html = req.load("https://filer.net/login_check", - post={"_username": user, - "_password": data['password'], - "_remember_me": "on", - "_csrf_token": token, - "_target_path": "https://filer.net/"}, - decode=True) + html = self.load("https://filer.net/login_check", + post={'_username' : user, + '_password' : password, + '_remember_me': "on", + '_csrf_token' : token, + '_target_path': "https://filer.net/"}) if 'Logout' not in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py index 4c6755293..8a4750036 100644 --- a/module/plugins/accounts/FilerioCom.py +++ b/module/plugins/accounts/FilerioCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class FilerioCom(XFSAccount): __name__ = "FilerioCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """FileRio.in account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index ee309c425..7ed09e731 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -1,31 +1,31 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FilesMailRu(Account): __name__ = "FilesMailRu" __type__ = "account" - __version__ = "0.11" + __version__ = "0.13" + __status__ = "testing" __description__ = """Filesmail.ru account plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def loadAccountInfo(self, user, req): - return {"validuntil": None, "trafficleft": None} + def parse_info(self, user, password, data, req): + return {'validuntil': None, 'trafficleft': None} - def login(self, user, data, req): + def login(self, user, password, data, req): user, domain = user.split("@") - html = req.load("http://swa.mail.ru/cgi-bin/auth", - post={"Domain": domain, - "Login": user, - "Password": data['password'], - "Page": "http://files.mail.ru/"}, - decode=True) + html = self.load("https://swa.mail.ru/cgi-bin/auth", + post={'Domain' : domain, + 'Login' : user, + 'Password': password, + 'Page' : "http://files.mail.ru/"}) if "Неверное имя пользователя или пароль" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 5eb6b844c..dabfc1932 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -2,43 +2,50 @@ import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class FileserveCom(Account): __name__ = "FileserveCom" __type__ = "account" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" __description__ = """Fileserve.com account plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) + def parse_info(self, user, password, data, req): + data = self.get_data(user) - html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}) + html = self.load("http://app.fileserve.com/api/login/", + post={'username': user, + 'password': password, + 'submit': "Submit+Query"}) res = json_loads(html) if res['type'] == "premium": validuntil = time.mktime(time.strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) - return {"trafficleft": res['traffic'], "validuntil": validuntil} + return {'trafficleft': res['traffic'], 'validuntil': validuntil} else: - return {"premium": False, "trafficleft": None, "validuntil": None} + return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, data, req): - html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}) + def login(self, user, password, data, req): + html = self.load("http://app.fileserve.com/api/login/", + post={'username': user, + 'password': password, + 'submit' : "Submit+Query"}) res = json_loads(html) if not res['type']: - self.wrongPassword() - - #login at fileserv html - req.load("http://www.fileserve.com/login.php", - post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", - "loginFormSubmit": "Login"}) + self.login_fail() + + #: Login at fileserv html + self.load("http://www.fileserve.com/login.php", + post={'loginUserName' : user, + 'loginUserPassword': password, + 'autoLogin' : "checked", + 'loginFormSubmit' : "Login"}) diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index 2777a142a..a7ec8e2c5 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -1,12 +1,14 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class FourSharedCom(Account): __name__ = "FourSharedCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.07" + __status__ = "testing" __description__ = """FourShared.com account plugin""" __license__ = "GPLv3" @@ -14,21 +16,20 @@ class FourSharedCom(Account): ("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): - # Free mode only for now - return {"premium": False} + def parse_info(self, user, password, data, req): + #: Free mode only for now + return {'premium': False} - def login(self, user, data, req): - req.cj.setCookie("4shared.com", "4langcookie", "en") + def login(self, user, password, data, req): + set_cookie(req.cj, "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"}, - decode=True) + res = self.load("https://www.4shared.com/web/login", + post={'login' : user, + 'password' : 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() + self.login_fail() diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index ca3602a2c..a2f66f3b3 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -3,25 +3,26 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.13" + __version__ = "0.15" + __status__ = "testing" __description__ = """Freakshare.com account plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium = False validuntil = None trafficleft = None - html = req.load("http://freakshare.com/") + html = self.load("http://freakshare.com/") try: m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M) @@ -32,20 +33,21 @@ class FreakshareCom(Account): try: m = re.search(r'Traffic verbleibend:</td>\s*<td>([^<]+)', html, re.M) - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) except Exception: pass - return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} - def login(self, user, data, req): - req.load("http://freakshare.com/index.php?language=EN") + def login(self, user, password, data, req): + self.load("http://freakshare.com/index.php?language=EN") - html = req.load("http://freakshare.com/login.html", - post={"submit": "Login", "user": user, "pass": data['password']}, - decode=True) + html = self.load("https://freakshare.com/login.html", + post={'submit': "Login", + 'user' : user, + 'pass' : password}) if ">Wrong Username or Password" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 14b9f1e9a..0c315873f 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -1,52 +1,53 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.13" + __version__ = "0.16" + __status__ = "testing" __description__ = """FreeWayMe account plugin""" __license__ = "GPLv3" __authors__ = [("Nicolas Giese", "james@free-way.me")] - def loadAccountInfo(self, user, req): - status = self.getAccountStatus(user, req) + def parse_info(self, user, password, data, req): + status = self.get_account_status(user, password, req) - self.logDebug(status) + self.log_debug(status) - account_info = {"validuntil": -1, "premium": False} + account_info = {'validuntil': -1, 'premium': False} if status['premium'] == "Free": - account_info['trafficleft'] = self.parseTraffic(status['guthaben'] + "MB") + account_info['trafficleft'] = self.parse_traffic(status['guthaben'] + "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": - account_info = {"validuntil": float(status['Flatrate']), - "trafficleft": -1, - "premium": True} + account_info = {'validuntil' : float(status['Flatrate']), + 'trafficleft': -1, + 'premium' : True} return account_info - def login(self, user, data, req): - status = self.getAccountStatus(user, req) + def login(self, user, password, data, req): + status = self.get_account_status(user, password, req) - # Check if user and password are valid + #: Check if user and password are valid if not status: - self.wrongPassword() + self.login_fail() - def getAccountStatus(self, user, req): - answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.getAccountData(user)['password']}) + def get_account_status(self, user, password, req): + answer = self.load("http://www.free-way.bz/ajax/jd.php", #@TODO: Revert to `https` in 0.4.10 + get={'id': 4, 'user': user, 'pass': password}) - self.logDebug("Login: %s" % answer) + self.log_debug("Login: %s" % answer) if answer == "Invalid login": - self.wrongPassword() + self.login_fail() return json_loads(answer) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 7fcf88f20..bc8ced5e2 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.09" + __version__ = "0.11" + __status__ = "testing" __description__ = """Fshare.vn account plugin""" __license__ = "GPLv3" @@ -23,40 +24,38 @@ class FshareVn(Account): DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>' - def loadAccountInfo(self, user, req): - html = req.load("http://www.fshare.vn/account_info.php", decode=True) + def parse_info(self, user, password, data, req): + html = self.load("http://www.fshare.vn/account_info.php") if re.search(self.LIFETIME_PATTERN, html): - self.logDebug("Lifetime membership detected") - trafficleft = self.getTrafficLeft() - return {"validuntil": -1, "trafficleft": trafficleft, "premium": True} + self.log_debug("Lifetime membership detected") + trafficleft = self.get_traffic_left() + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': True} m = re.search(self.VALID_UNTIL_PATTERN, html) if m: premium = True validuntil = time.mktime(time.strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) - trafficleft = self.getTrafficLeft() + trafficleft = self.get_traffic_left() else: premium = False validuntil = None trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - html = req.load("https://www.fshare.vn/login.php", - post={'LoginForm[email]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : "Login"}, - referer=True, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://www.fshare.vn/login.php", + post={'LoginForm[email]' : user, + 'LoginForm[password]' : password, + 'LoginForm[rememberMe]': 1, + 'yt0' : "Login"}) if not re.search(r'<img\s+alt="VIP"', html): - self.wrongPassword() + self.login_fail() - def getTrafficLeft(self): + def get_traffic_left(self): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - return self.parseTraffic(m.group(1) + m.group(2)) if m else 0 + return self.parse_traffic(m.group(1) + m.group(2)) if m else 0 diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index f978d2fa0..2d35ab7bb 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class Ftp(Account): __name__ = "Ftp" __type__ = "account" - __version__ = "0.01" + __version__ = "0.03" + __status__ = "testing" __description__ = """Ftp dummy account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index e559b28e1..55daa8c2d 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.16" + __version__ = "0.18" + __status__ = "testing" __description__ = """Hellshare.cz account plugin""" __license__ = "GPLv3" @@ -19,9 +20,9 @@ class HellshareCz(Account): CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): self.relogin(user) - html = req.load("http://www.hellshare.com/") + html = self.load("http://www.hellshare.com/") m = re.search(self.CREDIT_LEFT_PATTERN, html) if m is None: @@ -33,47 +34,47 @@ class HellshareCz(Account): premium = True try: if "." in credit: - #Time-based account + #: Time-based account vt = [int(x) for x in credit.split('.')[:2]] lt = time.localtime() - year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) + year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] is lt.tm_mon and vt[0] < lt.tm_mday)) validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S")) trafficleft = -1 else: - #Traffic-based account - trafficleft = self.parseTraffic(credit + "MB") + #: Traffic-based account + trafficleft = self.parse_traffic(credit + "MB") validuntil = -1 except Exception, e: - self.logError(_("Unable to parse credit info"), e) + self.log_error(_("Unable to parse credit info"), e) validuntil = -1 trafficleft = -1 - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - html = req.load('http://www.hellshare.com/', decode=True) + def login(self, user, password, data, req): + html = self.load('http://www.hellshare.com/') if req.lastEffectiveURL != 'http://www.hellshare.com/': - #Switch to English - self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) + #: Switch to English + self.log_debug("Switch lang - URL: %s" % req.lastEffectiveURL) - json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) + json = self.load("%s?do=locRouter-show" % req.lastEffectiveURL) hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) - self.logDebug("Switch lang - HASH: %s" % hash) + self.log_debug("Switch lang - HASH: %s" % hash) - html = req.load('http://www.hellshare.com/%s/' % hash, decode=True) + html = self.load('http://www.hellshare.com/%s/' % hash) if re.search(self.CREDIT_LEFT_PATTERN, html): - self.logDebug("Already logged in") + self.log_debug("Already logged in") return - html = req.load('http://www.hellshare.com/login?do=loginForm-submit', - post={"login": "Log in", - "password": data['password'], - "username": user, - "perm_login": "on"}, - decode=True) + html = self.load("https://www.hellshare.com/login", + get={'do': "loginForm-submit"}, + post={'login' : "Log in", + 'password' : password, + 'username' : user, + 'perm_login': "on"}) if "<p>You input a wrong user name or wrong password</p>" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py new file mode 100644 index 000000000..ff90ec2d2 --- /dev/null +++ b/module/plugins/accounts/HighWayMe.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account + + +class HighWayMe(Account): + __name__ = "HighWayMe.py" + __type__ = "account" + __version__ = "0.04" + __status__ = "testing" + + __description__ = """High-Way.me account plugin""" + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + + + def parse_info(self, user, password, data, req): + premium = False + validuntil = -1 + trafficleft = None + + json_data = self.load('https://high-way.me/api.php?user') + + self.log_debug("JSON data: %s" % json_data) + + json_data = json_loads(json_data) + + if 'premium' in json_data['user'] and json_data['user']['premium']: + premium = True + + if 'premium_bis' in json_data['user'] and json_data['user']['premium_bis']: + validuntil = float(json_data['user']['premium_bis']) + + if 'premium_traffic' in json_data['user'] and json_data['user']['premium_traffic']: + trafficleft = float(json_data['user']['premium_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + return {'premium' : premium, + 'validuntil' : validuntil, + 'trafficleft': trafficleft} + + + def login(self, user, password, data, req): + html = self.load("https://high-way.me/api.php?login", + post={'login': '1', + 'user': user, + 'pass': password}) + + if 'UserOrPassInvalid' in html: + self.login_fail() diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index 07e46eb07..dcab156ee 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class Http(Account): __name__ = "Http" __type__ = "account" - __version__ = "0.01" + __version__ = "0.03" + __status__ = "testing" __description__ = """Http dummy account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py index 5da3bbc37..fa64945a3 100644 --- a/module/plugins/accounts/HugefilesNet.py +++ b/module/plugins/accounts/HugefilesNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class HugefilesNet(XFSAccount): __name__ = "HugefilesNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Hugefiles.net account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py index 319a3feee..a8527d62c 100644 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class HundredEightyUploadCom(XFSAccount): __name__ = "HundredEightyUploadCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """180upload.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/JunkyvideoCom.py b/module/plugins/accounts/JunkyvideoCom.py index 8275ff176..5fcefda36 100644 --- a/module/plugins/accounts/JunkyvideoCom.py +++ b/module/plugins/accounts/JunkyvideoCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunkyvideoCom(XFSAccount): __name__ = "JunkyvideoCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" + __status__ = "testing" __description__ = """Junkyvideo.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py index b0fc160f3..791835dfe 100644 --- a/module/plugins/accounts/JunocloudMe.py +++ b/module/plugins/accounts/JunocloudMe.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunocloudMe(XFSAccount): __name__ = "JunocloudMe" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Junocloud.me account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index d2ba1d237..014d43a69 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -3,13 +3,15 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class Keep2ShareCc(Account): __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.05" + __version__ = "0.08" + __status__ = "testing" __description__ = """Keep2Share.cc account plugin""" __license__ = "GPLv3" @@ -23,17 +25,17 @@ class Keep2ShareCc(Account): LOGIN_FAIL_PATTERN = r'Please fix the following input errors' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = -1 premium = False - html = req.load("http://keep2share.cc/site/profile.html", decode=True) + html = self.load("http://keep2share.cc/site/profile.html") m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) if expiredate == "LifeTime": premium = True @@ -43,7 +45,7 @@ class Keep2ShareCc(Account): validuntil = time.mktime(time.strptime(expiredate, "%Y.%m.%d")) except Exception, e: - self.logError(e) + self.log_error(e) else: premium = True if validuntil > time.mktime(time.gmtime()) else False @@ -51,23 +53,22 @@ class Keep2ShareCc(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: try: - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) except Exception, e: - self.logError(e) + self.log_error(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - req.cj.setCookie("keep2share.cc", "lang", "en") + def login(self, user, password, data, req): + set_cookie(req.cj, "keep2share.cc", "lang", "en") - html = req.load("http://keep2share.cc/login.html", - post={'LoginForm[username]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : ""}, - decode=True) + html = self.load("https://keep2share.cc/login.html", + post={'LoginForm[username]' : user, + 'LoginForm[password]' : password, + 'LoginForm[rememberMe]': 1, + 'yt0' : ""}) if re.search(self.LOGIN_FAIL_PATTERN, html): - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 7f973d2d3..1fc9b76ba 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -1,34 +1,35 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account # from module.common.json_layer import json_loads, json_dumps class LetitbitNet(Account): __name__ = "LetitbitNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __description__ = """Letitbit.net account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.getAccountData(user)['password'] - # json_data = [api_key, ['key/info']] - # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - # self.logDebug("API Key Info: " + api_rep) + # json_data = [password, ['key/info']] + # api_rep = self.load("http://api.letitbit.net/json", + # post={'r': json_dumps(json_data)}) + # self.log_debug("API Key Info: " + api_rep) # api_rep = json_loads(api_rep) # - # if api_rep['status'] == 'FAIL': - # self.logWarning(api_rep['data']) + # if api_rep['status'] == "FAIL": + # self.log_warning(api_rep['data']) # return {'valid': False, 'premium': False} - return {"premium": True} + return {'premium': True} - def login(self, user, data, req): - # API_KEY is the username and the PREMIUM_KEY is the password - self.logInfo(_("You must use your API KEY as username and the PREMIUM KEY as password")) + def login(self, user, password, data, req): + #: API_KEY is the username and the PREMIUM_KEY is the password + self.log_info(_("You must use your API KEY as username and the PREMIUM KEY as password")) diff --git a/module/plugins/accounts/LinestorageCom.py b/module/plugins/accounts/LinestorageCom.py index a48d5beb9..87dd2a1d3 100644 --- a/module/plugins/accounts/LinestorageCom.py +++ b/module/plugins/accounts/LinestorageCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class LinestorageCom(XFSAccount): __name__ = "LinestorageCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """Linestorage.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 34571d374..00ae64b44 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -2,38 +2,42 @@ import hashlib -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.07" + __status__ = "testing" + __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password']).hexdigest()}) + def parse_info(self, user, password, data, req): + data = self.get_data(user) + r = self.load('http://gen.linksnappy.com/lseAPI.php', + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(password).hexdigest()}) - self.logDebug("JSON data: " + r) + self.log_debug("JSON data: " + r) j = json_loads(r) if j['error']: - return {"premium": False} + return {'premium': False} validuntil = j['return']['expire'] - if validuntil == 'lifetime': + if validuntil == "lifetime": validuntil = -1 - elif validuntil == 'expired': - return {"premium": False} + elif validuntil == "expired": + return {'premium': False} else: validuntil = float(validuntil) @@ -41,17 +45,18 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = self.parseTraffic("%d MB" % j['return']['trafficleft']) + trafficleft = self.parse_traffic("%d MB" % j['return']['trafficleft']) - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium' : True , + 'validuntil' : validuntil , + 'trafficleft': trafficleft} - def login(self, user, data, req): - r = req.load("http://gen.linksnappy.com/lseAPI.php", - get={'act' : 'USERDETAILS', - 'username': user, - 'password': hashlib.md5(data['password']).hexdigest()}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://gen.linksnappy.com/lseAPI.php", + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(password).hexdigest()}) - if 'Invalid Account Details' in r: - self.wrongPassword() + if "Invalid Account Details" in html: + self.login_fail() diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index a082b97af..d7a04491d 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -1,39 +1,44 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class MegaDebridEu(Account): __name__ = "MegaDebridEu" __type__ = "account" - __version__ = "0.20" + __version__ = "0.22" + __status__ = "testing" - __description__ = """mega-debrid.eu account plugin""" + __description__ = """Mega-debrid.eu account plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - # Define the base URL of MegaDebrid api + #: Define the base URL of MegaDebrid api API_URL = "https://www.mega-debrid.eu/api.php" - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - jsonResponse = req.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}) + def parse_info(self, user, password, data, req): + data = self.get_data(user) + jsonResponse = self.load(self.API_URL, + get={'action' : 'connectUser', + 'login' : user, + 'password': password}) res = json_loads(jsonResponse) if res['response_code'] == "ok": - return {"premium": True, "validuntil": float(res['vip_end']), "status": True} + return {'premium': True, 'validuntil': float(res['vip_end']), 'status': True} else: - self.logError(res) - return {"status": False, "premium": False} + self.log_error(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']}) + def login(self, user, password, data, req): + jsonResponse = self.load(self.API_URL, + get={'action' : 'connectUser', + 'login' : user, + 'password': password}) res = json_loads(jsonResponse) if res['response_code'] != "ok": - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 262d5a818..ce2d78994 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class MegaRapidCz(Account): __name__ = "MegaRapidCz" __type__ = "account" - __version__ = "0.35" + __version__ = "0.37" + __status__ = "testing" __description__ = """MegaRapid.cz account plugin""" __license__ = "GPLv3" @@ -24,37 +25,37 @@ class MegaRapidCz(Account): TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' - def loadAccountInfo(self, user, req): - htmll = req.load("http://megarapid.cz/mujucet/", decode=True) + def parse_info(self, user, password, data, req): + htmll = self.load("http://megarapid.cz/mujucet/") m = re.search(self.LIMITDL_PATTERN, htmll) if m: - data = self.getAccountData(user) + data = self.get_data(user) data['options']['limitDL'] = [int(m.group(1))] m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M")) - return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + return {'premium': True, 'trafficleft': -1, 'validuntil': validuntil} m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) if m: trafficleft = float(m.group(1)) * (1 << 20) - return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} + return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} - return {"premium": False, "trafficleft": None, "validuntil": None} + return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, data, req): - html = req.load("http://megarapid.cz/prihlaseni/", decode=True) + def login(self, user, password, data, req): + html = self.load("http://megarapid.cz/prihlaseni/") if "Heslo:" in html: start = html.index('id="inp_hash" name="hash" value="') html = html[start + 33:] hashes = html[0:32] - html = req.load("http://megarapid.cz/prihlaseni/", - post={"hash": hashes, - "login": user, - "pass1": data['password'], - "remember": 0, - "sbmt": u"Přihlásit"}) + html = self.load("https://megarapid.cz/prihlaseni/", + post={'hash' : hashes, + 'login' : user, + 'pass1' : password, + 'remember': 1, + 'sbmt' : u"Přihlásit"}) diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index d061d02bc..08cf1f535 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class MegaRapidoNet(Account): __name__ = "MegaRapidoNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __description__ = """MegaRapido.net account plugin""" __license__ = "GPLv3" @@ -20,16 +21,16 @@ class MegaRapidoNet(Account): USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = None premium = False - html = req.load("http://megarapido.net/gerador", decode=True) + html = self.load("http://megarapido.net/gerador") validuntil = re.search(self.VALID_UNTIL_PATTERN, html) if validuntil: - #hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) + #: Hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4)) trafficleft = -1 premium = True @@ -39,19 +40,19 @@ class MegaRapidoNet(Account): 'premium' : premium} - def login(self, user, data, req): - req.load("http://megarapido.net/login") - req.load("http://megarapido.net/painel_user/ajax/logar.php", - post={'login': user, 'senha': data['password']}, - decode=True) + def login(self, user, password, data, req): + self.load("http://megarapido.net/login") + self.load("http://megarapido.net/painel_user/ajax/logar.php", + post={'login': user, + 'senha': password}) - html = req.load("http://megarapido.net/gerador") + html = self.load("http://megarapido.net/gerador") if "sair" not in html.lower(): - self.wrongPassword() + self.login_fail() else: m = re.search(self.USER_ID_PATTERN, html) if m: data['uid'] = m.group(1) else: - self.fail("Couldn't find the user ID") + self.login_fail("Couldn't find the user ID") diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 3d7ddbe46..ec43b7fc0 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class MegasharesCom(Account): __name__ = "MegasharesCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" + __status__ = "testing" __description__ = """Megashares.com account plugin""" __license__ = "GPLv3" @@ -19,30 +20,29 @@ class MegasharesCom(Account): VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://d01.megashares.com/myms.php", decode=True) + def parse_info(self, user, password, data, req): + # self.relogin(user) + html = self.load("http://d01.megashares.com/myms.php") premium = False if '>Premium Upgrade<' in html else True validuntil = trafficleft = -1 try: timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.logDebug(timestr) + self.log_debug(timestr) validuntil = time.mktime(time.strptime(timestr, "%b %d, %Y")) except Exception, e: - self.logError(e) + self.log_error(e) - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, data, req): - html = req.load('http://d01.megashares.com/myms_login.php', - post={"httpref" : "", - "myms_login" : "Login", - "mymslogin_name": user, - "mymspassword" : data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load('http://d01.megashares.com/myms_login.php', + post={'httpref' : "", + 'myms_login' : "Login", + 'mymslogin_name': user, + 'mymspassword' : password}) if not '<span class="b ml">%s</span>' % user in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py index 6128cddc8..090950bf2 100644 --- a/module/plugins/accounts/MovReelCom.py +++ b/module/plugins/accounts/MovReelCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class MovReelCom(XFSAccount): __name__ = "MovReelCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """Movreel.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py index e98f17b2d..ed04ad3c2 100644 --- a/module/plugins/accounts/MultihostersCom.py +++ b/module/plugins/accounts/MultihostersCom.py @@ -6,7 +6,8 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" + __status__ = "testing" __description__ = """Multihosters.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 3488e3288..c9e30a93f 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -2,13 +2,14 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.05" + __version__ = "0.07" + __status__ = "testing" __description__ = """Multishare.cz account plugin""" __license__ = "GPLv3" @@ -19,26 +20,25 @@ class MultishareCz(Account): ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name=".+?" value="(.+?)">' - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://www.multishare.cz/profil/", decode=True) + def parse_info(self, user, password, data, req): + # self.relogin(user) + html = self.load("http://www.multishare.cz/profil/") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = self.parseTraffic(m.group('S') + m.group('U')) if m else 0 + trafficleft = self.parse_traffic(m.group('S') + m.group('U')) if m else 0 self.premium = True if trafficleft else False - html = req.load("http://www.multishare.cz/", decode=True) + html = self.load("http://www.multishare.cz/") mms_info = dict(re.findall(self.ACCOUNT_INFO_PATTERN, html)) - return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft}) + return dict(mms_info, **{'validuntil': -1, 'trafficleft': trafficleft}) - def login(self, user, data, req): - html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', - post={"akce" : "Přihlásit", - "heslo": data['password'], - "jmeno": user}, - decode=True) + def login(self, user, password, data, req): + html = self.load('https://www.multishare.cz/html/prihlaseni_process.php', + post={'akce' : "Přihlásit", + 'heslo': password, + 'jmeno': user}) if '<div class="akce-chyba akce">' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 9a13e2e42..008b62cc6 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -3,35 +3,37 @@ import time from module.common.json_layer import json_loads -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class MyfastfileCom(Account): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.06" + __status__ = "testing" __description__ = """Myfastfile.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): if 'days_left' in self.json_data: validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60 - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} + return {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: - self.logError(_("Unable to get account information")) + self.log_error(_("Unable to get account information")) - def login(self, user, data, req): - # Password to use is the API-Password written in http://myfastfile.com/myaccount - html = req.load("http://myfastfile.com/api.php", - get={"user": user, "pass": data['password']}) + def login(self, user, password, data, req): + #: Password to use is the API-Password written in http://myfastfile.com/myaccount + html = self.load("https://myfastfile.com/api.php", + get={'user': user, + 'pass': password}) - self.logDebug("JSON data: " + html) + self.log_debug("JSON data: " + html) self.json_data = json_loads(html) if self.json_data['status'] != 'ok': - self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) - self.wrongPassword() + self.log_error(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) + self.login_fail() diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py new file mode 100644 index 000000000..b7edcca32 --- /dev/null +++ b/module/plugins/accounts/NitroflareCom.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.internal.Account import Account + + +class NitroflareCom(Account): + __name__ = "NitroflareCom" + __type__ = "account" + __version__ = "0.06" + __status__ = "testing" + + __description__ = """Nitroflare.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] + + + VALID_UNTIL_PATTERN = r'>Time Left</label><strong>(.+?)</' + TRAFFIC_LEFT_PATTERN = r'>Daily Limit</label><strong>([\d.,]+)' + LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' + + TOKEN_PATTERN = r'name="token" value="(.+?)"' + + + def parse_info(self, user, password, data, req): + validuntil = -1 + trafficleft = None + premium = False + + html = self.load("https://nitroflare.com/member", + get={'s': "premium"}) + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + self.log_debug("Time Left: " + expiredate) + + try: + validuntil = sum(int(v) * {'day': 24 * 3600, 'hour': 3600, 'minute': 60}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(day|hour|minute)', expiredate, re.I)) + except Exception, e: + self.log_error(e) + + else: + self.log_debug("Valid until: %s" % validuntil) + + if validuntil: + validuntil += time.time() + premium = True + else: + validuntil = -1 + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))) + " GB") + + except Exception, e: + self.log_error(e) + else: + self.log_debug("TRAFFIC_LEFT_PATTERN not found") + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} + + + def login(self, user, password, data, req): + html = self.load("https://nitroflare.com/login") + + token = re.search(self.TOKEN_PATTERN, html).group(1) + + html = self.load("https://nitroflare.com/login", + post={'login' : "", + 'email' : user, + 'password': password, + 'token' : token}) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.login_fail() diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 7e3f757d3..e9dad7647 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -4,78 +4,80 @@ import datetime import hashlib import time -from module.plugins.Account import Account -from module.common.json_layer import json_loads as loads +from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account class NoPremiumPl(Account): - __name__ = "NoPremiumPl" - __version__ = "0.01" - __type__ = "account" + __name__ = "NoPremiumPl" + __type__ = "account" + __version__ = "0.03" + __status__ = "testing" + __description__ = "NoPremium.pl account plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] - _api_url = "http://crypt.nopremium.pl" - _api_query = { - "site": "nopremium", - "username": "", - "password": "", - "output": "json", - "loc": "1", - "info": "1" - } + API_URL = "http://crypt.nopremium.pl" + API_QUERY = {'site' : "nopremium", + 'username': "" , + 'password': "" , + 'output' : "json" , + 'loc' : "1" , + 'info' : "1" } _req = None _usr = None _pwd = None - def loadAccountInfo(self, name, req): + + def parse_info(self, name, req): self._req = req try: - result = loads(self.runAuthQuery()) + result = json_loads(self.run_auth_query()) except Exception: - # todo: return or let it be thrown? + #@TODO: return or let it be thrown? return premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) - traffic_left = result["balance"] * 1024 + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) + + traffic_left = result['balance'] * 1024 - return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + return {'validuntil' : valid_untill, + 'trafficleft': traffic_left, + 'premium' : premium } - def login(self, user, data, req): + + def login(self, user, password, data, req): self._usr = user - self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest() + self._pwd = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest() self._req = req try: - response = loads(self.runAuthQuery()) + response = json_loads(self.run_auth_query()) except Exception: - self.wrongPassword() + self.login_fail() if "errno" in response.keys(): - self.wrongPassword() + self.login_fail() + data['usr'] = self._usr data['pwd'] = self._pwd - def createAuthQuery(self): - query = self._api_query - query["username"] = self._usr - query["password"] = self._pwd + def create_auth_query(self): + query = self.API_QUERY + query['username'] = self._usr + query['password'] = self._pwd return query - def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) - return data
\ No newline at end of file + def run_auth_query(self): + return self.load(self.API_URL, + post=self.create_auth_query()) diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py index e523ee2f4..5febc8d66 100644 --- a/module/plugins/accounts/NosuploadCom.py +++ b/module/plugins/accounts/NosuploadCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class NosuploadCom(XFSAccount): __name__ = "NosuploadCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Nosupload.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py index ab61bf0fc..524c01087 100644 --- a/module/plugins/accounts/NovafileCom.py +++ b/module/plugins/accounts/NovafileCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class NovafileCom(XFSAccount): __name__ = "NovafileCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Novafile.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index 2f7b033bd..73bb383be 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -3,13 +3,14 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class NowVideoSx(Account): __name__ = "NowVideoSx" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" + __status__ = "testing" __description__ = """NowVideo.at account plugin""" __license__ = "GPLv3" @@ -19,23 +20,23 @@ class NowVideoSx(Account): VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = -1 premium = None - html = req.load("http://www.nowvideo.sx/premium.php") + html = self.load("http://www.nowvideo.sx/premium.php") m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) try: validuntil = time.mktime(time.strptime(expiredate, "%Y-%b-%d")) except Exception, e: - self.logError(e) + self.log_error(e) else: if validuntil > time.mktime(time.gmtime()): @@ -44,13 +45,13 @@ class NowVideoSx(Account): premium = False validuntil = -1 - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - html = req.load("http://www.nowvideo.sx/login.php", - post={'user': user, 'pass': data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("http://www.nowvideo.sx/login.php", + post={'user': user, + 'pass': password}) if re.search(r'>Log In<', html): - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 020a45ba7..380368b70 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -17,37 +17,40 @@ except ImportError: return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.24" + __version__ = "0.27" + __status__ = "testing" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" __authors__ = [("stanley", "stanley.foerster@gmail.com")] - def loadAccountData(self, user, req): - passwd = self.getAccountData(user)['password'] + def load_account_data(self, user, req): + passwd = self.get_info(user)['login']['password'] salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) - result = json_loads(req.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2})) + result = json_loads(self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 + get={'auth': user, + 'pass': pbkdf2})) if not result[0] == 200: - self.logWarning(_("Failed to log in: %s") % result[1]) - self.wrongPassword() + self.log_warning(_("Failed to log in: %s") % result[1]) + self.login_fail() return result[1] - def loadAccountInfo(self, name, req): - accountData = self.loadAccountData(name, req) + def parse_info(self, name, req): + account_data = self.load_account_data(name, req) - userData = accountData['user'] + userData = account_data['user'] if userData['premium'] == "null": premium = False @@ -64,7 +67,7 @@ class OboomCom(Account): trafficLeft = traffic['current'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - session = accountData['session'] + session = account_data['session'] return {'premium' : premium, 'validuntil' : validUntil, @@ -73,5 +76,5 @@ class OboomCom(Account): 'session' : session} - def login(self, user, data, req): - self.loadAccountData(user, req) + def login(self, user, password, data, req): + self.load_account_data(user, req) diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index b19e2bc69..3a0131a3f 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -4,13 +4,14 @@ import pycurl import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class OneFichierCom(Account): __name__ = "OneFichierCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __description__ = """1fichier.com account plugin""" __license__ = "GPLv3" @@ -21,38 +22,37 @@ class OneFichierCom(Account): VALID_UNTIL_PATTERN = r'Your Premium Status will end the (\d+/\d+/\d+)' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = -1 premium = None - html = req.load("https://1fichier.com/console/abo.pl") + html = self.load("https://1fichier.com/console/abo.pl") m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1) - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) try: validuntil = time.mktime(time.strptime(expiredate, "%d/%m/%Y")) except Exception, e: - self.logError(e) + self.log_error(e) else: premium = True return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} - def login(self, user, data, req): + def login(self, user, password, data, req): req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") - html = req.load("https://1fichier.com/login.pl?lg=en", - post={'mail' : user, - 'pass' : data['password'], - 'It' : "on", - 'purge' : "off", - 'valider': "Send"}, - decode=True) + html = self.load("https://1fichier.com/login.pl?lg=en", + post={'mail' : user, + 'pass' : password, + 'It' : "on", + 'purge' : "off", + 'valider': "Send"}) if '>Invalid email address' in html or '>Invalid password' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 64d04aded..6741b674f 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -1,43 +1,42 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class OverLoadMe(Account): __name__ = "OverLoadMe" __type__ = "account" - __version__ = "0.04" + __version__ = "0.06" + __status__ = "testing" __description__ = """Over-Load.me account plugin""" __license__ = "GPLv3" __authors__ = [("marley", "marley@over-load.me")] - def loadAccountInfo(self, user, req): - https = "https" if self.getConfig('ssl') else "http" - data = self.getAccountData(user) - html = req.load(https + "://api.over-load.me/account.php", - get={'user': user, - 'auth': data['password']}).strip() + def parse_info(self, user, password, data, req): + data = self.get_data(user) + html = self.load("https://api.over-load.me/account.php", + get={'user': user, + 'auth': password}).strip() data = json_loads(html) - self.logDebug(data) + self.log_debug(data) - # Check for premium + #: Check for premium if data['membership'] == "Free": return {'premium': False, 'validuntil': None, 'trafficleft': None} else: return {'premium': True, 'validuntil': data['expirationunix'], 'trafficleft': -1} - def login(self, user, data, req): - https = "https" if self.getConfig('ssl') else "http" - jsondata = req.load(https + "://api.over-load.me/account.php", - get={'user': user, - 'auth': data['password']}).strip() + def login(self, user, password, data, req): + jsondata = self.load("https://api.over-load.me/account.php", + get={'user': user, + 'auth': password}).strip() data = json_loads(jsondata) if data['err'] == 1: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index c8ea2fa26..ba8f24c6d 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.08" + __version__ = "0.11" + __status__ = "testing" __description__ = """Premium.to account plugin""" __license__ = "GPLv3" @@ -15,9 +16,10 @@ class PremiumTo(Account): ("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): - traffic = req.load("http://premium.to/api/straffic.php", - get={'username': self.username, 'password': self.password}) + def parse_info(self, user, password, data, req): + traffic = self.load("http://premium.to/api/straffic.php", #@TODO: Revert to `https` in 0.4.10 + get={'username': self.username, + 'password': self.password}) if "wrong username" not in traffic: trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -26,12 +28,12 @@ class PremiumTo(Account): return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, data, req): + def login(self, user, password, data, req): self.username = user - self.password = data['password'] - authcode = req.load("http://premium.to/api/getauthcode.php", - get={'username': user, 'password': self.password}, - decode=True) + self.password = password + authcode = self.load("http://premium.to/api/getauthcode.php", #@TODO: Revert to `https` in 0.4.10 + get={'username': user, + 'password': self.password}) if "wrong username" in authcode: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 7d061ec2d..df3b5db51 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -1,49 +1,49 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account - from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.13" + __version__ = "0.19" + __status__ = "testing" __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def loadAccountInfo(self, user, req): - # Get user data from premiumize.me - status = self.getAccountStatus(user, req) - self.logDebug(status) + def parse_info(self, user, password, data, req): + #: Get user data from premiumize.me + status = self.get_account_status(user, password) + self.log_debug(status) - # Parse account info - account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 + #: Parse account info + account_info = {'validuntil': float(status['result']['expires']), + 'trafficleft': max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 - if status['result']['type'] == 'free': - account_info['premium'] = False + if status['result']['type'] != 'free': + account_info['premium'] = True return account_info - def login(self, user, data, req): - # Get user data from premiumize.me - status = self.getAccountStatus(user, req) + def login(self, user, password, data, req): + #: Get user data from premiumize.me + status = self.get_account_status(user, password) - # Check if user and password are valid + #: Check if user and password are valid if status['status'] != 200: - self.wrongPassword() + self.login_fail() - def getAccountStatus(self, user, req): - # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) - # to retrieve account info and return the parsed json answer - answer = req.load("https://api.premiumize.me/pm-api/v1.php", + def get_account_status(self, user, password): + #: Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) + #: To retrieve account info and return the parsed json answer + answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 get={'method' : "accountstatus", 'params[login]': user, - 'params[pass]' : self.getAccountData(user)['password']}) + 'params[pass]' : password}) return json_loads(answer) diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py index 4f2fadbcc..5356c4d1a 100644 --- a/module/plugins/accounts/PutdriveCom.py +++ b/module/plugins/accounts/PutdriveCom.py @@ -6,7 +6,8 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Putdrive.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 16141d63e..42022ec82 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -2,13 +2,14 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class QuickshareCz(Account): __name__ = "QuickshareCz" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" + __status__ = "testing" __description__ = """Quickshare.cz account plugin""" __license__ = "GPLv3" @@ -18,26 +19,25 @@ class QuickshareCz(Account): TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' - def loadAccountInfo(self, user, req): - html = req.load("http://www.quickshare.cz/premium", decode=True) + def parse_info(self, user, password, data, req): + html = self.load("http://www.quickshare.cz/premium") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) premium = True if trafficleft else False else: trafficleft = None premium = False - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', - post={"akce": u'Přihlásit', - "heslo": data['password'], - "jmeno": user}, - decode=True) + def login(self, user, password, data, req): + html = self.load('http://www.quickshare.cz/html/prihlaseni_process.php', + post={'akce' : u'Přihlásit', + 'heslo': password, + 'jmeno': user}) if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 829e54a46..d713cedca 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -1,51 +1,52 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class RPNetBiz(Account): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.12" + __version__ = "0.15" + __status__ = "testing" __description__ = """RPNet.biz account plugin""" __license__ = "GPLv3" __authors__ = [("Dman", "dmanugm@gmail.com")] - def loadAccountInfo(self, user, req): - # Get account information from rpnet.biz - res = self.getAccountStatus(user, req) + def parse_info(self, user, password, data, req): + #: Get account information from rpnet.biz + res = self.get_account_status(user, password, req) try: if res['accountInfo']['isPremium']: - # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": float(res['accountInfo']['premiumExpiry']), - "trafficleft": -1, "premium": True} + #: Parse account info. Change the trafficleft later to support per host info. + account_info = {'validuntil': float(res['accountInfo']['premiumExpiry']), + 'trafficleft': -1, 'premium': True} else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} except KeyError: - #handle wrong password exception - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + #: Handle wrong password exception + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} return account_info - def login(self, user, data, req): - # Get account information from rpnet.biz - res = self.getAccountStatus(user, req) + def login(self, user, password, data, req): + #: Get account information from rpnet.biz + res = self.get_account_status(user, password, req) - # If we have an error in the res, we have wrong login information + #: If we have an error in the res, we have wrong login information if 'error' in res: - self.wrongPassword() + self.login_fail() - def getAccountStatus(self, user, req): - # Using the rpnet API, check if valid premium account - res = req.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": self.getAccountData(user)['password'], - "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % res) + def get_account_status(self, user, password, req): + #: Using the rpnet API, check if valid premium account + res = self.load("https://premium.rpnet.biz/client_api.php", + get={'username': user, 'password': password, + 'action': "showAccountInformation"}) + self.log_debug("JSON data: %s" % res) return json_loads(res) diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 3e9d52fe8..42d084bdb 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -4,77 +4,80 @@ import datetime import hashlib import time -from module.plugins.Account import Account -from module.common.json_layer import json_loads as loads +from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account class RapideoPl(Account): - __name__ = "RapideoPl" - __version__ = "0.01" - __type__ = "account" + __name__ = "RapideoPl" + __type__ = "account" + __version__ = "0.03" + __status__ = "testing" + __description__ = "Rapideo.pl account plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] - _api_url = "http://enc.rapideo.pl" - _api_query = { - "site": "newrd", - "username": "", - "password": "", - "output": "json", - "loc": "1", - "info": "1" - } + API_URL = "http://enc.rapideo.pl" + API_QUERY = {'site' : "newrd", + 'username': "" , + 'password': "" , + 'output' : "json" , + 'loc' : "1" , + 'info' : "1" } _req = None _usr = None _pwd = None - def loadAccountInfo(self, name, req): + + def parse_info(self, name, req): self._req = req try: - result = loads(self.runAuthQuery()) + result = json_loads(self.run_auth_query()) except Exception: - # todo: return or let it be thrown? + #@TODO: return or let it be thrown? return premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) - traffic_left = result["balance"] + traffic_left = result['balance'] - return ({ - "validuntil": valid_untill, - "trafficleft": traffic_left, - "premium": premium - }) + return {'validuntil' : valid_untill, + 'trafficleft': traffic_left, + 'premium' : premium } - def login(self, user, data, req): + + def login(self, user, password, data, req): self._usr = user - self._pwd = hashlib.md5(data["password"]).hexdigest() + self._pwd = hashlib.md5(password).hexdigest() self._req = req + try: - response = loads(self.runAuthQuery()) + response = json_loads(self.run_auth_query()) except Exception: - self.wrongPassword() + self.login_fail() if "errno" in response.keys(): - self.wrongPassword() + self.login_fail() + data['usr'] = self._usr data['pwd'] = self._pwd - def createAuthQuery(self): - query = self._api_query - query["username"] = self._usr - query["password"] = self._pwd + def create_auth_query(self): + query = self.API_QUERY + query['username'] = self._usr + query['password'] = self._pwd return query - def runAuthQuery(self): - data = self._req.load(self._api_url, post=self.createAuthQuery()) - return data
\ No newline at end of file + def run_auth_query(self): + return self.load(self.API_URL, + post=self.create_auth_query()) diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py index c0dd7eaee..069b30900 100644 --- a/module/plugins/accounts/RapidfileshareNet.py +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class RapidfileshareNet(XFSAccount): __name__ = "RapidfileshareNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" + __status__ = "testing" __description__ = """Rapidfileshare.net account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 23d7aff53..5ce51a1ec 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -1,13 +1,16 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +import urlparse + +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.09" + __version__ = "0.11" + __status__ = "testing" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" @@ -17,34 +20,35 @@ class RapidgatorNet(Account): API_URL = "http://rapidgator.net/api/user" - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = None premium = False sid = None try: - sid = self.getAccountData(user).get('sid') + sid = self.get_data(user).get('sid', None) assert sid - html = req.load("%s/info" % self.API_URL, get={'sid': sid}) + html = self.load(urlparse.urljoin(self.API_URL, "info"), + get={'sid': sid}) - self.logDebug("API:USERINFO", html) + self.log_debug("API:USERINFO", html) json = json_loads(html) if json['response_status'] == 200: if "reset_in" in json['response']: - self.scheduleRefresh(user, json['response']['reset_in']) + self.schedule_refresh(user, json['response']['reset_in']) validuntil = json['response']['expire_date'] trafficleft = float(json['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 premium = True else: - self.logError(json['response_details']) + self.log_error(json['response_details']) except Exception, e: - self.logError(e) + self.log_error(e) return {'validuntil' : validuntil, 'trafficleft': trafficleft, @@ -52,11 +56,13 @@ class RapidgatorNet(Account): 'sid' : sid} - def login(self, user, data, req): + def login(self, user, password, data, req): try: - html = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) + html = self.load(urlparse.urljoin(self.API_URL, "login"), + post={'username': user, + 'password': password}) - self.logDebug("API:LOGIN", html) + self.log_debug("API:LOGIN", html) json = json_loads(html) @@ -64,9 +70,9 @@ class RapidgatorNet(Account): data['sid'] = str(json['response']['session_id']) return else: - self.logError(json['response_details']) + self.log_error(json['response_details']) except Exception, e: - self.logError(e) + self.log_error(e) - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 70f47b673..1ec29bd77 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -3,14 +3,15 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class RapiduNet(Account): __name__ = "RapiduNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.07" + __status__ = "testing" __description__ = """Rapidu.net account plugin""" __license__ = "GPLv3" @@ -25,12 +26,12 @@ class RapiduNet(Account): TRAFFIC_LEFT_PATTERN = r'class="tipsyS"><b>(.+?)<' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = -1 premium = False - html = req.load("https://rapidu.net/", decode=True) + html = self.load("https://rapidu.net/") if re.search(self.PREMIUM_PATTERN, html): premium = True @@ -41,25 +42,25 @@ class RapiduNet(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - req.load("https://rapidu.net/ajax.php", - get={'a': "getChangeLang"}, - post={'_go' : "", - 'lang': "en"}) + def login(self, user, password, data, req): + self.load("https://rapidu.net/ajax.php", + get={'a': "getChangeLang"}, + post={'_go' : "", + 'lang': "en"}) - json = json_loads(req.load("https://rapidu.net/ajax.php", - get={'a': "getUserLogin"}, - post={'_go' : "", - 'login' : user, - 'pass' : data['password'], - 'remember': "1"})) + json = json_loads(self.load("https://rapidu.net/ajax.php", + get={'a': "getUserLogin"}, + post={'_go' : "", + 'login' : user, + 'pass' : password, + 'remember': "1"})) - self.logDebug(json) + self.log_debug(json) if not json['message'] == "success": - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py index 577a6c8f6..5f52ba147 100644 --- a/module/plugins/accounts/RarefileNet.py +++ b/module/plugins/accounts/RarefileNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class RarefileNet(XFSAccount): __name__ = "RarefileNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" + __status__ = "testing" __description__ = """RareFile.net account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 41d8a0975..718850c1a 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -2,39 +2,44 @@ import xml.dom.minidom as dom -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.45" + __version__ = "0.48" + __status__ = "testing" __description__ = """Real-Debrid.com account plugin""" __license__ = "GPLv3" __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): if self.pin_code: - return {"premium": False} - html = req.load("https://real-debrid.com/api/account.php") - xml = dom.parseString(html) - account_info = {"validuntil": float(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), - "trafficleft": -1} + return - return account_info + html = self.load("https://real-debrid.com/api/account.php") + xml = dom.parseString(html) + validuntil = float(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue) - def login(self, user, data, req): + return {'validuntil' : validuntil, + 'trafficleft': -1 , + 'premium' : True } + + + def login(self, user, password, data, req): self.pin_code = False - html = req.load("https://real-debrid.com/ajax/login.php", - get={"user": user, "pass": data['password']}, - decode=True) + + html = self.load("https://real-debrid.com/ajax/login.php", + get={'user': user, + 'pass': password}) if "Your login informations are incorrect" in html: - self.wrongPassword() + self.login_fail() elif "PIN Code required" in html: - self.logWarning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) + self.log_warning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) self.pin_code = True diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 04e71c9ad..36e5e33eb 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -1,40 +1,43 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.16" + __version__ = "0.18" + __status__ = "testing" __description__ = """Rehost.to account plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium = False trafficleft = None validuntil = -1 session = "" - html = req.load("http://rehost.to/api.php", - get={'cmd' : "login", 'user': user, - 'pass': self.getAccountData(user)['password']}) + html = self.load("https://rehost.to/api.php", + get={'cmd' : "login", + 'user': user, + 'pass': password}) try: session = html.split(",")[1].split("=")[1] - html = req.load("http://rehost.to/api.php", - get={'cmd': "get_premium_credits", 'long_ses': session}) + html = self.load("http://rehost.to/api.php", + get={'cmd' : "get_premium_credits", + 'long_ses': session}) if html.strip() == "0,0" or "ERROR" in html: - self.logDebug(html) + self.log_debug(html) else: traffic, valid = html.split(",") premium = True - trafficleft = self.parseTraffic(traffic + "MB") + trafficleft = self.parse_traffic(traffic + "MB") validuntil = float(valid) finally: @@ -44,11 +47,12 @@ class RehostTo(Account): 'session' : session} - def login(self, user, data, req): - html = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://rehost.to/api.php", + get={'cmd': "login", + 'user': user, + 'pass': password}) if "ERROR" in html: - self.logDebug(html) - self.wrongPassword() + self.log_debug(html) + self.login_fail() diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index 8c56ff20f..3ab907a76 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class RyushareCom(XFSAccount): __name__ = "RyushareCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" + __status__ = "testing" __description__ = """Ryushare.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py index 2e58d33b3..eb84d502f 100644 --- a/module/plugins/accounts/SafesharingEu.py +++ b/module/plugins/accounts/SafesharingEu.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class SafesharingEu(XFSAccount): __name__ = "SafesharingEu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Safesharing.eu account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py index b335c94da..a81030b67 100644 --- a/module/plugins/accounts/SecureUploadEu.py +++ b/module/plugins/accounts/SecureUploadEu.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class SecureUploadEu(XFSAccount): __name__ = "SecureUploadEu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """SecureUpload.eu account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py index 4fcbe0b7a..2875e0d46 100644 --- a/module/plugins/accounts/SendmywayCom.py +++ b/module/plugins/accounts/SendmywayCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class SendmywayCom(XFSAccount): __name__ = "SendmywayCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Sendmyway.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/SharebeastCom.py b/module/plugins/accounts/SharebeastCom.py new file mode 100644 index 000000000..a104a4a46 --- /dev/null +++ b/module/plugins/accounts/SharebeastCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class SharebeastCom(XFSAccount): + __name__ = "SharebeastCom" + __type__ = "account" + __version__ = "0.02" + __status__ = "testing" + + __description__ = """Sharebeast.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "sharebeast.com" diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 4214b4401..87bbc4632 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -2,54 +2,58 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.33" + __version__ = "0.39" + __status__ = "testing" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def api_response(self, user, req): - return req.load("http://api.share-online.biz/cgi-bin", + def api_response(self, user, password, req): + res = self.load("https://api.share-online.biz/cgi-bin", get={'q' : "userdetails", 'aux' : "traffic", 'username': user, - 'password': self.getAccountData(user)['password']}) + 'password': password}, + decode=False) + self.log_debug(res) - def loadAccountInfo(self, user, req): - premium = False - validuntil = None - trafficleft = -1 - maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB + api = dict(line.split("=") for line in res.splitlines() if "=" in line) + + if not 'a' in api: + self.login_fail(res.strip('*').strip()) - api = {} - for line in self.api_response(user, req).splitlines(): - if "=" in line: - key, value = line.split("=") - api[key] = value + if api['a'].lower() == "not_available": + self.login_fail(_("No info available")) - self.logDebug(api) + return api - if api['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", 'a', api['a']) - premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium") + def parse_info(self, user, password, data, req): + premium = False + validuntil = None + trafficleft = -1 + maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB - validuntil = float(api['expire_date']) + api = self.api_response(user, password, req) - traffic = float(api['traffic_1d'].split(";")[0]) + premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium") + validuntil = float(api['expire_date']) + traffic = float(api['traffic_1d'].split(";")[0]) - if maxtraffic > traffic: - trafficleft = maxtraffic - traffic - else: - trafficleft = -1 + if maxtraffic > traffic: + trafficleft = maxtraffic - traffic + else: + trafficleft = -1 maxtraffic /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 trafficleft /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -60,9 +64,6 @@ class ShareonlineBiz(Account): 'maxtraffic' : maxtraffic} - def login(self, user, data, req): - html = self.api_response(user, req) - err = re.search(r'\*\*(.+?)\*\*', html) - if err: - self.logError(err.group(1)) - self.wrongPassword() + def login(self, user, password, data, req): + api = self.api_response(user, password, req) + set_cookie(req.cj, "share-online.biz", 'a', api['a']) diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 8caf600f9..a5c69f51c 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,27 +1,29 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.08" + __status__ = "testing" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium = False validuntil = -1 trafficleft = None - json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') + json_data = self.load('http://www.simply-premium.com/api/user.php?format=json') - self.logDebug("JSON data: %s" % json_data) + self.log_debug("JSON data: %s" % json_data) json_data = json_loads(json_data) @@ -34,15 +36,14 @@ class SimplyPremiumCom(Account): if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} - def login(self, user, data, req): - req.cj.setCookie("simply-premium.com", "lang", "EN") + def login(self, user, password, data, req): + set_cookie(req.cj, "simply-premium.com", "lang", "EN") - html = req.load("http://www.simply-premium.com/login.php", - post={'key': user} if not data['password'] else {'login_name': user, 'login_pass': data['password']}, - decode=True) + html = self.load("https://www.simply-premium.com/login.php", + post={'key': user} if not password else {'login_name': user, 'login_pass': password}) if 'logout' not in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 24108eb0b..84c38227e 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -2,34 +2,36 @@ import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class SimplydebridCom(Account): __name__ = "SimplydebridCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.13" + __status__ = "testing" __description__ = """Simply-Debrid.com account plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def loadAccountInfo(self, user, req): - get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + def parse_info(self, user, password, data, req): + res = self.load("http://simply-debrid.com/api.php", + get={'login': 2, + 'u' : user, + 'p' : password}) data = [x.strip() for x in res.split(";")] if str(data[0]) != "1": - return {"premium": False} + return {'premium': False} else: - return {"trafficleft": -1, "validuntil": time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} + return {'trafficleft': -1, 'validuntil': time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} - def login(self, user, data, req): - self.loginname = user - self.password = data['password'] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - - res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + def login(self, user, password, data, req): + res = self.load("https://simply-debrid.com/api.php", + get={'login': 1, + 'u' : user, + 'p' : password}) if res != "02: loggin success": - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 1c303331b..9c2451794 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -20,37 +20,38 @@ except ImportError: return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from module.common.json_layer import json_loads -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class SmoozedCom(Account): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.07" + __status__ = "testing" __description__ = """Smoozed.com account plugin""" __license__ = "GPLv3" __authors__ = [("", "")] - def loadAccountInfo(self, user, req): - status = self.getAccountStatus(user, req) + def parse_info(self, user, password, data, req): + status = self.get_account_status(user, password, req) - self.logDebug(status) + self.log_debug(status) if status['state'] != 'ok': info = {'validuntil' : None, 'trafficleft': None, 'premium' : False} else: - # Parse account info - info = {'validuntil' : float(status["data"]["user"]["user_premium"]), - 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), - 'session' : status["data"]["session_key"], - 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + #: Parse account info + info = {'validuntil' : float(status['data']['user']['user_premium']), + 'trafficleft': max(0, status['data']['traffic'][1] - status['data']['traffic'][0]), + 'session' : status['data']['session_key'], + 'hosters' : [hoster['name'] for hoster in status['data']['hoster']]} if info['validuntil'] < time.time(): - if float(status["data"]["user"].get("user_trial", 0)) > time.time(): + if float(status['data']['user'].get("user_trial", 0)) > time.time(): info['premium'] = True else: info['premium'] = False @@ -60,19 +61,20 @@ class SmoozedCom(Account): return info - def login(self, user, data, req): - # Get user data from premiumize.me - status = self.getAccountStatus(user, req) + def login(self, user, password, data, req): + #: Get user data from premiumize.me + status = self.get_account_status(user, password, req) - # Check if user and password are valid + #: Check if user and password are valid if status['state'] != 'ok': - self.wrongPassword() + self.login_fail() - def getAccountStatus(self, user, req): - password = self.getAccountData(user)['password'] + def get_account_status(self, user, password, req): + password = password salt = hashlib.sha256(password).hexdigest() encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) - return json_loads(req.load("http://www2.smoozed.com/api/login", - get={'auth': user, 'password': encrypted})) + return json_loads(self.load("http://www2.smoozed.com/api/login", + get={'auth': user, + 'password': encrypted})) diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py deleted file mode 100644 index 882dbd2c3..000000000 --- a/module/plugins/accounts/StahnuTo.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.Account import Account - - -class StahnuTo(Account): - __name__ = "StahnuTo" - __type__ = "account" - __version__ = "0.05" - - __description__ = """StahnuTo account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.stahnu.to/") - - m = re.search(r'>VIP: (\d+.*)<', html) - trafficleft = self.parseTraffic(m.group(1)) if m else 0 - - return {"premium": trafficleft > 512, "trafficleft": trafficleft, "validuntil": -1} - - - def login(self, user, data, req): - html = req.load("http://www.stahnu.to/login.php", - post={"username": user, - "password": data['password'], - "submit": "Login"}, - decode=True) - - if not '<a href="logout.php">' in html: - self.wrongPassword() diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py index aa1eafcbd..9549896cc 100644 --- a/module/plugins/accounts/StreamcloudEu.py +++ b/module/plugins/accounts/StreamcloudEu.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class StreamcloudEu(XFSAccount): __name__ = "StreamcloudEu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Streamcloud.eu account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index 010fbc270..206e7874f 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -3,21 +3,23 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class TurbobitNet(Account): __name__ = "TurbobitNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.05" + __status__ = "testing" __description__ = """TurbobitNet account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def loadAccountInfo(self, user, req): - html = req.load("http://turbobit.net") + def parse_info(self, user, password, data, req): + html = self.load("http://turbobit.net") m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) if m: @@ -27,17 +29,16 @@ class TurbobitNet(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - def login(self, user, data, req): - req.cj.setCookie("turbobit.net", "user_lang", "en") + def login(self, user, password, data, req): + set_cookie(req.cj, "turbobit.net", "user_lang", "en") - html = req.load("http://turbobit.net/user/login", - post={"user[login]": user, - "user[pass]": data['password'], - "user[submit]": "Login"}, - decode=True) + html = self.load("http://turbobit.net/user/login", + post={"user[login]" : user, + "user[pass]" : password, + "user[submit]": "Login"}) if not '<div class="menu-item user-name">' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index d06ba0583..c549bbaf7 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -9,9 +9,10 @@ from module.plugins.internal.XFSAccount import XFSAccount class TusfilesNet(XFSAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" + __status__ = "testing" - __description__ = """ Tusfile.net account plugin """ + __description__ = """Tusfile.net account plugin""" __license__ = "GPLv3" __authors__ = [("guidobelix", "guidobelix@hotmail.it")] diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index f95c8834b..00e125dbc 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -3,13 +3,14 @@ import re import urlparse -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.10" + __version__ = "0.12" + __status__ = "testing" __description__ = """Uloz.to account plugin""" __license__ = "GPLv3" @@ -20,8 +21,8 @@ class UlozTo(Account): TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"' - def loadAccountInfo(self, user, req): - html = req.load("http://www.ulozto.net/", decode=True) + def parse_info(self, user, password, data, req): + html = self.load("http://www.ulozto.net/") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) @@ -31,19 +32,18 @@ class UlozTo(Account): return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True) + def login(self, user, password, data, req): + login_page = self.load('http://www.ulozto.net/?do=web-login') action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) - html = req.load(urlparse.urljoin("http://www.ulozto.net/", action), - post={'_token_' : token, - 'do' : "loginForm-submit", - 'login' : u"Přihlásit", - 'password': data['password'], - 'username': user, - 'remember': "on"}, - decode=True) + html = self.load(urlparse.urljoin("https://www.ulozto.net/", action), + post={'_token_' : token, + 'do' : "loginForm-submit", + 'login' : u"Přihlásit", + 'password': password, + 'username': user, + 'remember': "on"}) if '<div class="flash error">' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index 86ae5dd17..9c2649e51 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -1,20 +1,21 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class UploadableCh(Account): __name__ = "UploadableCh" __type__ = "account" - __version__ = "0.03" + __version__ = "0.05" + __status__ = "testing" __description__ = """Uploadable.ch account plugin""" __license__ = "GPLv3" __authors__ = [("Sasch", "gsasch@gmail.com")] - def loadAccountInfo(self, user, req): - html = req.load("http://www.uploadable.ch/login.php") + def parse_info(self, user, password, data, req): + html = self.load("http://www.uploadable.ch/login.php") premium = '<a href="/logout.php"' in html trafficleft = -1 if premium else None @@ -22,13 +23,12 @@ class UploadableCh(Account): return {'validuntil': None, 'trafficleft': trafficleft, 'premium': premium} #@TODO: validuntil - def login(self, user, data, req): - html = req.load("http://www.uploadable.ch/login.php", - post={'userName' : user, - 'userPassword' : data["password"], - 'autoLogin' : "1", - 'action__login': "normalLogin"}, - decode=True) + def login(self, user, password, data, req): + html = self.load("http://www.uploadable.ch/login.php", + post={'userName' : user, + 'userPassword' : password, + 'autoLogin' : "1", + 'action__login': "normalLogin"}) if "Login failed" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py index d1e1a2ead..5b834ac3b 100644 --- a/module/plugins/accounts/UploadcCom.py +++ b/module/plugins/accounts/UploadcCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class UploadcCom(XFSAccount): __name__ = "UploadcCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """Uploadc.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index d1556b6db..59d3fcff9 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -3,30 +3,33 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class UploadedTo(Account): __name__ = "UploadedTo" __type__ = "account" - __version__ = "0.30" + __version__ = "0.35" + __status__ = "testing" __description__ = """Uploaded.to account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - PREMIUM_PATTERN = r'<em>Premium</em>' - VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>(.+?)<' + COOKIES = False + + PREMIUM_PATTERN = r'<em>Premium</em>' + VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>(.+?)<' TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = None premium = None - html = req.load("http://uploaded.net/me") + html = self.load("http://uploaded.net/me") premium = True if re.search(self.PREMIUM_PATTERN, html) else False @@ -53,19 +56,20 @@ class UploadedTo(Account): trafficleft = float(size.replace(',', '.')) / 1024 trafficleft *= 1 << 40 else: - trafficleft = self.parseTraffic(size + unit) + trafficleft = self.parse_traffic(size + unit) return {'validuntil' : validuntil, 'trafficleft': trafficleft, 'premium' : premium} - def login(self, user, data, req): - # req.cj.setCookie("uploaded.net", "lang", "en") + def login(self, user, password, data, req): + self.load("http://uploaded.net/language/en") - html = req.load("http://uploaded.net/io/login", - post={'id': user, 'pw': data['password'], '_': ""}, - decode=True) + html = self.load("http://uploaded.net/io/login", + post={'id': user, + 'pw': password}) - if '"err"' in html: - self.wrongPassword() + m = re.search(r'"err":"(.+?)"', html) + if m is not None: + self.login_fail(m.group(1)) diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 714f5b0a6..f31b01d03 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -4,39 +4,40 @@ import re import datetime import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class UploadheroCom(Account): __name__ = "UploadheroCom" __type__ = "account" - __version__ = "0.21" + __version__ = "0.23" + __status__ = "testing" __description__ = """Uploadhero.co account plugin""" __license__ = "GPLv3" __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') - data = self.getAccountData(user) - html = req.load("http://uploadhero.co/my-account") + data = self.get_data(user) + html = self.load("http://uploadhero.co/my-account") if premium_pattern.search(html): end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(html).group(1))) end_date = time.mktime(future.timetuple()) - account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True} + account_info = {'validuntil': end_date, 'trafficleft': -1, 'premium': True} else: - account_info = {"validuntil": -1, "trafficleft": -1, "premium": False} + account_info = {'validuntil': -1, 'trafficleft': -1, 'premium': False} return account_info - def login(self, user, data, req): - html = req.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, "password_login": data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("http://uploadhero.co/lib/connexion.php", + post={'pseudo_login': user, + 'password_login': password}) if "mot de passe invalide" in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index a20c44535..d269abde7 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -3,14 +3,15 @@ import re import time -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import set_cookies +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.14" + __status__ = "testing" __description__ = """Uploading.com account plugin""" __license__ = "GPLv3" @@ -21,25 +22,25 @@ class UploadingCom(Account): VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = None premium = None - html = req.load("http://uploading.com/") + html = self.load("http://uploading.com/") premium = False if re.search(self.PREMIUM_PATTERN, html) else True m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) try: validuntil = time.mktime(time.strptime(expiredate, "%b %d, %Y")) except Exception, e: - self.logError(e) + self.log_error(e) else: if validuntil > time.mktime(time.gmtime()): @@ -53,13 +54,15 @@ class UploadingCom(Account): 'premium' : premium} - def login(self, user, data, req): + def login(self, user, password, data, req): set_cookies(req.cj, [("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.time() * 1000), - post={'email': user, 'password': data['password'], 'remember': "on"}) + self.load("http://uploading.com/") + self.load("https://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000), + post={'email' : user, + 'password': password, + 'remember': "on"}) diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index c40dbd6e6..68aaecc47 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): __name__ = "UptoboxCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" + __status__ = "testing" __description__ = """DDLStorage.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py index 5bfc24963..d543c5671 100644 --- a/module/plugins/accounts/VidPlayNet.py +++ b/module/plugins/accounts/VidPlayNet.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class VidPlayNet(XFSAccount): __name__ = "VidPlayNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" + __status__ = "testing" __description__ = """VidPlay.net account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index f032e2317..bbfb90a92 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -6,13 +6,14 @@ import time from passlib.hash import md5_crypt -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.07" + __version__ = "0.10" + __status__ = "testing" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" @@ -24,45 +25,42 @@ class WebshareCz(Account): TRAFFIC_LEFT_PATTERN = r'<bytes>(.+)</bytes>' - def loadAccountInfo(self, user, req): - html = req.load("https://webshare.cz/api/user_data/", - post={'wst': self.infos['wst']}, - decode=True) + def parse_info(self, user, password, data, req): + html = self.load("https://webshare.cz/api/user_data/", + post={'wst': self.get_data(user).get('wst', None)}) - self.logDebug("Response: " + html) + self.log_debug("Response: " + html) expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) - trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + trafficleft = self.parse_traffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) premium = validuntil > time.time() return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, data, req): - salt = req.load("https://webshare.cz/api/salt/", - post={'username_or_email': user, - 'wst' : ""}, - decode=True) + def login(self, user, password, data, req): + salt = self.load("https://webshare.cz/api/salt/", + post={'username_or_email': user, + 'wst' : ""}) if "<status>OK</status>" not in salt: - self.wrongPassword() + self.login_fail() salt = re.search('<salt>(.+)</salt>', salt).group(1) - password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() - login = req.load("https://webshare.cz/api/login/", - post={'digest' : digest, - 'keep_logged_in' : 1, - 'password' : password, - 'username_or_email': user, - 'wst' : ""}, - decode=True) + login = self.load("https://webshare.cz/api/login/", + post={'digest' : digest, + 'keep_logged_in' : 1, + 'password' : password, + 'username_or_email': user, + 'wst' : ""}) if "<status>OK</status>" not in login: - self.wrongPassword() + self.login_fail() - self.infos['wst'] = re.search('<token>(.+)</token>', login).group(1) + data['wst'] = re.search('<token>(.+)</token>', login).group(1) diff --git a/module/plugins/accounts/WorldbytezCom.py b/module/plugins/accounts/WorldbytezCom.py new file mode 100644 index 000000000..ea409fd58 --- /dev/null +++ b/module/plugins/accounts/WorldbytezCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class WorldbytezCom(XFSAccount): + __name__ = "WorldbytezCom" + __type__ = "account" + __version__ = "0.02" + __status__ = "testing" + + __description__ = """Worldbytez.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "worldbytez.com" diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py index 8dc7f3a30..f21247cf4 100644 --- a/module/plugins/accounts/XFileSharingPro.py +++ b/module/plugins/accounts/XFileSharingPro.py @@ -6,7 +6,8 @@ from module.plugins.internal.XFSAccount import XFSAccount class XFileSharingPro(XFSAccount): __name__ = "XFileSharingPro" __type__ = "account" - __version__ = "0.06" + __version__ = "0.09" + __status__ = "testing" __description__ = """XFileSharingPro multi-purpose account plugin""" __license__ = "GPLv3" @@ -16,19 +17,10 @@ class XFileSharingPro(XFSAccount): HOSTER_DOMAIN = None - def init(self): - if self.HOSTER_DOMAIN: - return super(XFileSharingPro, self).init() + def login(self, user, password, data, req): + try: + return super(XFileSharingPro, self).login(user, data, req) - - def loadAccountInfo(self, user, req): - return super(XFileSharingPro if self.HOSTER_DOMAIN else XFSAccount, self).loadAccountInfo(user, req) - - - def login(self, user, data, req): - if self.HOSTER_DOMAIN: - try: - return super(XFileSharingPro, self).login(user, data, req) - except Exception: - self.HOSTER_URL = self.HOSTER_URL.replace("www.", "") - return super(XFileSharingPro, self).login(user, data, req) + except Fail: + self.HOSTER_URL = self.HOSTER_URL.replace("www.", "") + return super(XFileSharingPro, self).login(user, data, req) diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 33602a2fe..c5dda0921 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -2,13 +2,14 @@ import re -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class YibaishiwuCom(Account): __name__ = "YibaishiwuCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.04" + __status__ = "testing" __description__ = """115.com account plugin""" __license__ = "GPLv3" @@ -18,23 +19,22 @@ class YibaishiwuCom(Account): ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://115.com/", decode=True) + def parse_info(self, user, password, data, req): + # self.relogin(user) + html = self.load("http://115.com/") m = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) premium = True if m and 'is_vip: 1' in m.group(1) else False validuntil = trafficleft = (-1 if m else 0) - return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + return dict({'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}) - def login(self, user, data, req): - html = req.load("http://passport.115.com/?ac=login", - post={"back": "http://www.115.com/", - "goto": "http://115.com/", - "login[account]": user, - "login[passwd]": data['password']}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://passport.115.com/?ac=login", + post={'back' : "http://www.115.com/", + 'goto' : "http://115.com/", + "login[account]": user, + "login[passwd]" : password}) if not 'var USER_PERMISSION = {' in html: - self.wrongPassword() + self.login_fail() diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 9bc6d0487..4138ba3cc 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -2,13 +2,14 @@ import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.26" + __version__ = "0.28" + __status__ = "testing" __description__ = """Zevera.com account plugin""" __license__ = "GPLv3" @@ -26,13 +27,13 @@ class ZeveraCom(Account): def init(self): if not self.HOSTER_DOMAIN: - self.logError(_("Missing HOSTER_DOMAIN")) + self.log_error(_("Missing HOSTER_DOMAIN")) if not hasattr(self, "API_URL"): self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = None premium = False @@ -47,12 +48,12 @@ class ZeveraCom(Account): return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): + def login(self, user, password, data, req): self.user = user - self.password = data['password'] + self.password = password if self.api_response(req) == "No trafic": - self.wrongPassword() + self.login_fail() def api_response(self, req, just_header=False, **kwargs): @@ -62,12 +63,11 @@ class ZeveraCom(Account): get_data.update(kwargs) - res = req.load(self.API_URL, - get=get_data, - just_header=just_header, - decode=True) + res = self.load(self.API_URL, + get=get_data, + just_header=just_header) - self.logDebug(res) + self.log_debug(res) if ':' in res: if not just_header: |