diff options
author | Stefano <l.stickell@yahoo.it> | 2013-12-13 14:38:02 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-12-16 17:06:15 +0100 |
commit | 443d79d862576b62715ccad5bd7436fd72065842 (patch) | |
tree | e7c58bdbe434e997f2f89a4dbf4bc39e5cb4149c | |
parent | Easybytez: fixed expire date parse (diff) | |
download | pyload-443d79d862576b62715ccad5bd7436fd72065842.tar.xz |
FshareVn: fixed lifetime account detect
See #417
(cherry picked from commit 06991b8ed262009f70d6baac81d7845ac60714c7)
-rw-r--r-- | pyload/plugins/accounts/FshareVn.py | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/pyload/plugins/accounts/FshareVn.py b/pyload/plugins/accounts/FshareVn.py index 11abfa463..0d49b137d 100644 --- a/pyload/plugins/accounts/FshareVn.py +++ b/pyload/plugins/accounts/FshareVn.py @@ -26,25 +26,30 @@ from module.plugins.Account import Account class FshareVn(Account): __name__ = "FshareVn" - __version__ = "0.05" + __version__ = "0.06" __type__ = "account" __description__ = """fshare.vn account plugin""" __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") - VALID_UNTIL_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>([^<]+)</dd>' + VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' + LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>[^<]+</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): - html = req.load("http://www.fshare.vn/account_info.php", decode=True) - found = re.search(self.VALID_UNTIL_PATTERN, html) + self.html = req.load("http://www.fshare.vn/account_info.php", decode=True) + + if re.search(self.LIFETIME_PATTERN, self.html): + self.logDebug("Lifetime membership detected") + trafficleft = self.getTrafficLeft() + return {"validuntil": -1, "trafficleft": trafficleft, "premium": True} + + found = re.search(self.VALID_UNTIL_PATTERN, self.html) if found: premium = True - validuntil = mktime(strptime(found.group(1), '%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 + validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y')) + trafficleft = self.getTrafficLeft() else: premium = False validuntil = None @@ -55,11 +60,15 @@ class FshareVn(Account): def login(self, user, data, req): req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - html = req.load('https://www.fshare.vn/login.php', post={ + self.html = req.load('https://www.fshare.vn/login.php', post={ "login_password": data['password'], "login_useremail": user, "url_refe": "https://www.fshare.vn/login.php" }, referer=True, decode=True) - if not '<img alt="VIP"' in html: + if not '<img alt="VIP"' in self.html: self.wrongPassword() + + def getTrafficLeft(self): + found = re.search(self.TRAFFIC_LEFT_PATTERN, self.html) + return float(found.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0 |