summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RapiduNet.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 10:46:28 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-16 10:46:28 +0100
commitce1c2b6b05c08b669357947e61ae40efce7fc50f (patch)
tree0b5f7996960cf35c4eface53a89eba18a37519b7 /module/plugins/accounts/RapiduNet.py
parentFix filename case (diff)
downloadpyload-ce1c2b6b05c08b669357947e61ae40efce7fc50f.tar.xz
module temp
Diffstat (limited to 'module/plugins/accounts/RapiduNet.py')
-rw-r--r--module/plugins/accounts/RapiduNet.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py
new file mode 100644
index 000000000..2c6fe04f8
--- /dev/null
+++ b/module/plugins/accounts/RapiduNet.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.plugin.Account import Account
+from pyload.utils import json_loads
+
+
+class RapiduNet(Account):
+ __name__ = "RapiduNet"
+ __type__ = "account"
+ __version__ = "0.02"
+
+ __description__ = """Rapidu.net account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("prOq", "")]
+
+
+ PREMIUM_PATTERN = r'<a href="premium/" style="padding-left: 0px;">Account: <b>Premium</b></a>'
+
+
+ def loadAccountInfo(self, user, req):
+ info = {'validuntil': None, 'trafficleft': None, 'premium': False}
+
+ req.load("https://rapidu.net/ajax.php", get={'a': "getChangeLang"}, post={"_go": "", "lang": "en"})
+ html = req.load("https://rapidu.net/", decode=True)
+
+ if re.search(self.PREMIUM_PATTERN, html):
+ info['premium'] = True
+
+ return info
+
+
+ def login(self, user, data, req):
+ try:
+ 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()
+
+ except Exception, e:
+ self.logError(e)