summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/accounts/UptoboxCom.py57
-rw-r--r--module/plugins/internal/Container.py2
-rw-r--r--module/plugins/internal/Hoster.py2
-rw-r--r--module/plugins/internal/Plugin.py2
-rw-r--r--module/plugins/internal/XFSAccount.py15
5 files changed, 17 insertions, 61 deletions
diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py
index de253fa3a..25beb7a46 100644
--- a/module/plugins/accounts/UptoboxCom.py
+++ b/module/plugins/accounts/UptoboxCom.py
@@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
-import json
-import re
-import time
-
from module.plugins.internal.Account import Account
class UptoboxCom(Account):
__name__ = "UptoboxCom"
__type__ = "account"
- __version__ = "0.10"
+ __version__ = "0.11"
__status__ = "testing"
__description__ = """Uptobox.com account plugin"""
@@ -20,53 +16,4 @@ class UptoboxCom(Account):
HOSTER_DOMAIN = "uptobox.com"
HOSTER_URL = "https://uptobox.com/"
- LOGIN_URL = "https://login.uptobox.com/logarithme"
-
- VALID_UNTIL_PATTERN = r'Premium-Account expire: (\d{1,2} [\w^_]+ \d{4})'
-
- def parse_info(self, user, password, data, req):
-
- validuntil = None
- trafficleft = None
- premium = None
-
- data = self.get_data(user)
- html = self.load(self.HOSTER_URL, get={'op': "my_account"})
-
- p = re.compile(self.VALID_UNTIL_PATTERN)
-
- m = re.search(p, html)
-
- if m:
- expiredate = m.group(1).strip()
- self.log_debug("Expire date: " + expiredate)
-
- try:
- validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y"))
-
- except Exception, e:
- self.log_error(e)
-
- else:
- self.log_debug("Valid until: %s" % validuntil)
-
- if validuntil > time.mktime(time.gmtime()):
- premium = True
- trafficleft = -1
- else:
- premium = False
- validuntil = None #: Registered account type (not premium)
- else:
- self.log_debug("VALID_UNTIL_PATTERN not found")
-
- return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
-
-
- def login(self, user, password, data, req):
-
- jsonstring = self.load(self.LOGIN_URL, None, post={'login': user, 'password': password, 'op': 'login'})
-
- parsedjson = json.loads(jsonstring)
-
- if parsedjson['success'] is None:
- self.login_fail()
+ LOGIN_URL = "https://login.uptobox.com/logarithme/"
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py
index 729592a0d..66e1ad904 100644
--- a/module/plugins/internal/Container.py
+++ b/module/plugins/internal/Container.py
@@ -63,7 +63,7 @@ class Container(Crypter):
f.write(content)
except IOError, e:
- self.fail(str(e)) #@TODO: Remove `str` in 0.4.10
+ self.fail(e)
else:
self.pyfile.name = os.path.basename(self.pyfile.url)
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index e6bd14329..ac42182c4 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -368,7 +368,7 @@ class Hoster(Plugin):
url = self.fixurl(url)
if not url or not isinstance(url, basestring):
- self.fail(_("No url given"))
+ self.fail(_("No given url"))
if self.pyload.debug:
self.log_debug("DOWNLOAD URL " + url,
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index fd8712b44..fc05e2a5b 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -354,7 +354,7 @@ class Plugin(object):
url = fixurl(url)
if not url or not isinstance(url, basestring):
- self.fail(_("No url given"))
+ self.fail(_("No given url"))
if self.pyload.debug:
self.log_debug("LOAD URL " + url,
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 5a4cc35fb..3f2158a0b 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -4,6 +4,7 @@ import re
import time
import urlparse
+from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
from module.plugins.internal.Plugin import parse_html_form, set_cookie
@@ -11,7 +12,7 @@ from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.43"
+ __version__ = "0.44"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -174,5 +175,13 @@ class XFSAccount(Account):
html = self.load(url, post=inputs, cookies=self.COOKIES)
- if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.login_fail()
+ try:
+ json = json_loads(html)
+
+ except ValueError:
+ if re.search(self.LOGIN_FAIL_PATTERN, html):
+ self.login_fail()
+
+ else:
+ if not 'success' in json or not json['success']:
+ self.login_fail()