diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-07 13:15:05 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-07 13:15:05 +0200 |
commit | 7dee5afc46e69b38e1ad660b46db8427b64e961f (patch) | |
tree | 742137d4a95f89bb3bc0fb3bca20156d1f6edc9d /module/plugins | |
parent | [XFileSharingPro] Code cosmetics (diff) | |
download | pyload-7dee5afc46e69b38e1ad660b46db8427b64e961f.tar.xz |
[TusfilesNet] Now XFSPAccount plugin based
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/TusfilesNet.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index d7cdbaebb..3de98564c 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -4,26 +4,28 @@ import re from time import mktime, strptime, gmtime -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm +from module.plugins.internal.XFSPAccount import XFSPAccount from module.utils import parseFileSize -class TusfilesNet(Account): +class TusfilesNet(XFSPAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """ Tusfile.net account plugin """ __author_name__ = "guidobelix" __author_mail__ = "guidobelix@hotmail.it" + + HOSTER_URL = "http://www.tusfiles.net/" + VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>' TRAFFIC_LEFT_PATTERN = r'<td><img src="//www.tusfiles.net/i/icon/meter.png" alt=""/></td>\n<td> (?P<S>[^<]+)</td>' def loadAccountInfo(self, user, req): - html = req.load("http://www.tusfiles.net/?op=my_account", decode=True) + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) validuntil = None trafficleft = None @@ -54,16 +56,3 @@ class TusfilesNet(Account): trafficleft = parseFileSize(trafficleft) * 1024 return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - - - def login(self, user, data, req): - html = req.load("http://www.tusfiles.net/login.html", decode=True) - action, inputs = parseHtmlForm('name="FL"', html) - inputs.update({'login': user, - 'password': data['password'], - 'redirect': "http://www.tusfiles.net/"}) - - html = req.load("http://www.tusfiles.net/", post=inputs, decode=True) - - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() |