summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/UnrestrictLi.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-06-22 21:25:27 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-06-22 21:25:27 +0200
commit19d10abe861dcb35d838f384a68b042f56490fcd (patch)
tree8c0cadd739f91d08ee6ede4cf9c6484db1e9ccc6 /module/plugins/accounts/UnrestrictLi.py
parentHotFolder: Rollback after (diff)
downloadpyload-19d10abe861dcb35d838f384a68b042f56490fcd.tar.xz
UnrestrictLi: account plugin revisited
Diffstat (limited to 'module/plugins/accounts/UnrestrictLi.py')
-rw-r--r--module/plugins/accounts/UnrestrictLi.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py
index d01f7cde8..9ec2ea996 100644
--- a/module/plugins/accounts/UnrestrictLi.py
+++ b/module/plugins/accounts/UnrestrictLi.py
@@ -21,27 +21,34 @@ from module.common.json_layer import json_loads
class UnrestrictLi(Account):
__name__ = "UnrestrictLi"
- __version__ = "0.01"
+ __version__ = "0.02"
__type__ = "account"
__description__ = """Unrestrict.li account plugin"""
__author_name__ = ("stickell")
__author_mail__ = ("l.stickell@yahoo.it")
def loadAccountInfo(self, user, req):
- if 'unrestrict_user' not in req.cj.cookies:
- self.login(user, self.getAccountData(user), req)
json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json')
self.logDebug("JSON data: " + json_data)
json_data = json_loads(json_data)
+ if 'vip' in json_data['result'] and json_data['result']['vip'] == 0:
+ return {"premium": False}
+
validuntil = json_data['result']['expires']
trafficleft = int(json_data['result']['traffic'] / 1024)
return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
def login(self, user, data, req):
+ html = req.load("https://unrestrict.li/sign_in")
+
+ if 'solvemedia' in html:
+ self.logError("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")
+ return
+
self.html = req.load("https://unrestrict.li/sign_in",
- post={"return": "",
- "username": user, "password": data["password"], "signin": "Sign+in"})
- if 'unrestrict_user' not in req.cj.cookies:
+ post={"username": user, "password": data["password"], "signin": "Sign in"})
+
+ if 'sign_out' not in self.html:
self.wrongPassword()