diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/FshareVn.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 20d27ea2e..9b22cbafb 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -24,27 +24,30 @@ import re class FshareVn(Account): __name__ = "FshareVn" - __version__ = "0.03" + __version__ = "0.04" __type__ = "account" __description__ = """fshare.vn account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' - TRAFFIC_LEFT_PATTERN = ur'<dt>Bandwidth Còn Lại</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>' + TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>' DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>' def loadAccountInfo(self, user, req): - #self.relogin(user) html = req.load("http://www.fshare.vn/account_info.php", decode = True) - found = re.search(self.VALID_UNTIL_PATTERN, html) - validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y')) if found else 0 - - found = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = float(found.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0 - - return {"validuntil": validuntil, "trafficleft": trafficleft} + if found: + premium = True + validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y')) + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + trafficleft = float(found.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0 + else: + premium = False + validuntil = None + trafficleft = None + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} def login(self, user, data, req): req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") |