summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/MediafireComFolder.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-18 19:23:48 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-18 19:23:48 +0100
commit34c4e92a828883b35fa69c7bfea80fb1c828ec3d (patch)
treeddfe420765906eb0d0525511f15b4299805a9d9f /module/plugins/crypter/MediafireComFolder.py
parentlittle fix (diff)
downloadpyload-34c4e92a828883b35fa69c7bfea80fb1c828ec3d.tar.xz
Update Mediafire, folder support for Fileserve and Mediafire
Diffstat (limited to 'module/plugins/crypter/MediafireComFolder.py')
-rw-r--r--module/plugins/crypter/MediafireComFolder.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py
new file mode 100644
index 000000000..49a72ca76
--- /dev/null
+++ b/module/plugins/crypter/MediafireComFolder.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+
+class MediafireComFolder(Crypter):
+ __name__ = "MediafireComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?).*"
+ __version__ = "0.10"
+ __description__ = """Mediafire.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_KEY_PATTERN = r"var afI= '(\w+)';"
+ FILE_URL_PATTERN = '<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>'
+
+ def decrypt(self, pyfile):
+ new_links = []
+
+ html = self.load(pyfile.url)
+ found = re.search(self.FILE_URL_PATTERN, html)
+ if found:
+ new_links.append("http://www.mediafire.com/download.php?" + found.group(1))
+ else:
+ found = re.search(self.FOLDER_KEY_PATTERN, html)
+ if not found: self.fail('Parse error: Folder Key')
+ folder_key = found.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']:
+ new_links.append("http://www.mediafire.com/download.php?%s" % link['quickkey'])
+ else:
+ self.fail(json_resp['response']['message'])
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links') \ No newline at end of file