summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/FastshareCz.py5
-rw-r--r--module/plugins/accounts/FilecloudIo.py7
-rw-r--r--module/plugins/accounts/FourSharedCom.py5
-rw-r--r--module/plugins/accounts/Keep2ShareCc.py5
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py5
-rw-r--r--module/plugins/accounts/SimplyPremiumCom.py5
-rw-r--r--module/plugins/accounts/TurbobitNet.py5
-rw-r--r--module/plugins/accounts/UploadedTo.py4
-rw-r--r--module/plugins/internal/Hoster.py2
-rw-r--r--module/plugins/internal/MultiHoster.py2
-rw-r--r--module/plugins/internal/Plugin.py22
-rw-r--r--module/plugins/internal/SimpleCrypter.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py2
-rw-r--r--module/plugins/internal/XFSAccount.py36
14 files changed, 61 insertions, 46 deletions
diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py
index 90b746624..3a3769a1c 100644
--- a/module/plugins/accounts/FastshareCz.py
+++ b/module/plugins/accounts/FastshareCz.py
@@ -3,12 +3,13 @@
import re
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class FastshareCz(Account):
__name__ = "FastshareCz"
__type__ = "account"
- __version__ = "0.08"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """Fastshare.cz account plugin"""
@@ -39,7 +40,7 @@ class FastshareCz(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("fastshare.cz", "lang", "en")
+ set_cookie(req.cj, "fastshare.cz", "lang", "en")
self.load('http://www.fastshare.cz/login') #@NOTE: Do not remove or it will not login
diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py
index 56d84e2e4..bdb13bd3d 100644
--- a/module/plugins/accounts/FilecloudIo.py
+++ b/module/plugins/accounts/FilecloudIo.py
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
-from module.plugins.internal.Account import Account
from module.common.json_layer import json_loads
+from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class FilecloudIo(Account):
__name__ = "FilecloudIo"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """FilecloudIo account plugin"""
@@ -43,7 +44,7 @@ class FilecloudIo(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("secure.filecloud.io", "lang", "en")
+ set_cookie(req.cj, "secure.filecloud.io", "lang", "en")
html = self.load('https://secure.filecloud.io/user-login.html')
if not hasattr(self, "form_data"):
diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py
index ef2140359..a7ec8e2c5 100644
--- a/module/plugins/accounts/FourSharedCom.py
+++ b/module/plugins/accounts/FourSharedCom.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class FourSharedCom(Account):
__name__ = "FourSharedCom"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """FourShared.com account plugin"""
@@ -21,7 +22,7 @@ class FourSharedCom(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("4shared.com", "4langcookie", "en")
+ set_cookie(req.cj, "4shared.com", "4langcookie", "en")
res = self.load("https://www.4shared.com/web/login",
post={'login' : user,
diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py
index a7f8564d9..014d43a69 100644
--- a/module/plugins/accounts/Keep2ShareCc.py
+++ b/module/plugins/accounts/Keep2ShareCc.py
@@ -4,12 +4,13 @@ import re
import time
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class Keep2ShareCc(Account):
__name__ = "Keep2ShareCc"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.08"
__status__ = "testing"
__description__ = """Keep2Share.cc account plugin"""
@@ -61,7 +62,7 @@ class Keep2ShareCc(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("keep2share.cc", "lang", "en")
+ set_cookie(req.cj, "keep2share.cc", "lang", "en")
html = self.load("https://keep2share.cc/login.html",
post={'LoginForm[username]' : user,
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index 28b2b0c68..87bbc4632 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -3,12 +3,13 @@
import re
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class ShareonlineBiz(Account):
__name__ = "ShareonlineBiz"
__type__ = "account"
- __version__ = "0.38"
+ __version__ = "0.39"
__status__ = "testing"
__description__ = """Share-online.biz account plugin"""
@@ -65,4 +66,4 @@ class ShareonlineBiz(Account):
def login(self, user, password, data, req):
api = self.api_response(user, password, req)
- req.cj.setCookie("share-online.biz", 'a', api['a'])
+ set_cookie(req.cj, "share-online.biz", 'a', api['a'])
diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py
index f8b5ff50b..a5c69f51c 100644
--- a/module/plugins/accounts/SimplyPremiumCom.py
+++ b/module/plugins/accounts/SimplyPremiumCom.py
@@ -2,12 +2,13 @@
from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class SimplyPremiumCom(Account):
__name__ = "SimplyPremiumCom"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.08"
__status__ = "testing"
__description__ = """Simply-Premium.com account plugin"""
@@ -39,7 +40,7 @@ class SimplyPremiumCom(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("simply-premium.com", "lang", "EN")
+ set_cookie(req.cj, "simply-premium.com", "lang", "EN")
html = self.load("https://www.simply-premium.com/login.php",
post={'key': user} if not password else {'login_name': user, 'login_pass': password})
diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py
index 9dd3e4d3c..206e7874f 100644
--- a/module/plugins/accounts/TurbobitNet.py
+++ b/module/plugins/accounts/TurbobitNet.py
@@ -4,12 +4,13 @@ import re
import time
from module.plugins.internal.Account import Account
+from module.plugins.internal.Plugin import set_cookie
class TurbobitNet(Account):
__name__ = "TurbobitNet"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """TurbobitNet account plugin"""
@@ -32,7 +33,7 @@ class TurbobitNet(Account):
def login(self, user, password, data, req):
- req.cj.setCookie("turbobit.net", "user_lang", "en")
+ set_cookie(req.cj, "turbobit.net", "user_lang", "en")
html = self.load("http://turbobit.net/user/login",
post={"user[login]" : user,
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 1757f2af8..09e891c19 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class UploadedTo(Account):
__name__ = "UploadedTo"
__type__ = "account"
- __version__ = "0.33"
+ __version__ = "0.34"
__status__ = "testing"
__description__ = """Uploaded.to account plugin"""
@@ -62,7 +62,7 @@ class UploadedTo(Account):
def login(self, user, password, data, req):
- #: req.cj.setCookie("uploaded.net", "lang", "en")
+ self.load("http://uploaded.net/language/en")
html = self.load("http://uploaded.net/io/login",
post={'id': user,
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 67feec38c..87ee2188c 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -12,7 +12,7 @@ import urlparse
from module.plugins.internal.Captcha import Captcha
from module.plugins.internal.Plugin import (Plugin, Abort, Fail, Reconnect, Retry, Skip,
chunks, encode, exists, fixurl as _fixurl, replace_patterns,
- seconds_to_midnight, set_cookies, parse_html_form,
+ seconds_to_midnight, set_cookie, set_cookies, parse_html_form,
parse_html_tag_attr_value, timestamp)
from module.utils import fs_decode, fs_encode, save_join as fs_join, save_path as safe_filename
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index a0ef3ff40..c0c928a45 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -3,7 +3,7 @@
import re
from module.plugins.internal.Plugin import Fail, encode
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookie, set_cookies
class MultiHoster(SimpleHoster):
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 62eb17aa6..99b5751e5 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -81,11 +81,15 @@ def replace_patterns(string, ruleslist):
return string
+#@TODO: Remove in 0.4.10 and fix CookieJar.setCookie
+def set_cookie(cj, domain, name, value):
+ return cj.setCookie(domain, name, encode(value))
+
+
def set_cookies(cj, cookies):
for cookie in cookies:
if isinstance(cookie, tuple) and len(cookie) == 3:
- domain, name, value = cookie
- cj.setCookie(domain, name, encode(value)) #@TODO: Remove `encode` in 0.4.10
+ set_cookie(cj, *cookie)
def parse_html_tag_attr_value(attr_name, tag):
@@ -142,7 +146,7 @@ def chunks(iterable, size):
class Plugin(object):
__name__ = "Plugin"
__type__ = "hoster"
- __version__ = "0.27"
+ __version__ = "0.28"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -329,12 +333,18 @@ class Plugin(object):
if req is None:
req = self.req or self.pyload.requestFactory.getRequest(self.__name__)
- res = req.load(url, get, post, ref, cookies, just_header, multipart, decode is True) #@TODO: Fix network multipart in 0.4.10
+ #@TODO: Move to network in 0.4.10
+ if isinstance(self.COOKIES, list):
+ set_cookies(req.cj, cookies)
+
+ res = req.load(url, get, post, ref, bool(cookies), just_header, multipart, decode is True) #@TODO: Fix network multipart in 0.4.10
- if decode: #@TODO: Move to network in 0.4.10
+ #@TODO: Move to network in 0.4.10
+ if decode:
res = html_unescape(res)
- if isinstance(decode, basestring): #@TODO: Move to network in 0.4.10
+ #@TODO: Move to network in 0.4.10
+ if isinstance(decode, basestring):
res = decode(res, decode)
if self.pyload.debug:
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index bcbfd6488..6a3f91a5b 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -3,7 +3,7 @@
import re
from module.plugins.internal.Crypter import Crypter
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookie, set_cookies
from module.utils import fixup, html_unescape
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 1d456a3ee..e27f9a231 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -12,7 +12,7 @@ from module.PyFile import statusMap as _statusMap
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo
-from module.plugins.internal.Plugin import Fail, encode, fixurl, replace_patterns, seconds_to_midnight, set_cookies
+from module.plugins.internal.Plugin import Fail, encode, fixurl, replace_patterns, seconds_to_midnight, set_cookie, set_cookies
from module.utils import fixup, fs_encode, parseFileSize as parse_size
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 0cd723bab..efb84de35 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -5,13 +5,13 @@ import time
import urlparse
from module.plugins.internal.Account import Account
-from module.plugins.internal.Plugin import parse_html_form, set_cookies
+from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.40"
+ __version__ = "0.41"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -39,20 +39,6 @@ class XFSAccount(Account):
LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<'
- def init(self):
- if not self.HOSTER_DOMAIN:
- self.log_error(_("Missing HOSTER_DOMAIN"))
- self.COOKIES = False
-
- 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 parse_info(self, user, password, data, req):
validuntil = None
trafficleft = None
@@ -65,7 +51,9 @@ class XFSAccount(Account):
'leechtraffic': leechtraffic,
'premium' : premium}
- html = self.load(self.HOSTER_URL, get={'op': "my_account"})
+ html = self.load(self.HOSTER_URL,
+ get={'op': "my_account"},
+ cookies=self.COOKIES)
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
@@ -151,12 +139,22 @@ class XFSAccount(Account):
def login(self, user, password, data, req):
+ if self.HOSTER_DOMAIN:
+ 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"))
+ else:
+ set_cookie(req.cj, self.HOSTER_DOMAIN, "lang", "english")
+
if not self.HOSTER_URL:
self.login_fail(_("Missing HOSTER_URL"))
if not self.LOGIN_URL:
self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html")
- html = self.load(self.LOGIN_URL)
+
+ html = self.load(self.LOGIN_URL, cookies=self.COOKIES)
action, inputs = parse_html_form('name="FL"', html)
if not inputs:
@@ -171,7 +169,7 @@ class XFSAccount(Account):
else:
url = self.HOSTER_URL
- html = self.load(url, post=inputs)
+ html = self.load(url, post=inputs, cookies=self.COOKIES)
if re.search(self.LOGIN_FAIL_PATTERN, html):
self.login_fail()