diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-18 16:02:29 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-18 16:02:29 +0100 |
commit | fb65d5354c3cc80c3f48c3a2745b8dc01105edfd (patch) | |
tree | 822240f20e27f2d5edc3e10624fc622e7c26cdc6 | |
parent | [UploadedTo] Fix trafficleft recognition (diff) | |
download | pyload-fb65d5354c3cc80c3f48c3a2745b8dc01105edfd.tar.xz |
Update account plugins
34 files changed, 149 insertions, 132 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 1fb5e4b54..8fb841a39 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -23,8 +23,8 @@ class AlldebridCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/account/") - soup = BeautifulSoup(page) + html = req.load("http://www.alldebrid.com/account/") + soup = BeautifulSoup(html) #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 @@ -36,10 +36,10 @@ class AlldebridCom(Account): #Get expiration date from API except: data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/api.php", + html = req.load("http://www.alldebrid.com/api.php", get={'action': "info_user", 'login': user, 'pw': data['password']}) - self.logDebug(page) - xml = dom.parseString(page) + self.logDebug(html) + xml = dom.parseString(html) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info @@ -47,13 +47,13 @@ class AlldebridCom(Account): def login(self, user, data, req): urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) - page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) + html = req.load("http://www.alldebrid.com/register/?%s" % urlparams) - if "This login doesn't exist" in page: + if "This login doesn't exist" in html: self.wrongPassword() - if "The password is not valid" in page: + if "The password is not valid" in html: self.wrongPassword() - if "Invalid captcha" in page: + if "Invalid captcha" in html: self.wrongPassword() diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 8da3764ff..960ff6c3c 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -14,19 +14,20 @@ class BitshareCom(Account): def loadAccountInfo(self, user, req): - page = req.load("http://bitshare.com/mysettings.html") + html = req.load("http://bitshare.com/mysettings.html") - if "\"http://bitshare.com/myupgrade.html\">Free" in page: + if "\"http://bitshare.com/myupgrade.html\">Free" in html: return {"validuntil": -1, "trafficleft": -1, "premium": False} - if not '<input type="checkbox" name="directdownload" checked="checked" />' in page: + if not '<input type="checkbox" name="directdownload" checked="checked" />' in html: self.logWarning(_("Activate direct Download in your Bitshare Account")) return {"validuntil": -1, "trafficleft": -1, "premium": True} def login(self, user, data, req): - page = req.load("http://bitshare.com/login.html", + html = req.load("http://bitshare.com/login.html", post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) + if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 844ec9999..414883228 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -27,10 +27,9 @@ class CzshareCom(Account): if m is None: return {"validuntil": 0, "trafficleft": 0} else: - credits = float(m.group(1).replace(' ', '').replace(',', '.')) - credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[m.group(2)] - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) - return {"validuntil": validuntil, "trafficleft": credits} + trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)] + validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) + return {"validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index e9d4964cc..878153fbf 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class DebridItaliaCom(Account): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Debriditalia.com account plugin""" __license__ = "GPLv3" @@ -28,7 +28,7 @@ class DebridItaliaCom(Account): if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: - validuntil = int(mktime(strptime(m.group(1), "%d/%m/%Y %H:%M"))) + validuntil = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: self.logError(_("Unable to retrieve account information")) diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 1cfb96e84..ec23f7a51 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class DepositfilesCom(Account): __name__ = "DepositfilesCom" __type__ = "account" - __version__ = "0.30" + __version__ = "0.31" __description__ = """Depositfiles.com account plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class DepositfilesCom(Account): html = req.load("https://dfiles.eu/de/gold/") validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1) - validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) + validuntil = mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S")) return {"validuntil": validuntil, "trafficleft": -1} diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index ced49125a..d33d611c9 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -16,9 +16,9 @@ class FastixRu(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) + html = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) - points = page['points'] + points = html['points'] kb = float(points) * 1024 ** 2 / 1000 if points > 0: @@ -29,10 +29,10 @@ class FastixRu(Account): def login(self, user, data, req): - page = req.load("http://fastix.ru/api_v2/", + html = req.load("http://fastix.ru/api_v2/", get={'sub': "get_apikey", 'email': user, 'password': data['password']}) - api = json_loads(page) + api = json_loads(html) api = api['apikey'] data['api'] = api - if "error_code" in page: + if "error_code" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index c001d4513..d20f756f3 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" @@ -36,7 +36,7 @@ class FilecloudIo(Account): rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": int(rep['premium_until']), "trafficleft": -1} + return {"validuntil": float(rep['premium_until']), "trafficleft": -1} else: return {"premium": False} diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index cb913a27e..a845e7ba4 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" @@ -29,12 +29,14 @@ class FilerNet(Account): if re.search(self.FREE_PATTERN, html): return {"premium": False, "validuntil": None, "trafficleft": None} - until = re.search(self.WALID_UNTIL_PATTERN, html) + until = re.search(self.WALID_UNTIL_PATTERN, html) traffic = re.search(self.TRAFFIC_PATTERN, html) + if until and traffic: - validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) + 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} + else: self.logError(_("Unable to retrieve account information")) return {"premium": False, "validuntil": None, "trafficleft": None} diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index dcec22644..f91f4d5ba 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -20,9 +20,9 @@ class FilesMailRu(Account): def login(self, user, data, req): user, domain = user.split("@") - page = req.load("http://swa.mail.ru/cgi-bin/auth", None, + html = req.load("http://swa.mail.ru/cgi-bin/auth", None, {"Domain": domain, "Login": user, "Password": data['password'], "Page": "http://files.mail.ru/"}, cookies=True) - if "Неверное имя пользователя или пароль" in page: # @TODO seems not to work + if "Неверное имя пользователя или пароль" in html: # @TODO seems not to work self.wrongPassword() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 6f23f4b43..1cf2a3a3c 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -19,9 +19,9 @@ class FileserveCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], + html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) - res = json_loads(page) + res = json_loads(html) if res['type'] == "premium": validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) @@ -31,14 +31,14 @@ class FileserveCom(Account): def login(self, user, data, req): - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], + html = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) - res = json_loads(page) + res = json_loads(html) if not res['type']: self.wrongPassword() - #login at fileserv page + #login at fileserv html req.load("http://www.fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", "loginFormSubmit": "Login"}) diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 27e1e3a0a..576d835e2 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Freakshare.com account plugin""" __license__ = "GPLv3" @@ -18,26 +18,34 @@ class FreakshareCom(Account): def loadAccountInfo(self, user, req): - page = req.load("http://freakshare.com/") + premium = False + validuntil = None + trafficleft = None - validuntil = r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>' - validuntil = re.search(validuntil, page, re.M) - validuntil = validuntil.group(1).strip() - validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M")) + html = req.load("http://freakshare.com/") - traffic = r'Traffic verbleibend:</td>\s*<td>([^<]+)' - traffic = re.search(traffic, page, re.M) - traffic = traffic.group(1).strip() - traffic = self.parseTraffic(traffic) + try: + m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M) + validuntil = mktime(strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M")) - return {"validuntil": validuntil, "trafficleft": traffic} + except Exception: + pass + + try: + m = re.search(r'Traffic verbleibend:</td>\s*<td>([^<]+)', html, re.M) + trafficleft = self.parseTraffic(m.group(1)) + + except Exception: + pass + + return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): req.load("http://freakshare.com/index.php?language=EN") - page = req.load("http://freakshare.com/login.html", None, + html = req.load("http://freakshare.com/login.html", None, {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) - if ">Wrong Username or Password" in page: + if ">Wrong Username or Password" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index cfba1ba06..3b9841630 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """FreeWayMe account plugin""" __license__ = "GPLv3" @@ -22,11 +22,11 @@ class FreeWayMe(Account): account_info = {"validuntil": -1, "premium": False} if status['premium'] == "Free": - account_info['trafficleft'] = int(status['guthaben']) * 1024 + account_info['trafficleft'] = self.parseTraffic(status['guthaben'] + "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": - account_info = {"validuntil": int(status['Flatrate']), + account_info = {"validuntil": float(status['Flatrate']), "trafficleft": -1, "premium": True} diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index d1b05209c..2da45aac6 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __description__ = """Fshare.vn account plugin""" __license__ = "GPLv3" @@ -60,4 +60,4 @@ class FshareVn(Account): def getTrafficLeft(self): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - return float(m.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[m.group(2)] if m else 0 + return self.parseTraffic(m.group(1) + m.group(2)) if m else 0 diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 685740a5c..dff2fe394 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Hellshare.cz account plugin""" __license__ = "GPLv3" @@ -41,7 +41,7 @@ class HellshareCz(Account): trafficleft = -1 else: #Traffic-based account - trafficleft = int(credit) * 1024 + trafficleft = self.parseTraffic(credit + "MB") validuntil = -1 except Exception, e: self.logError(_("Unable to parse credit info"), e) diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 9fcdac9c7..19986157b 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" @@ -37,7 +37,7 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = int(j['return']['trafficleft']) * 1024 + trafficleft = self.parseTraffic(float(j['return']['trafficleft'] + "MB") return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 9eb0b50b2..878413007 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Multishare.cz account plugin""" __license__ = "GPLv3" @@ -24,7 +24,7 @@ class MultishareCz(Account): html = req.load("http://www.multishare.cz/profil/", decode=True) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = self.parseTraffic(m.group('S'), m.group('U')) if m else 0 + trafficleft = self.parseTraffic(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) diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 65bb33854..36923470e 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MyfastfileCom(Account): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Myfastfile.com account plugin""" __license__ = "GPLv3" @@ -18,7 +18,7 @@ class MyfastfileCom(Account): def loadAccountInfo(self, user, req): if 'days_left' in self.json_data: - validuntil = int(time() + self.json_data['days_left'] * 24 * 60 * 60) + validuntil = time() + self.json_data['days_left'] * 24 * 60 * 60 return {"premium": True, "validuntil": validuntil, "trafficleft": -1} else: self.logError(_("Unable to get account information")) diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 6565e6899..15bad6966 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -18,9 +18,9 @@ class NetloadIn(Account): def loadAccountInfo(self, user, req): - page = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) + html = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' - left = re.search(left, page) + left = re.search(left, html) if left: validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 trafficleft = -1 @@ -33,8 +33,8 @@ class NetloadIn(Account): def login(self, user, data, req): - page = req.load("http://netload.in/index.php", None, + html = req.load("http://netload.in/index.php", None, {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, cookies=True) - if "password or it might be invalid!" in page: + if "password or it might be invalid!" in html: self.wrongPassword() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 9bb45224c..4d90e1b25 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -11,7 +11,7 @@ from module.plugins.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.21" + __version__ = "0.22" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" @@ -42,19 +42,19 @@ class OboomCom(Account): if userData['premium_unix'] == "null": validUntil = -1 else: - validUntil = int(userData['premium_unix']) + validUntil = float(userData['premium_unix']) traffic = userData['traffic'] - trafficLeft = traffic['current'] - maxTraffic = traffic['max'] + 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'] return {'premium' : premium, 'validuntil' : validUntil, - 'trafficleft': trafficLeft / 1024, #@TODO: Remove / 1024 in 0.4.10 - 'maxtraffic' : maxTraffic / 1024, #@TODO: Remove / 1024 in 0.4.10 + 'trafficleft': trafficLeft, + 'maxtraffic' : maxTraffic, 'session' : session} diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 7df4c9aef..fb9732986 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -16,8 +16,8 @@ class OverLoadMe(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() - data = json_loads(page) + html = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() + data = json_loads(html) # Check for premium if data['membership'] == "Free": diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index c1a8c661a..efc64706b 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Premium.to account plugin""" __license__ = "GPLv3" @@ -18,9 +18,10 @@ class PremiumTo(Account): def loadAccountInfo(self, user, req): api_r = req.load("http://premium.to/api/straffic.php", get={'username': self.username, 'password': self.password}) - traffic = sum(map(int, api_r.split(';'))) - return {"trafficleft": int(traffic) / 1024, "validuntil": -1} #@TODO: Remove / 1024 in 0.4.10 + trafficleft = float(sum(map(int, api_r.split(';')))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} def login(self, user, data, req): diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 6603165e0..c1abde309 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -8,7 +8,7 @@ from module.common.json_layer import json_loads class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" @@ -22,7 +22,7 @@ class PremiumizeMe(Account): # Parse account info account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'])} + "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 if status['result']['type'] == 'free': account_info['premium'] = False diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 8bd358084..813453c03 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """RPNet.biz account plugin""" __license__ = "GPLv3" @@ -20,7 +20,7 @@ class RPNetBiz(Account): try: if res['accountInfo']['isPremium']: # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(res['accountInfo']['premiumExpiry']), + account_info = {"validuntil": float(res['accountInfo']['premiumExpiry']), "trafficleft": -1, "premium": True} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 9a0edbfa4..2899d5a68 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" @@ -31,7 +31,7 @@ class RapidgatorNet(Account): self.scheduleRefresh(user, json['response']['reset_in']) return {"validuntil": json['response']['expire_date'], - "trafficleft": int(json['response']['traffic_left']), + "trafficleft": float(json['response']['traffic_left']) / 1024, #@TODO: Remove `/ 1024` in 0.4.10 "premium": True} else: self.logError(json['response_details']) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index eeba34665..48b17df5f 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.43" + __version__ = "0.44" __description__ = """Real-Debrid.com account plugin""" __license__ = "GPLv3" @@ -18,9 +18,9 @@ class RealdebridCom(Account): def loadAccountInfo(self, user, req): if self.pin_code: return {"premium": False} - page = req.load("https://real-debrid.com/api/account.php") - xml = dom.parseString(page) - account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), + 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 account_info @@ -28,9 +28,9 @@ class RealdebridCom(Account): def login(self, user, data, req): self.pin_code = False - page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) - if "Your login informations are incorrect" in page: + html = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) + if "Your login informations are incorrect" in html: self.wrongPassword() - elif "PIN Code required" in page: + 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.pin_code = True diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index eec7d8731..00a45dedd 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Rehost.to account plugin""" __license__ = "GPLv3" @@ -15,27 +15,31 @@ class RehostTo(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://rehost.to/api.php", + html = req.load("http://rehost.to/api.php", get={'cmd': "login", 'user': user, 'pass': data['password']}) - data = [x.split("=") for x in page.split(",")] + data = [x.split("=") for x in html.split(",")] ses = data[0][1] long_ses = data[1][1] - page = req.load("http://rehost.to/api.php", + html = req.load("http://rehost.to/api.php", get={'cmd': "get_premium_credits", 'long_ses': long_ses}) - traffic, valid = page.split(",") - account_info = {"trafficleft": int(traffic) * 1024, - "validuntil": int(valid), - "long_ses": long_ses, - "ses": ses} + traffic, valid = html.split(",") + + trafficleft = self.parseTraffic(traffic + "MB") + validuntil = float(valid) + + account_info = {"trafficleft": trafficleft, + "validuntil" : validuntil, + "long_ses" : long_ses, + "ses" : ses} return account_info def login(self, user, data, req): - page = req.load("http://rehost.to/api.php", + html = req.load("http://rehost.to/api.php", get={'cmd': "login", 'user': user, 'pass': data['password']}) - if "Login failed." in page: + if "Login failed." in html: self.wrongPassword() diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 976d2ff14..596be9b7c 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.24" + __version__ = "0.25" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" @@ -34,7 +34,7 @@ class ShareonlineBiz(Account): if "a" in info and info['a'].lower() != "not_available": req.cj.setCookie("share-online.biz", "a", info['a']) - return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, + return {"validuntil": float(info['expire_date']) if "expire_date" in info else -1, "trafficleft": -1, "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 979ce73aa..465757457 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -15,6 +15,9 @@ class SimplyPremiumCom(Account): def loadAccountInfo(self, user, req): + validuntil = -1 + trafficleft = None + json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') self.logDebug("JSON data: " + json_data) json_data = json_loads(json_data) @@ -22,14 +25,13 @@ class SimplyPremiumCom(Account): if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: return {"premium": False} - #Time package - validuntil = float(json_data['result']['timeend']) - #Traffic package - # {"trafficleft": int(traffic), "validuntil": -1} - #trafficleft = int(json_data['result']['traffic']) + if 'timeend' in json_data['result'] and json_data['result']['timeend']: + validuntil = float(json_data['result']['timeend']) + + if 'traffic' in json_data['result'] and json_data['result']['traffic']: + trafficleft = float(json_data['result']['traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - return {"premium": True, "validuntil": validuntil} + return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index 44884f835..2b08c67cd 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class StahnuTo(Account): __name__ = "StahnuTo" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """StahnuTo account plugin""" __license__ = "GPLv3" @@ -19,9 +19,9 @@ class StahnuTo(Account): html = req.load("http://www.stahnu.to/") m = re.search(r'>VIP: (\d+.*)<', html) - trafficleft = self.parseTraffic(m.group(1)) * 1024 if m else 0 + trafficleft = self.parseTraffic(m.group(1)) if m else 0 - return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1} + return {"premium": trafficleft > 512, "trafficleft": trafficleft, "validuntil": -1} def login(self, user, data, req): diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 63adb6aa8..53cf54e7d 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __description__ = """Uloz.to account plugin""" __license__ = "GPLv3" @@ -29,7 +29,7 @@ class UlozTo(Account): req.cj.setCookie("ulozto.net", "ULOSESSID", self.phpsessid) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = int(float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048) if m else 0 + trafficleft = float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048 if m else 0 self.premium = True if trafficleft else False return {"validuntil": -1, "trafficleft": trafficleft} diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index e43d6bbd7..f5db3f888 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class UnrestrictLi(Account): __name__ = "UnrestrictLi" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Unrestrict.li account plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class UnrestrictLi(Account): return {"premium": False} validuntil = json_data['result']['expires'] - trafficleft = int(json_data['result']['traffic']) + trafficleft = float(json_data['result']['traffic'] / 1024) #@TODO: Remove `/ 1024` in 0.4.10 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 947ac2b9e..c09726799 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class UploadedTo(Account): __name__ = "UploadedTo" __type__ = "account" - __version__ = "0.28" + __version__ = "0.29" __description__ = """Uploaded.to account plugin""" __license__ = "GPLv3" @@ -41,7 +41,7 @@ class UploadedTo(Account): if m: validuntil = time() for n, u in m: - validuntil += int(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u] + validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u] m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: @@ -61,8 +61,8 @@ class UploadedTo(Account): def login(self, user, data, req): req.cj.setCookie("uploaded.net", "lang", "en") - page = req.load("http://uploaded.net/io/login", + html = req.load("http://uploaded.net/io/login", post={'id': user, 'pw': data['password'], '_': ""}) - if "User and password do not match" in page: + if "User and password do not match" in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 63d823e69..1e30b3771 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -21,10 +21,10 @@ class UploadheroCom(Account): premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') data = self.getAccountData(user) - page = req.load("http://uploadhero.co/my-account") + html = req.load("http://uploadhero.co/my-account") - if premium_pattern.search(page): - end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1))) + 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} else: @@ -34,8 +34,8 @@ class UploadheroCom(Account): def login(self, user, data, req): - page = req.load("http://uploadhero.co/lib/connexion.php", + html = req.load("http://uploadhero.co/lib/connexion.php", post={"pseudo_login": user, "password_login": data['password']}) - if "mot de passe invalide" in page: + if "mot de passe invalide" in html: self.wrongPassword() diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index dbec6984d..e8e3431e3 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.21" + __version__ = "0.22" __description__ = """Zevera.com account plugin""" __license__ = "GPLv3" @@ -21,7 +21,7 @@ class ZeveraCom(Account): account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} else: account_info = { - "trafficleft": int(data['availabletodaytraffic']) * 1024, + "trafficleft": float(data['availabletodaytraffic']) * 1024, "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), "premium": True } |