diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-03 16:09:13 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-03 16:09:13 +0100 |
commit | 193cb8dbe1b24c24fb919461f16b2215e85da739 (patch) | |
tree | 5e3649a750666a8312b9f1de43d5b9e2f98da3b6 /module/plugins/container/CCF.py | |
parent | [ClickAndLoad] Fix https://github.com/pyload/pyload/issues/1135 (diff) | |
download | pyload-193cb8dbe1b24c24fb919461f16b2215e85da739.tar.xz |
Update container plugins
Diffstat (limited to 'module/plugins/container/CCF.py')
-rw-r--r-- | module/plugins/container/CCF.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index e7ad8f761..452b9bb65 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -4,8 +4,6 @@ from __future__ import with_statement import re -from os import makedirs -from os.path import exists from urllib2 import build_opener from MultipartPostHandler import MultipartPostHandler @@ -17,28 +15,35 @@ from module.utils import fs_encode, save_join class CCF(Container): __name__ = "CCF" __type__ = "container" - __version__ = "0.22" + __version__ = "0.23" __pattern__ = r'.+\.ccf$' __description__ = """CCF container decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("Willnix", "Willnix@pyload.org")] + __authors__ = [("Willnix", "Willnix@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] def decrypt(self, pyfile): file = fs_encode(pyfile.url.strip()) opener = build_opener(MultipartPostHandler) - tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', - {'src' : "ccf", - 'filename': "test.ccf", - 'upload' : open(file, "rb")}).read() + dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', + {'src' : "ccf", + 'filename': "test.ccf", + 'upload' : open(file, "rb")}).read() download_folder = self.config['general']['download_folder'] - tempdlc_name = save_join(download_folder, "tmp_%s.dlc" % pyfile.name) + dlc_file = save_join(download_folder, "tmp_%s.dlc" % pyfile.name) - with open(tempdlc_name, "w") as tempdlc: - tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1)) + try: + dlc = re.search(r'<dlc>(.+)</dlc>', dlc_content, re.S).group(1).decode('base64') - self.urls = [tempdlc_name] + except AttributeError: + self.fail(_("Container is corrupted")) + + with open(dlc_file, "w") as tempdlc: + tempdlc.write(dlc) + + self.urls = [dlc_file] |