diff options
Diffstat (limited to 'module/plugins/accounts/Keep2ShareCc.py')
-rw-r--r-- | module/plugins/accounts/Keep2ShareCc.py | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index 9f28799a2..7ed15dc62 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -4,30 +4,29 @@ import re from time import gmtime, mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account -class Keep2ShareCc(Account): - __name__ = "Keep2ShareCc" +class Keep2shareCc(Account): + __name__ = "Keep2shareCc" __type__ = "account" - __version__ = "0.05" + __version__ = "0.02" - __description__ = """Keep2Share.cc account plugin""" + __description__ = """Keep2share.cc account plugin""" __license__ = "GPLv3" - __authors__ = [("aeronaut", "aeronaut@pianoguy.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] - VALID_UNTIL_PATTERN = r'Premium expires:\s*<b>(.+?)<' - TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):\s*<b><a href="/user/statistic.html">(.+?)<' + VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>' + TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):<b><a href="/user/statistic.html">(.+?)</a>' LOGIN_FAIL_PATTERN = r'Please fix the following input errors' def loadAccountInfo(self, user, req): validuntil = None - trafficleft = -1 - premium = False + trafficleft = None + premium = None html = req.load("http://keep2share.cc/site/profile.html", decode=True) @@ -36,26 +35,26 @@ class Keep2ShareCc(Account): expiredate = m.group(1).strip() self.logDebug("Expire date: " + expiredate) - if expiredate == "LifeTime": - premium = True - validuntil = -1 - else: - try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) + else: + if validuntil > mktime(gmtime()): + premium = True else: - premium = True if validuntil > mktime(gmtime()) else False + premium = False + validuntil = None - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - try: - trafficleft = self.parseTraffic(m.group(1)) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(m.group(1)) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} @@ -64,11 +63,7 @@ class Keep2ShareCc(Account): req.cj.setCookie("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) + post={'LoginForm[username]': user, 'LoginForm[password]': data['password']}) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() |