summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-03-09 15:34:47 +0100
committerGravatar Stefano <l.stickell@yahoo.it> 2013-03-09 15:34:47 +0100
commit0306438ab70e20433326fe3dd116915f56438edb (patch)
tree6fc53d5f92655085ba2336e34fb9cad79f29cf2b /module
parentupdated 9kw plugin (#27) (diff)
downloadpyload-0306438ab70e20433326fe3dd116915f56438edb.tar.xz
FshareVn: Bugfix. Fixed #29
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/FshareVn.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py
index e51009f50..20d27ea2e 100644
--- a/module/plugins/accounts/FshareVn.py
+++ b/module/plugins/accounts/FshareVn.py
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
-
+
@author: zoidberg
"""
@@ -24,12 +24,12 @@ import re
class FshareVn(Account):
__name__ = "FshareVn"
- __version__ = "0.02"
+ __version__ = "0.03"
__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>'
DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>'
@@ -37,23 +37,23 @@ class FshareVn(Account):
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}
-
+
def login(self, user, data, req):
- req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php")
-
+ req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php")
+
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 html:
self.wrongPassword()