diff options
| author | 2014-12-30 20:21:23 +0100 | |
|---|---|---|
| committer | 2014-12-30 20:21:23 +0100 | |
| commit | ac9ba34bd5e629ddfbe67dec88ff2e0653e80356 (patch) | |
| tree | f77bc281bd083145b19e82bf0e5ff34f5cd6f01a /module/plugins/hoster/MegacrypterCom.py | |
| parent | [Oboom] new hoster and account (diff) | |
| parent | Update some MultiHoster __pattern__ (diff) | |
| download | pyload-ac9ba34bd5e629ddfbe67dec88ff2e0653e80356.tar.xz | |
Merge pull request #1 from pyload/stable
Merge
Diffstat (limited to 'module/plugins/hoster/MegacrypterCom.py')
| -rw-r--r-- | module/plugins/hoster/MegacrypterCom.py | 40 | 
1 files changed, 23 insertions, 17 deletions
| diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 8b72606ce..4034f7d32 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -3,27 +3,33 @@  import re  from module.common.json_layer import json_loads, json_dumps -from module.plugins.hoster.MegaNz import MegaNz +from module.plugins.hoster.MegaCoNz import MegaCoNz + + +class MegacrypterCom(MegaCoNz): +    __name__    = "MegacrypterCom" +    __type__    = "hoster" +    __version__ = "0.21" + +    __pattern__ = r'(https?://\w{0,10}\.?megacrypter\.com/[\w!-]+)' -class MegacrypterCom(MegaNz): -    __name__ = "MegacrypterCom" -    __type__ = "hoster" -    __pattern__ = r'(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)' -    __version__ = "0.2"      __description__ = """Megacrypter.com decrypter plugin""" -    __author_name__ = ("GonzaloSR", ) -    __author_mail__ = ("gonzalo@gonzalosr.com", ) +    __license__     = "GPLv3" +    __authors__     = [("GonzaloSR", "gonzalo@gonzalosr.com")] +      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("API Response: " + resp) -        return json_loads(resp) +        res = self.load(self.API_URL, post=json_dumps(kwargs)) +        self.logDebug("API Response: " + res) +        return json_loads(res) +      def process(self, pyfile):          # match is guaranteed because plugin was chosen to handle url @@ -36,15 +42,15 @@ class MegacrypterCom(MegaNz):          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("#") +        # if info['pass'] is True: +        #    crypted_file_key, md5_file_key = info['key'].split("#") -        key = self.b64_decode(info["key"]) +        key = self.b64_decode(info['key']) -        pyfile.name = info["name"] + self.FILE_SUFFIX +        pyfile.name = info['name'] + self.FILE_SUFFIX -        self.download(dl["url"]) +        self.download(dl['url'])          self.decryptFile(key)          # Everything is finished and final name can be set -        pyfile.name = info["name"] +        pyfile.name = info['name'] | 
