From bd4ead18e025c6aff3d37b74cacae2731e738aa2 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 3 May 2014 22:24:38 +0200 Subject: File4safe premium + XFSPAccount improved Resolves #431 --- module/plugins/internal/XFSPAccount.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal/XFSPAccount.py') diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index 787e7fa9e..76aff54f0 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -26,7 +26,7 @@ from module.utils import parseFileSize class XFSPAccount(Account): __name__ = "XFSPAccount" - __version__ = "0.05" + __version__ = "0.06" __type__ = "account" __description__ = """XFileSharingPro base account plugin""" __author_name__ = "zoidberg" @@ -36,12 +36,14 @@ class XFSPAccount(Account): VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:([^<]+)' TRAFFIC_LEFT_PATTERN = r'>Traffic available today:([^<]+)' + LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|>Error<' + PREMIUM_PATTERN = r'>Renew premium<' def loadAccountInfo(self, user, req): html = req.load(self.MAIN_PAGE + "?op=my_account", decode=True) validuntil = trafficleft = None - premium = True if '>Renew premium<' in html else False + premium = True if re.search(self.PREMIUM_PATTERN, html) else False found = re.search(self.VALID_UNTIL_PATTERN, html) if found: @@ -61,7 +63,7 @@ class XFSPAccount(Account): else: trafficleft = parseFileSize(trafficleft) / 1024 - return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} def login(self, user, data, req): html = req.load('%slogin.html' % self.MAIN_PAGE, decode=True) @@ -76,5 +78,5 @@ class XFSPAccount(Account): html = req.load(self.MAIN_PAGE, post=inputs, decode=True) - if 'Incorrect Login or Password' in html or '>Error<' in html: + if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() -- cgit v1.2.3