From df143e902d00903f16cf32174948f636bda56e4c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 8 Jan 2015 22:58:32 +0100 Subject: "New Year" Update: internal plugins --- module/plugins/internal/XFSAccount.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 2784ecd0b..263d78ff8 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.33" + __version__ = "0.34" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -35,7 +35,7 @@ class XFSAccount(Account): LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:.*?(?P[\d.,]+|[Uu]nlimited)\s*(?:(?P[\w^_]+)\s*)?' LEECH_TRAFFIC_UNIT = "MB" #: used only if no group was found - LOGIN_FAIL_PATTERN = r'>\s*(Incorrect Login or Password|Error<)' + LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 @@ -76,10 +76,10 @@ class XFSAccount(Account): self.logDebug("Valid until: %s" % validuntil) if validuntil > mktime(gmtime()): - premium = True + premium = True trafficleft = -1 else: - premium = False + premium = False validuntil = None #: registered account type (not premium) else: self.logDebug("VALID_UNTIL_PATTERN not found") -- cgit v1.2.3 From 502c1437e838282aa56a286bb3751382c3aaf65e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 16:01:38 +0100 Subject: Improve getInfo --- module/plugins/internal/XFSAccount.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 263d78ff8..a767a878f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -143,7 +143,7 @@ class XFSAccount(Account): if isinstance(self.COOKIES, list): set_cookies(req.cj, self.COOKIES) - url = urljoin(self.HOSTER_URL, "login.html") + url = urljoin(self.HOSTER_URL, "login.html") html = req.load(url, decode=True) action, inputs = parseHtmlForm('name="FL"', html) -- cgit v1.2.3 From aac6063859b9036612e86fb4029dc010d5c5d1e0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 19:53:09 +0100 Subject: Code cosmetics --- module/plugins/internal/XFSAccount.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index a767a878f..c350729ac 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.34" + __version__ = "0.35" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -48,7 +48,7 @@ class XFSAccount(Account): self.logError(_("Missing HOSTER_DOMAIN")) if not self.HOSTER_URL: - self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN or "" + self.HOSTER_URL = "http://www.%s/" % (self.HOSTER_DOMAIN or "") def loadAccountInfo(self, user, req): -- cgit v1.2.3 From 830e36874a123d8513211c82ad7e03c30235ca44 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 19 Jan 2015 01:17:59 +0100 Subject: Fix COOKIES in XFS internal plugins --- module/plugins/internal/XFSAccount.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index c350729ac..c3bd91e52 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -23,7 +23,7 @@ class XFSAccount(Account): HOSTER_DOMAIN = None HOSTER_URL = None - COOKIES = [(HOSTER_DOMAIN, "lang", "english")] + COOKIES = True PREMIUM_PATTERN = r'\(Premium only\)' @@ -46,9 +46,15 @@ class XFSAccount(Account): def init(self): if not self.HOSTER_DOMAIN: self.logError(_("Missing HOSTER_DOMAIN")) + self.COOKIES = False - if not self.HOSTER_URL: - self.HOSTER_URL = "http://www.%s/" % (self.HOSTER_DOMAIN or "") + else: + if not self.HOSTER_URL: + self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN + + if isinstance(self.COOKIES, list): + self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english")) + set_cookies(req.cj, self.COOKIES) def loadAccountInfo(self, user, req): @@ -57,6 +63,12 @@ class XFSAccount(Account): leechtraffic = None premium = None + if not self.HOSTER_URL: #@TODO: Remove in 0.4.10 + return {'validuntil' : validuntil, + 'trafficleft' : trafficleft, + 'leechtraffic': leechtraffic, + 'premium' : premium} + html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) premium = True if re.search(self.PREMIUM_PATTERN, html) else False @@ -136,22 +148,25 @@ class XFSAccount(Account): else: self.logDebug("LEECH_TRAFFIC_PATTERN not found") - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'leechtraffic': leechtraffic, 'premium': premium} + return {'validuntil' : validuntil, + 'trafficleft' : trafficleft, + 'leechtraffic': leechtraffic, + 'premium' : premium} def login(self, user, data, req): - if isinstance(self.COOKIES, list): - set_cookies(req.cj, self.COOKIES) + if not self.HOSTER_URL: #@TODO: Remove in 0.4.10 + raise Exception(_("Missing HOSTER_DOMAIN")) 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", + inputs = {'op' : "login", 'redirect': self.HOSTER_URL} - inputs.update({'login': user, + inputs.update({'login' : user, 'password': data['password']}) html = req.load(self.HOSTER_URL, post=inputs, decode=True) -- cgit v1.2.3 From c02543ecc3436972b5d34325787c41a5c2884dd5 Mon Sep 17 00:00:00 2001 From: stickell Date: Sun, 8 Feb 2015 14:28:31 +0100 Subject: [UptoboxCom] Fixed login Fixes #1047 --- module/plugins/internal/XFSAccount.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index c3bd91e52..845ea3230 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.35" + __version__ = "0.36" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -22,6 +22,7 @@ class XFSAccount(Account): HOSTER_DOMAIN = None HOSTER_URL = None + LOGIN_URL = None COOKIES = True @@ -158,8 +159,9 @@ class XFSAccount(Account): if not self.HOSTER_URL: #@TODO: Remove in 0.4.10 raise Exception(_("Missing HOSTER_DOMAIN")) - url = urljoin(self.HOSTER_URL, "login.html") - html = req.load(url, decode=True) + if not self.LOGIN_URL: + self.LOGIN_URL = urljoin(self.HOSTER_URL, "login.html") + html = req.load(self.LOGIN_URL, decode=True) action, inputs = parseHtmlForm('name="FL"', html) if not inputs: @@ -169,7 +171,9 @@ class XFSAccount(Account): inputs.update({'login' : user, 'password': data['password']}) - html = req.load(self.HOSTER_URL, post=inputs, decode=True) + if not action: + action = self.HOSTER_URL + html = req.load(action, post=inputs, decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() -- cgit v1.2.3 From 7beb65e991bc6d1913c3b5bb2ef69e659d5b8342 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:55:52 +0100 Subject: Spare code cosmetics --- module/plugins/internal/XFSAccount.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 845ea3230..9315fb68f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -16,8 +16,8 @@ class XFSAccount(Account): __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] HOSTER_DOMAIN = None -- cgit v1.2.3 From e65d19ee3a1e435bf2896ed829e5581eeef92dd2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 14 Mar 2015 11:07:54 +0100 Subject: Import cleanup for datetime and time modules --- module/plugins/internal/XFSAccount.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 9315fb68f..31d1b7e2f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import gmtime, mktime, strptime from urlparse import urljoin from module.plugins.Account import Account @@ -80,7 +80,7 @@ class XFSAccount(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%d %B %Y")) + validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) @@ -88,7 +88,7 @@ class XFSAccount(Account): else: self.logDebug("Valid until: %s" % validuntil) - if validuntil > mktime(gmtime()): + if validuntil > time.mktime(time.gmtime()): premium = True trafficleft = -1 else: -- cgit v1.2.3 From 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 May 2015 01:06:01 +0200 Subject: Use 'import' instead 'from' --- module/plugins/internal/XFSAccount.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 31d1b7e2f..41e1bde4d 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from module.plugins.Account import Account from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies @@ -160,7 +159,7 @@ class XFSAccount(Account): raise Exception(_("Missing HOSTER_DOMAIN")) if not self.LOGIN_URL: - self.LOGIN_URL = urljoin(self.HOSTER_URL, "login.html") + self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html") html = req.load(self.LOGIN_URL, decode=True) action, inputs = parseHtmlForm('name="FL"', html) -- cgit v1.2.3 From d86120df4f413c309ec87a3bc1ae7bd63d399e7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 18 May 2015 08:53:40 +0200 Subject: [XFSAccount] Fix https://github.com/pyload/pyload/issues/1420 --- module/plugins/internal/XFSAccount.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal/XFSAccount.py') diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 41e1bde4d..e619cb038 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.36" + __version__ = "0.37" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -170,9 +170,12 @@ class XFSAccount(Account): inputs.update({'login' : user, 'password': data['password']}) - if not action: - action = self.HOSTER_URL - html = req.load(action, post=inputs, decode=True) + if action: + url = urlparse.urljoin("http://", action) + else: + url = self.HOSTER_URL + + html = req.load(url, post=inputs, decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() -- cgit v1.2.3