diff options
Diffstat (limited to 'module/plugins/hoster/MegacrypterCom.py')
-rw-r--r-- | module/plugins/hoster/MegacrypterCom.py | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 9f012e5be..c166146dd 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from module.common.json_layer import json +from module.common.json_layer import json_loads, json_dumps from module.plugins.hoster.MegaNz import MegaNz @@ -9,7 +9,7 @@ class MegacrypterCom(MegaNz): __name__ = "MegacrypterCom" __type__ = "hoster" __pattern__ = r"(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)" - __version__ = "0.1" + __version__ = "0.2" __description__ = """megacrypter plugin, based and inherits from RaNaN's MegaNz plugin""" __author_name__ = ("GonzaloSR", ) __author_mail__ = ("gonzalo@gonzalosr.com", ) @@ -17,35 +17,27 @@ class MegacrypterCom(MegaNz): API_URL = "http://megacrypter.com/api" FILE_SUFFIX = ".crypted" - def callApi(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ - self.logDebug("JSON request: " + json.dumps(kwargs)) - resp = self.load(self.API_URL, post=json.dumps(kwargs)) + self.logDebug("JSON request: " + json_dumps(kwargs)) + resp = self.load(self.API_URL, post=json_dumps(kwargs)) self.logDebug("API Response: " + resp) - return json.loads(resp) + return json_loads(resp) - def process(self, pyfile): - - key = None - # match is guaranteed because plugin was chosen to handle url node = re.search(self.__pattern__, pyfile.url).group(1) - # get Mega.co.nz link info info = self.callApi(link=node, m="info") - + # get crypted file URL dl = self.callApi(link=node, m="dl") - # TODO: map error codes, implement password protection # if info["pass"] == true: # crypted_file_key, md5_file_key = info["key"].split("#") - key = self.b64_decode(info["key"]) pyfile.name = info["name"] + self.FILE_SUFFIX @@ -55,5 +47,3 @@ class MegacrypterCom(MegaNz): # Everything is finished and final name can be set pyfile.name = info["name"] - - |