From 8e7d14bae4d3c836f029a1235eb227380acc3f75 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 16 Feb 2015 21:59:10 +0100 Subject: Fix plugins to work on 0.4.10 --- pyload/plugin/hoster/MediafireCom.py | 128 +++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 pyload/plugin/hoster/MediafireCom.py (limited to 'pyload/plugin/hoster/MediafireCom.py') diff --git a/pyload/plugin/hoster/MediafireCom.py b/pyload/plugin/hoster/MediafireCom.py new file mode 100644 index 000000000..5adf004d0 --- /dev/null +++ b/pyload/plugin/hoster/MediafireCom.py @@ -0,0 +1,128 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.captcha import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo +from pyload.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 + + +class MediafireCom(SimpleHoster): + __name__ = "MediafireCom" + __type__ = "hoster" + __version__ = "0.84" + + __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' + + __description__ = """Mediafire.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + NAME_PATTERN = r'' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P[^\']*)\',\'(?P[^\']*)\',\'(?P[^\']*)\',\'\',\'(?P[^\']*)\'\)' + OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. ' + + PASSWORD_PATTERN = r'