diff options
author | 2015-08-09 00:50:54 +0200 | |
---|---|---|
committer | 2015-08-09 00:50:54 +0200 | |
commit | b0ef3f1673e1930916604bb1264ca3a38414bc8d (patch) | |
tree | c97936e4d2a4cd6eb1072c65c8a08a7d18816b18 /module/plugins/accounts/Keep2ShareCc.py | |
parent | [XFileSharingPro][XFileSharingProFolder] Added default __pattern__ (diff) | |
parent | Fix https://github.com/pyload/pyload/issues/1707 (diff) | |
download | pyload-b0ef3f1673e1930916604bb1264ca3a38414bc8d.tar.xz |
Merge pull request #1 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/accounts/Keep2ShareCc.py')
-rw-r--r-- | module/plugins/accounts/Keep2ShareCc.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index d2ba1d237..014d43a69 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -3,13 +3,15 @@ import re import time -from module.plugins.Account import Account +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class Keep2ShareCc(Account): __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.05" + __version__ = "0.08" + __status__ = "testing" __description__ = """Keep2Share.cc account plugin""" __license__ = "GPLv3" @@ -23,17 +25,17 @@ class Keep2ShareCc(Account): LOGIN_FAIL_PATTERN = r'Please fix the following input errors' - def loadAccountInfo(self, user, req): + def parse_info(self, user, password, data, req): validuntil = None trafficleft = -1 premium = False - html = req.load("http://keep2share.cc/site/profile.html", decode=True) + html = self.load("http://keep2share.cc/site/profile.html") m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) if expiredate == "LifeTime": premium = True @@ -43,7 +45,7 @@ class Keep2ShareCc(Account): validuntil = time.mktime(time.strptime(expiredate, "%Y.%m.%d")) except Exception, e: - self.logError(e) + self.log_error(e) else: premium = True if validuntil > time.mktime(time.gmtime()) else False @@ -51,23 +53,22 @@ class Keep2ShareCc(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: try: - trafficleft = self.parseTraffic(m.group(1)) + trafficleft = self.parse_traffic(m.group(1)) except Exception, e: - self.logError(e) + self.log_error(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - def login(self, user, data, req): - req.cj.setCookie("keep2share.cc", "lang", "en") + def login(self, user, password, data, req): + set_cookie(req.cj, "keep2share.cc", "lang", "en") - html = req.load("http://keep2share.cc/login.html", - post={'LoginForm[username]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : ""}, - decode=True) + html = self.load("https://keep2share.cc/login.html", + post={'LoginForm[username]' : user, + 'LoginForm[password]' : password, + 'LoginForm[rememberMe]': 1, + 'yt0' : ""}) if re.search(self.LOGIN_FAIL_PATTERN, html): - self.wrongPassword() + self.login_fail() |