summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-11 02:55:22 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-10-11 02:55:22 +0200
commite76ecbb11c1f0cc104e0631d6a9dd0b6f358bd0c (patch)
tree6575b6fb40e049429f941ebb730f444f04e9ca2f /module
parentFix https://github.com/pyload/pyload/issues/1998 (diff)
downloadpyload-e76ecbb11c1f0cc104e0631d6a9dd0b6f358bd0c.tar.xz
Fix https://github.com/pyload/pyload/issues/1960
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/UptoboxCom.py30
-rw-r--r--module/plugins/internal/Account.py7
-rw-r--r--module/plugins/internal/XFSAccount.py24
3 files changed, 36 insertions, 25 deletions
diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py
index 8df558e2a..277e0798b 100644
--- a/module/plugins/accounts/UptoboxCom.py
+++ b/module/plugins/accounts/UptoboxCom.py
@@ -1,12 +1,16 @@
# -*- coding: utf-8 -*-
+import re
+import urlparse
+
+from module.common.json_layer import json_loads
from module.plugins.internal.XFSAccount import XFSAccount
class UptoboxCom(XFSAccount):
__name__ = "UptoboxCom"
__type__ = "account"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
__description__ = """Uptobox.com account plugin"""
@@ -15,5 +19,25 @@ class UptoboxCom(XFSAccount):
PLUGIN_DOMAIN = "uptobox.com"
- PLUGIN_URL = "https://uptobox.com/"
- LOGIN_URL = "https://login.uptobox.com/logarithme/"
+ PLUGIN_URL = "http://uptobox.com/"
+ LOGIN_URL = "https://login.uptobox.com/"
+
+
+ def signin(self, user, password, data):
+ if self.COOKIES:
+ self.set_xfs_cookie()
+
+ html = self.load(self.LOGIN_URL, cookies=self.COOKIES)
+
+ if re.search(self.LOGIN_SKIP_PATTERN, html):
+ self.skip_login()
+
+ html = self.load(urlparse.urljoin(self.LOGIN_URL, "logarithme"),
+ post={'op' : "login",
+ 'redirect': self.PLUGIN_URL,
+ 'login' : user,
+ 'password': password},
+ cookies=self.COOKIES)
+
+ if json_loads(html).get('error'):
+ self.fail_login()
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 8b80a0d5c..a6d2ffbf1 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -13,7 +13,7 @@ from module.utils import compare_time, lock
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.61"
+ __version__ = "0.62"
__status__ = "testing"
__description__ = """Base account plugin"""
@@ -143,7 +143,8 @@ class Account(Plugin):
try:
self.signin(self.user, self.info['login']['password'], self.info['data'])
- except Skip:
+ except Skip, e:
+ self.log_debug(e)
self.info['login']['valid'] = True
new_timeout = timestamp - self.info['login']['timestamp']
@@ -151,7 +152,7 @@ class Account(Plugin):
self.timeout = new_timeout
except Exception, e:
- self.log_error(_("Could not login user `%s`") % user, e)
+ self.log_error(_("Could not login user `%s`") % self.user, e)
self.info['login']['valid'] = False
else:
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 4c3f35c2b..75ff4a362 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -4,7 +4,6 @@ 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.MultiAccount import MultiAccount
from module.plugins.internal.Plugin import parse_html_form, set_cookie
@@ -13,7 +12,7 @@ from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.50"
+ __version__ = "0.51"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -62,10 +61,7 @@ class XFSAccount(Account):
premium = None
if not self.PLUGIN_URL: #@TODO: Remove in 0.4.10
- return {'validuntil' : validuntil,
- 'trafficleft' : trafficleft,
- 'leechtraffic': leechtraffic,
- 'premium' : premium}
+ return
html = self.load(self.PLUGIN_URL,
get={'op': "my_account"},
@@ -167,8 +163,6 @@ class XFSAccount(Account):
if not self.PLUGIN_URL:
self.fail_login(_("Missing PLUGIN_URL"))
- else:
- self.PLUGIN_URL = self.PLUGIN_URL.rstrip('/') + "/"
if not self.LOGIN_URL:
self.LOGIN_URL = urlparse.urljoin(self.PLUGIN_URL, "login.html")
@@ -189,17 +183,9 @@ class XFSAccount(Account):
if action:
url = urlparse.urljoin("http://", action)
else:
- url = self.PLUGIN_URL
+ url = self.LOGIN_URL
html = self.load(url, post=inputs, cookies=self.COOKIES)
- try:
- json = json_loads(html)
-
- except ValueError:
- if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.fail_login()
-
- else:
- if not 'success' in json or not json['success']:
- self.fail_login()
+ if re.search(self.LOGIN_FAIL_PATTERN, html):
+ self.fail_login()