summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-06 03:30:39 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-06 03:30:39 +0100
commit8fdf56ba750f7bc513e87632cfa2f4415c9c67a5 (patch)
tree706fa42d6a6315d5b0d7adee1f6994e4876a7bf7 /module/plugins/internal
parent[KingfilesNet] fix download for free user (diff)
downloadpyload-8fdf56ba750f7bc513e87632cfa2f4415c9c67a5.tar.xz
[XFSAccount] Fix premium & validuntil detection
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/XFSAccount.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 6e34409ed..8a2242018 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.24"
+ __version__ = "0.25"
__description__ = """XFileSharing account plugin"""
__license__ = "GPLv3"
@@ -20,18 +20,13 @@ class XFSAccount(Account):
("Walter Purcaro", "vuolter@gmail.com")]
- """
- Following patterns should be defined by each hoster:
-
- PREMIUM_PATTERN: (optional) Checks if the account is premium
- example: PREMIUM_PATTERN = r'>Renew premium'
- """
-
HOSTER_DOMAIN = None
HOSTER_URL = None
COOKIES = [(HOSTER_DOMAIN, "lang", "english")]
+ PREMIUM_PATTERN = r'\(Premium only\)'
+
VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})'
TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?<b>\s*(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>'
@@ -60,8 +55,7 @@ class XFSAccount(Account):
html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True)
- if hasattr(self, "PREMIUM_PATTERN"):
- premium = True if re.search(self.PREMIUM_PATTERN, html) else False
+ premium = True if re.search(self.PREMIUM_PATTERN, html) else False
m = re.search(self.VALID_UNTIL_PATTERN, html)
if m:
@@ -76,9 +70,8 @@ class XFSAccount(Account):
if validuntil > mktime(gmtime()):
premium = True
else:
- if premium is False: #: registered account type (not premium)
- validuntil = -1
premium = False
+ validuntil = None #: registered account type (not premium)
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
if m:
@@ -88,8 +81,8 @@ class XFSAccount(Account):
if "nlimited" in size:
trafficleft = -1
- if premium is None:
- premium = True
+ if validuntil is None:
+ validuntil = -1
else:
if 'U' in traffic:
unit = traffic['U']
@@ -103,7 +96,7 @@ class XFSAccount(Account):
except Exception, e:
self.logError(str(e))
- return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False}
+ return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
def login(self, user, data, req):