diff options
Diffstat (limited to 'module/plugins/crypter/MediafireComFolder.py')
-rw-r--r-- | module/plugins/crypter/MediafireComFolder.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 46856229c..bb7c90722 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -9,33 +9,34 @@ from module.common.json_layer import json_loads class MediafireComFolder(Crypter): __name__ = "MediafireComFolder" __type__ = "crypter" - __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' __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 = '<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>' + FILE_URL_PATTERN = r'<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>' - def decrypt(self, pyfile): - new_links = [] + def decrypt(self, pyfile): url, result = checkHTMLHeader(pyfile.url) self.logDebug('Location (%d): %s' % (result, url)) if result == 0: - # load and parse html + # load and parse html html = self.load(pyfile.url) - found = re.search(self.FILE_URL_PATTERN, html) - if found: + m = re.search(self.FILE_URL_PATTERN, html) + if m: # file page - new_links.append("http://www.mediafire.com/file/%s" % found.group(1)) + self.urls.append("http://www.mediafire.com/file/%s" % m.group(1)) else: # folder page - found = re.search(self.FOLDER_KEY_PATTERN, html) - if found: - folder_key = found.group(1) + 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( @@ -43,15 +44,13 @@ class MediafireComFolder(Crypter): #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/file/%s" % link['quickkey']) + self.urls.append("http://www.mediafire.com/file/%s" % link['quickkey']) else: self.fail(json_resp['response']['message']) elif result == 1: self.offline() else: - new_links.append(url) + self.urls.append(url) - if new_links: - self.core.files.addLinks(new_links, pyfile.package().id) - else: + if not self.urls: self.fail('Could not extract any links') |