diff options
author | Stefano <l.stickell@yahoo.it> | 2014-05-04 15:47:11 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-05-04 15:47:11 +0200 |
commit | dd57d1155d5dd2a2dc36578b37a7ab4e49d0cec9 (patch) | |
tree | 22858f5b16cd9060d1bea1a50fa451b03f0f7423 /module/plugins/accounts | |
parent | File4safe premium (diff) | |
download | pyload-dd57d1155d5dd2a2dc36578b37a7ab4e49d0cec9.tar.xz |
New multihoster: Linksnappy
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/LinksnappyCom.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py new file mode 100644 index 000000000..4a8cd92c6 --- /dev/null +++ b/module/plugins/accounts/LinksnappyCom.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from hashlib import md5 + +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class LinksnappyCom(Account): + __name__ = "LinksnappyCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """Linksnappy.com account plugin""" + __author_name__ = "stickell" + __author_mail__ = "l.stickell@yahoo.it" + + def loadAccountInfo(self, user, req): + data = self.getAccountData(user) + r = req.load('http://gen.linksnappy.com/lseAPI.php', + get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + self.logDebug("JSON data: " + r) + j = json_loads(r) + + if j['error']: + return {"premium": False} + + validuntil = float(j['return']['expire']) + if validuntil == 'lifetime': + validuntil = -1 + + if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): + trafficleft = -1 + else: + trafficleft = int(j['return']['trafficleft']) * 1024 + + return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + + def login(self, user, data, req): + r = req.load('http://gen.linksnappy.com/lseAPI.php', + get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + + if 'Invalid Account Details' in r: + self.wrongPassword() |