From 311e9a1d9ca6450ec84e4a54ef47dbf488e83107 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 6 Mar 2015 22:03:57 +0100 Subject: [MediafireCom] Update --- module/plugins/hoster/MediafireCom.py | 122 ++++++++-------------------------- 1 file changed, 29 insertions(+), 93 deletions(-) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index bc81c8202..54df531bd 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -3,126 +3,62 @@ import re from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL - - -def replace_eval(js_expr): - return js_expr.replace(r'eval("', '').replace(r"\'", r"'").replace(r'\"', r'"') - - -def checkHTMLHeader(url): - try: - for _i in xrange(3): - header = getURL(url, just_header=True) - - for line in header.splitlines(): - line = line.lower() - - if 'location' in line: - url = line.split(':', 1)[1].strip() - if 'error.php?errno=320' in url: - return url, 1 - - if not url.startswith('http://'): - url = 'http://www.mediafire.com' + url - - break - - elif 'content-disposition' in line: - return url, 2 - else: - break - except Exception: - return url, 3 - else: - return url, 0 - - -def getInfo(urls): - for url in urls: - location, status = checkHTMLHeader(url) - - if status: - file_info = (url, 0, status, url) - else: - file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True)) - - yield file_info +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.84" + __version__ = "0.85" - __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' + __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/))\w+' __description__ = """Mediafire.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + NAME_PATTERN = r'' + SIZE_PATTERN = r'
  • File size: (?P[\d.,]+) (?P[\w^_]+)' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'.*?\',\'(?P.+?)\',\'(?P[\d.,]+)\s*(?P[\w^_]+)\',\'\',\'(?P.+?)\'\)' + OFFLINE_PATTERN = r'class="error_msg_title"' - NAME_PATTERN = r'' - INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P[^\']*)\',\'(?P[^\']*)\',\'(?P[^\']*)\',\'\',\'(?P[^\']*)\'\)' - OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. ' + LINK_FREE_PATTERN = r'kNO = "(.+?)"' PASSWORD_PATTERN = r'