diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-09-08 00:29:57 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-09-14 11:02:23 +0200 |
commit | 68d662e689cd42687341c550fb6ebb74e6968d21 (patch) | |
tree | 486cef41bd928b8db704894233b2cef94a6e346f /pyload/plugins/crypter/MediafireComFolder.py | |
parent | save_join -> safe_join & save_path -> safe_filename (diff) | |
download | pyload-68d662e689cd42687341c550fb6ebb74e6968d21.tar.xz |
module -> pyload
Diffstat (limited to 'pyload/plugins/crypter/MediafireComFolder.py')
-rw-r--r-- | pyload/plugins/crypter/MediafireComFolder.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pyload/plugins/crypter/MediafireComFolder.py b/pyload/plugins/crypter/MediafireComFolder.py new file mode 100644 index 000000000..4ea904e89 --- /dev/null +++ b/pyload/plugins/crypter/MediafireComFolder.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re +from pyload.plugins.Crypter import Crypter +from pyload.plugins.hoster.MediafireCom import checkHTMLHeader +from pyload.common.json_layer import json_loads + + +class MediafireComFolder(Crypter): + __name__ = "MediafireComFolder" + __type__ = "crypter" + __version__ = "0.14" + + __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' + + __description__ = """Mediafire.com folder decrypter plugin""" + __author_name__ = "zoidberg" + __author_mail__ = "zoidberg@mujmail.cz" + + FOLDER_KEY_PATTERN = r"var afI= '(\w+)';" + FILE_URL_PATTERN = r'<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>' + + + def decrypt(self, pyfile): + url, result = checkHTMLHeader(pyfile.url) + self.logDebug('Location (%d): %s' % (result, url)) + + if result == 0: + # load and parse html + html = self.load(pyfile.url) + m = re.search(self.FILE_URL_PATTERN, html) + if m: + # file page + self.urls.append("http://www.mediafire.com/file/%s" % m.group(1)) + else: + # folder page + m = re.search(self.FOLDER_KEY_PATTERN, html) + if m: + folder_key = m.group(1) + self.logDebug("FOLDER KEY: %s" % folder_key) + + json_resp = json_loads(self.load( + "http://www.mediafire.com/api/folder/get_info.php?folder_key=%s&response_format=json&version=1" % folder_key)) + #self.logInfo(json_resp) + if json_resp['response']['result'] == "Success": + for link in json_resp['response']['folder_info']['files']: + self.urls.append("http://www.mediafire.com/file/%s" % link['quickkey']) + else: + self.fail(json_resp['response']['message']) + elif result == 1: + self.offline() + else: + self.urls.append(url) + + if not self.urls: + self.fail('Could not extract any links') |