diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-04 08:31:48 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-03-04 08:31:48 +0100 |
commit | f8fa74caeac0f824e2880a0c2a75340f048a6c2d (patch) | |
tree | a83cebcb75bf46ea618676f610ec388a917a5bcf /module/plugins/accounts/ShareonlineBiz.py | |
parent | closed #548 (diff) | |
download | pyload-f8fa74caeac0f824e2880a0c2a75340f048a6c2d.tar.xz |
Diffstat (limited to 'module/plugins/accounts/ShareonlineBiz.py')
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 426f5a6a9..70922b239 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -23,54 +23,34 @@ import re class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" - __version__ = "0.21" + __version__ = "0.22" __type__ = "account" __description__ = """share-online.biz account plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __author_name__ = ("mkaay", "zoidberg") + __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") - def getUserAPI(self, user, req): + info_threshold = 60 + + def loadAccountInfo(self, user, req): src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, self.accounts[user]["password"])) + info = {} for line in src.splitlines(): if "=" in line: key, value = line.split("=") info[key] = value - return info - - def loadAccountInfo(self, user, req): - try: - info = self.getUserAPI(user, req) - return {"validuntil": int(info["expire_date"]), "trafficleft": -1, "premium": not info["group"] == "Sammler"} - except: - pass - - #fallback - src = req.load("http://www.share-online.biz/members.php?setlang=en") - validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src) - if validuntil: - validuntil = int(mktime(strptime(validuntil.group(1), "%m/%d/%y"))) - else: - validuntil = -1 - - acctype = re.search(r'<td align="left" ><b>Your Package:</b></td>\s*<td align="left">\s*<b>(.*?)</b>\s*</td>', src) - if acctype: - if acctype.group(1) == "Collector account (free)": - premium = False - else: - premium = True - - tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - return tmp + + if "dl" in info and info["dl"].lower() != "not_available": + req.cj.setCookie("share-online.biz", "dl", info["dl"]) + if "a" in info and info["a"].lower() != "not_available": + req.cj.setCookie("share-online.biz", "a", info["a"]) + + return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, + "trafficleft": -1, + "premium": True if ("dl" in info or "a" in info) and (info["group"] == "Premium") else False} def login(self, user, data, req): - post_vars = { - "act": "login", - "location": "index.php", - "dieseid": "", - "user": user, - "pass": data["password"], - "login": "Login" - } req.lastURL = "http://www.share-online.biz/" - req.load("https://www.share-online.biz/login.php", cookies=True, post=post_vars) + req.load("https://www.share-online.biz/user/login", cookies=True, post={ + "user": user, + "pass": data["password"]}) |