summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/Base.py11
-rw-r--r--module/plugins/internal/SimpleCrypter.py12
-rw-r--r--module/plugins/internal/XFSCrypter.py6
-rw-r--r--module/plugins/internal/XFSHoster.py2
4 files changed, 15 insertions, 16 deletions
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
index 28b648994..052fc228f 100644
--- a/module/plugins/internal/Base.py
+++ b/module/plugins/internal/Base.py
@@ -463,10 +463,11 @@ class Base(Plugin):
value = value.strip()
if key in header:
- if type(header[key]) is list:
- header[key].append(value)
+ header_key = header.get(key)
+ if type(header_key) is list:
+ header_key.append(value)
else:
- header[key] = [header[key], value]
+ header[key] = [header_key, value]
else:
header[key] = value
@@ -474,7 +475,7 @@ class Base(Plugin):
link = url
elif header.get('location'):
- location = self.fixurl(header['location'], url)
+ location = self.fixurl(header.get('location'), url)
if header.get('code') == 302:
link = location
@@ -487,7 +488,7 @@ class Base(Plugin):
extension = os.path.splitext(parse_name(url))[-1]
if header.get('content-type'):
- mimetype = header['content-type'].split(';')[0].strip()
+ mimetype = header.get('content-type').split(';')[0].strip()
elif extension:
mimetype = mimetypes.guess_type(extension, False)[0] or "application/octet-stream"
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index d4ecd3117..ba4235072 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SimpleCrypter(Crypter, SimpleHoster):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.66"
+ __version__ = "0.67"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -82,20 +82,16 @@ class SimpleCrypter(Crypter, SimpleHoster):
#@TODO: Remove in 0.4.10
def _setup(self):
orig_name = self.__name__
- self.__name__ = (orig_name + ".py").replace("Folder.py", "").replace(".py", "")
-
+ self.__name__ = re.sub(r'Folder$', "", self.__name__)
super(SimpleCrypter, self)._setup()
-
self.__name__ = orig_name
#@TODO: Remove in 0.4.10
def load_account(self):
orig_name = self.__name__
- self.__name__ = (orig_name + ".py").replace("Folder.py", "").replace(".py", "")
-
+ self.__name__ = re.sub(r'Folder$', "", self.__name__)
super(SimpleCrypter, self).load_account()
-
self.__name__ = orig_name
@@ -106,7 +102,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
header = self.load(redirect, just_header=True)
if header.get('location'):
- self.link = header['location']
+ self.link = header.get('location')
else:
break
else:
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index dd2fba568..7ec9f3895 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+import re
+
from module.plugins.internal.Plugin import set_cookie
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
@@ -7,7 +9,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.17"
+ __version__ = "0.18"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -49,7 +51,7 @@ class XFSCrypter(SimpleCrypter):
if self.account:
account = self.account
else:
- account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
+ account_name = re.sub(r'Folder$', "", self.__name__)
account = self.pyload.accountManager.getAccountPlugin(account_name)
if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 80ef9a977..3373c08d8 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -184,7 +184,7 @@ class XFSHoster(SimpleHoster):
header = self.load(m.group(1), just_header=True)
if 'location' in header: #: Direct download link
- self.link = header['location']
+ self.link = header.get('location')
def get_post_parameters(self):