diff options
| author | 2014-09-28 21:19:03 +0200 | |
|---|---|---|
| committer | 2014-09-28 21:19:03 +0200 | |
| commit | 46c6fc74a4e423927554f024b78dbbbf33e982cd (patch) | |
| tree | e7ff9580bb5e80b91e2bd9609409116a19c5941e /module/plugins/accounts | |
| parent | Api : Add brackets and pipe to urlmatcher (diff) | |
| parent | [XFileSharingPro] Fixed typo (diff) | |
| download | pyload-46c6fc74a4e423927554f024b78dbbbf33e982cd.tar.xz | |
Merge branch 'stable' into 0.4.10
Conflicts:
	pyload/plugins/crypter/MultiuploadCom.py
	pyload/plugins/crypter/SerienjunkiesOrg.py
	pyload/plugins/hooks/ExternalScripts.py
	pyload/plugins/hooks/ExtractArchive.py
	pyload/plugins/hooks/MergeFiles.py
	pyload/plugins/hoster/CatShareNet.py
	pyload/plugins/hoster/FilezyNet.py
	pyload/plugins/hoster/IFileWs.py
	pyload/plugins/hoster/PremiumTo.py
	pyload/plugins/hoster/SpeedyshareCom.py
	pyload/plugins/hoster/UptoboxCom.py
	pyload/plugins/hoster/XFileSharingPro.py
	pyload/plugins/hoster/ZippyshareCom.py
Diffstat (limited to 'module/plugins/accounts')
| -rw-r--r-- | module/plugins/accounts/TusfilesNet.py | 69 | 
1 files changed, 69 insertions, 0 deletions
| diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py new file mode 100644 index 000000000..d7cdbaebb --- /dev/null +++ b/module/plugins/accounts/TusfilesNet.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import re + +from time import mktime, strptime, gmtime + +from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm +from module.utils import parseFileSize + + +class TusfilesNet(Account): +    __name__ = "TusfilesNet" +    __type__ = "account" +    __version__ = "0.01" + +    __description__ = """ Tusfile.net account plugin """ +    __author_name__ = "guidobelix" +    __author_mail__ = "guidobelix@hotmail.it" + +    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) + +        validuntil = None +        trafficleft = None +        premium = False + +        m = re.search(self.VALID_UNTIL_PATTERN, html) +        if m: +            expiredate = m.group(1) +            self.logDebug("Expire date: " + expiredate) + +            try: +                validuntil = mktime(strptime(expiredate, "%d %B %Y")) +            except Exception, e: +                self.logError(e) + +            if validuntil > mktime(gmtime()): +                premium = True +            else: +                premium = False +                validuntil = None + +        m = re.search(self.TRAFFIC_LEFT_PATTERN, html) +        if m: +            trafficleft = m.group(1) +            if "Unlimited" in trafficleft: +                trafficleft = -1 +            else: +                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() | 
