summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SimpleCrypter.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal/SimpleCrypter.py')
-rw-r--r--module/plugins/internal/SimpleCrypter.py53
1 files changed, 43 insertions, 10 deletions
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 6a3f91a5b..20e91ac1e 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -3,19 +3,20 @@
import re
from module.plugins.internal.Crypter import Crypter
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookie, set_cookies
-from module.utils import fixup, html_unescape
+from module.plugins.internal.Plugin import replace_patterns, set_cookie, set_cookies
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SimpleCrypter(Crypter, SimpleHoster):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.60"
+ __version__ = "0.64"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Simple decrypter plugin"""
__license__ = "GPLv3"
@@ -47,13 +48,35 @@ class SimpleCrypter(Crypter, SimpleHoster):
and its loadPage method:
-
def load_page(self, page_n):
return the html of the page number page_n
"""
- DIRECT_LINK = True
- LEECH_HOSTER = False
+ NAME_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
+
+ COOKIES = True #: or False or list of tuples [(domain, name, value)]
+ DIRECT_LINK = True #: Set to True to looking for direct link (as defined in handle_direct method), set to None to do it if self.account is True else False
+ LOGIN_ACCOUNT = False #: Set to True to require account login
+ LOGIN_PREMIUM = False #: Set to True to require premium account login
+ # LEECH_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method)
+ TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct
+ PAGES_PATTERN = None
+
+ LINK_PATTERN = None
+
+ NAME_PATTERN = None
+ HASHSUM_PATTERN = None
+ OFFLINE_PATTERN = None
+ TEMP_OFFLINE_PATTERN = None
+
+ WAIT_PATTERN = None
+ PREMIUM_ONLY_PATTERN = None
+ HAPPY_HOUR_PATTERN = None
+ IP_BLOCKED_PATTERN = None
+ DL_LIMIT_PATTERN = None
+ SIZE_LIMIT_PATTERN = None
+ ERROR_PATTERN = None
#@TODO: Remove in 0.4.10
@@ -82,7 +105,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.log_debug("Redirect #%d to: %s" % (i, redirect))
header = self.load(redirect, just_header=True)
- if 'location' in header and header['location']:
+ if header.get('location'):
self.link = header['location']
else:
break
@@ -90,6 +113,11 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.log_error(_("Too many redirects"))
+ def prepare(self):
+ self.links = []
+ return super(SimpleCrypter, self).prepare()
+
+
def decrypt(self, pyfile):
self.prepare()
self.check_info() #@TODO: Remove in 0.4.10
@@ -108,7 +136,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.links = self.get_links() or list()
- if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
+ if self.PAGES_PATTERN:
self.handle_pages(pyfile)
self.log_debug("Package has %d links" % len(self.links))
@@ -129,9 +157,14 @@ class SimpleCrypter(Crypter, SimpleHoster):
return re.findall(self.LINK_PATTERN, self.html)
+ def load_page(self, number)
+ raise NotImplementedError
+
+
def handle_pages(self, pyfile):
try:
pages = int(re.search(self.PAGES_PATTERN, self.html).group(1))
+
except Exception:
pages = 1