diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/EasybytezCom.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 3b8517686..105c365b5 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -11,11 +11,11 @@ from module.utils import parseFileSize class EasybytezCom(Account): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """EasyBytez.com account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __author_name__ = ("zoidberg", "guidobelix") + __author_mail__ = ("zoidberg@mujmail.cz", "guidobelix@hotmail.it") VALID_UNTIL_PATTERN = r'Premium account expire:</TD><TD><b>([^<]+)</b>' TRAFFIC_LEFT_PATTERN = r'<TR><TD>Traffic available today:</TD><TD><b>(?P<S>[^<]+)</b>' @@ -24,30 +24,36 @@ class EasybytezCom(Account): def loadAccountInfo(self, user, req): html = req.load("http://www.easybytez.com/?op=my_account", decode=True) - validuntil = trafficleft = None + validuntil = -1 + trafficleft = None premium = False m = re.search(self.VALID_UNTIL_PATTERN, html) if m: try: - self.logDebug("Expire date: " + m.group(1)) - validuntil = mktime(strptime(m.group(1), "%d %B %Y")) + expiredate = m.group(1) + self.logDebug("Expire date: " + expiredate) + validuntil = mktime(strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) - if validuntil > mktime(gmtime()): - premium = True - trafficleft = -1 - else: - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = m.group(1) - if "Unlimited" in trafficleft: + else: + if validuntil > mktime(gmtime()): + premium = True trafficleft = -1 else: - trafficleft = parseFileSize(trafficleft) / 1024 + premium = False + + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + trafficleft = m.group(1) + if "Unlimited" in trafficleft: + trafficleft = -1 + else: + trafficleft = parseFileSize(trafficleft) / 1024 return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): html = req.load('http://www.easybytez.com/login.html', decode=True) action, inputs = parseHtmlForm('name="FL"', html) |