diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-06 13:23:26 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-06 13:23:26 +0200 |
commit | ec72263da9135c57e628bbaad4aa570f3df02fe0 (patch) | |
tree | 9a2d7ae5cbf1e4b6421db05a9c22f5f44cacde14 | |
parent | [DevhostStFolder] Folder-in-folder support (diff) | |
download | pyload-ec72263da9135c57e628bbaad4aa570f3df02fe0.tar.xz |
[XFSPAccount] Improve patterns
-rw-r--r-- | module/plugins/internal/XFSPAccount.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/module/plugins/internal/XFSPAccount.py b/module/plugins/internal/XFSPAccount.py index b93fb5d30..434bf8d22 100644 --- a/module/plugins/internal/XFSPAccount.py +++ b/module/plugins/internal/XFSPAccount.py @@ -2,6 +2,7 @@ import re +from urlparse import urljoin from time import mktime, strptime from module.plugins.Account import Account @@ -12,25 +13,25 @@ from module.utils import parseFileSize class XFSPAccount(Account): __name__ = "XFSPAccount" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __description__ = """XFileSharingPro base account plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __author_name__ = ("zoidberg", "Walter Purcaro") + __author_mail__ = ("zoidberg@mujmail.cz", "vuolter@gmail.com") HOSTER_URL = None COOKIES = None #: or list of tuples [(domain, name, value)] - VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:</TD><TD><b>([^<]+)</b>' - TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><b>([^<]+)</b>' - LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|>Error<' + VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?<b>(.+?)</b>' + TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?<b>(.+?)</b>' + LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' PREMIUM_PATTERN = r'>Renew premium<' def loadAccountInfo(self, user, req): - html = req.load(self.HOSTER_URL + "?op=my_account", decode=True) + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) validuntil = trafficleft = None premium = True if re.search(self.PREMIUM_PATTERN, html) else False @@ -53,21 +54,22 @@ class XFSPAccount(Account): else: trafficleft = parseFileSize(trafficleft) / 1024 - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): set_cookies(req.cj, self.COOKIES) - html = req.load('%slogin.html' % self.HOSTER_URL, decode=True) + url = urljoin(self.HOSTER_URL, "login.html") + html = req.load(url, decode=True) action, inputs = parseHtmlForm('name="FL"', html) if not inputs: - inputs = {"op": "login", - "redirect": self.HOSTER_URL} + inputs = {'op': "login", + 'redirect': self.HOSTER_URL} - inputs.update({"login": user, - "password": data['password']}) + inputs.update({'login': user, + 'password': data['password']}) html = req.load(self.HOSTER_URL, post=inputs, decode=True) |