summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-10 19:28:37 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-11 02:52:06 +0100
commit933323bddb64a6739eec8182100baab09e09be57 (patch)
tree0a7c5fbd5c2e7be98d9e4c2bd73b1445d035504a
parent[CaptchaService] New service AdYouLike + AdsCaptcha detect_key fixup (diff)
downloadpyload-933323bddb64a6739eec8182100baab09e09be57.tar.xz
[RapiduNet] Improve account plugin
Conflicts: module/plugins/accounts/RapiduNet.py
-rw-r--r--module/plugins/accounts/RapiduNet.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py
index 2fabb6120..fe465bc48 100644
--- a/module/plugins/accounts/RapiduNet.py
+++ b/module/plugins/accounts/RapiduNet.py
@@ -6,40 +6,42 @@ from module.common.json_layer import json_loads
class RapiduNet(Account):
- __name__ = "RapiduNet"
- __type__ = "account"
- __version__ = "0.01"
+ __name__ = "RapiduNet"
+ __type__ = "account"
+ __version__ = "0.02"
__description__ = """Rapidu.net account plugin"""
- __license__ = "GPLv3"
- __authors__ = [("prOq", None)]
+ __license__ = "GPLv3"
+ __authors__ = [("prOq", None)]
- ACCOUNT_INFO_PATTERN = '<a href="premium/" style="padding-left: 0px;">Account: <b>(.*?)</b></a>'
+ PREMIUM_PATTERN = r'<a href="premium/" style="padding-left: 0px;">Account: <b>Premium</b></a>'
def loadAccountInfo(self, user, req):
- premium = False
+ info = {'validuntil': None, 'trafficleft': None, 'premium': False}
- req.load('https://rapidu.net/ajax.php?a=getChangeLang', post={"_go": "", "lang": "en"})
- self.html = req.load('https://rapidu.net/', decode=True)
+ req.load("https://rapidu.net/ajax.php", get={'a': "getChangeLang"}, post={"_go": "", "lang": "en"})
+ html = req.load("https://rapidu.net/", decode=True)
- m = re.search(self.ACCOUNT_INFO_PATTERN, self.html)
- if m:
- if m.group(1) == "Premium":
- premium = True
+ if re.search(self.PREMIUM_PATTERN, html):
+ info['premium'] = True
- return {"validuntil": None, "trafficleft": None, "premium": premium}
+ return info
def login(self, user, data, req):
try:
- json = req.load('https://rapidu.net/ajax.php?a=getUserLogin', post={"_go": "", "login": user, "pass": data['password'], "member": "1"})
- json = json_loads(json)
+ json = json_loads(req.load("https://rapidu.net/ajax.php?a=getUserLogin",
+ post={'_go': "",
+ 'login': user,
+ 'pass': data['password'],
+ 'member': "1"}))
+
self.logDebug(json)
if not json['message'] == "success":
- self.wrongPassword()
+ self.wrongPassword()
+
except Exception, e:
self.logError(e)
-