# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.Account import Account
class FshareVn(Account):
__name__ = "FshareVn"
__type__ = "account"
__version__ = "0.16"
__status__ = "testing"
__description__ = """Fshare.vn account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("stickell", "l.stickell@yahoo.it")]
VALID_UNTIL_PATTERN = ur'
Thời hạn dùng:\s*(.+?)'
LIFETIME_PATTERN = ur'Lần đăng nhập trước:\s*.+?'
TRAFFIC_LEFT_PATTERN = ur'Tổng Dung Lượng Tài Khoản\s*([\d.]+) ([kKMG])B'
DIRECT_DOWNLOAD_PATTERN = ur']*)[^>]*/>Kích hoạt download trực tiếp'
def grab_info(self, user, password, data):
html = self.load("http://www.fshare.vn/account_info.php")
if re.search(self.LIFETIME_PATTERN, html):
self.log_debug("Lifetime membership detected")
trafficleft = self.get_traffic_left()
return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': True}
m = re.search(self.VALID_UNTIL_PATTERN, html)
if m is not None:
premium = True
validuntil = time.mktime(time.strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y'))
trafficleft = self.get_traffic_left()
else:
premium = False
validuntil = None
trafficleft = None
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
def signin(self, user, password, data):
html = self.load("https://www.fshare.vn/login.php",
post={'LoginForm[email]' : user,
'LoginForm[password]' : password,
'LoginForm[rememberMe]': 1,
'yt0' : "Login"})
if not re.search(r'