From 36e60a23497ae05736c24fed2f4ce936fb61f744 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 23:31:33 +0100 Subject: "New Year" Update: account plugins --- module/plugins/accounts/NetloadIn.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/NetloadIn.py') diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 15bad6966..1abd7fa84 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class NetloadIn(Account): __name__ = "NetloadIn" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Netload.in account plugin""" __license__ = "GPLv3" @@ -33,8 +33,12 @@ class NetloadIn(Account): def login(self, user, data, req): - html = req.load("http://netload.in/index.php", None, - {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True) + html = req.load("http://netload.in/index.php", + post={"txtuser" : user, + "txtpass" : data['password'], + "txtcheck": "login", + "txtlogin": "Login"}, + cookies=True, + decode=True) if "password or it might be invalid!" in html: self.wrongPassword() -- cgit v1.2.3 From c4f167e267ba949ee20ec8a6d3c611d6dd93b325 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 20 Jan 2015 01:22:00 +0100 Subject: Fix plugin filename case --- module/plugins/accounts/NetloadIn.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 module/plugins/accounts/NetloadIn.py (limited to 'module/plugins/accounts/NetloadIn.py') diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py old mode 100755 new mode 100644 -- cgit v1.2.3 From 7beb65e991bc6d1913c3b5bb2ef69e659d5b8342 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:55:52 +0100 Subject: Spare code cosmetics --- module/plugins/accounts/NetloadIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/NetloadIn.py') diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 1abd7fa84..b86ace93b 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -38,7 +38,7 @@ class NetloadIn(Account): "txtpass" : data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True, decode=True) + if "password or it might be invalid!" in html: self.wrongPassword() -- cgit v1.2.3 From cdf209de3858276d2f91e2fb006574ea874e669a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 14 Mar 2015 01:03:44 +0100 Subject: [NetloadIn] Update account --- module/plugins/accounts/NetloadIn.py | 63 +++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'module/plugins/accounts/NetloadIn.py') diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index b86ace93b..066174a28 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from time import time +import time from module.plugins.Account import Account @@ -9,36 +9,55 @@ from module.plugins.Account import Account class NetloadIn(Account): __name__ = "NetloadIn" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Netload.in account plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("CryNickSystems", "webmaster@pcProfil.de")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def api_response(self, id, password, req): + return req.load("http://api.netload.in/user_info.php", + get={'auth' : "BVm96BWDSoB4WkfbEhn42HgnjIe1ilMt", + 'user_id' : id, + 'user_password': password}).strip() def loadAccountInfo(self, user, req): - html = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) - left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' - left = re.search(left, html) - if left: - validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 - trafficleft = -1 + validuntil = None + trafficleft = -1 + premium = False + + html = self.api_response(user, self.getAccountData(user)['password'], req) + + if html == "-1": premium = True + + elif html == "0": + validuntil = -1 + else: - validuntil = None - premium = False - trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + try: + validuntil = time.mktime(time.strptime(html, "%Y-%m-%d %H:%M")) + + except Exception, e: + self.logError(e) + + else: + self.logDebug("Valid until: %s" % validuntil) + + if validuntil > time.mktime(time.gmtime()): + premium = True + else: + validuntil = -1 + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): - html = req.load("http://netload.in/index.php", - post={"txtuser" : user, - "txtpass" : data['password'], - "txtcheck": "login", - "txtlogin": "Login"}, - decode=True) - - if "password or it might be invalid!" in html: + html = self.api_response(user, data['password'], req) + + if not html or re.search(r'disallowed_agent|unknown_auth|login_failed', html): self.wrongPassword() -- cgit v1.2.3 From 189f9e90d2814713e343ea340d6ada86fc217f3e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 27 May 2015 23:35:23 +0200 Subject: [NetloadIn] Mark dead (temp) --- module/plugins/accounts/NetloadIn.py | 63 ------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 module/plugins/accounts/NetloadIn.py (limited to 'module/plugins/accounts/NetloadIn.py') diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py deleted file mode 100644 index 066174a28..000000000 --- a/module/plugins/accounts/NetloadIn.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import time - -from module.plugins.Account import Account - - -class NetloadIn(Account): - __name__ = "NetloadIn" - __type__ = "account" - __version__ = "0.24" - - __description__ = """Netload.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - def api_response(self, id, password, req): - return req.load("http://api.netload.in/user_info.php", - get={'auth' : "BVm96BWDSoB4WkfbEhn42HgnjIe1ilMt", - 'user_id' : id, - 'user_password': password}).strip() - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = False - - html = self.api_response(user, self.getAccountData(user)['password'], req) - - if html == "-1": - premium = True - - elif html == "0": - validuntil = -1 - - else: - try: - validuntil = time.mktime(time.strptime(html, "%Y-%m-%d %H:%M")) - - except Exception, e: - self.logError(e) - - else: - self.logDebug("Valid until: %s" % validuntil) - - if validuntil > time.mktime(time.gmtime()): - premium = True - else: - validuntil = -1 - - return {'validuntil' : validuntil, - 'trafficleft': trafficleft, - 'premium' : premium} - - - def login(self, user, data, req): - html = self.api_response(user, data['password'], req) - - if not html or re.search(r'disallowed_agent|unknown_auth|login_failed', html): - self.wrongPassword() -- cgit v1.2.3