diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
commit | acc46fc3497a66a427b795b4a22c6e71d69185a1 (patch) | |
tree | 2d315b838a76435fc456b972c99c28d1732b2f70 /pyload/plugins/hoster/MediafireCom.py | |
parent | Code fixes (diff) | |
download | pyload-acc46fc3497a66a427b795b4a22c6e71d69185a1.tar.xz |
Update
Diffstat (limited to 'pyload/plugins/hoster/MediafireCom.py')
-rw-r--r-- | pyload/plugins/hoster/MediafireCom.py | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/pyload/plugins/hoster/MediafireCom.py b/pyload/plugins/hoster/MediafireCom.py deleted file mode 100644 index 2f75c61dd..000000000 --- a/pyload/plugins/hoster/MediafireCom.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugins.internal.captcha import SolveMedia -from pyload.plugins.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 - - 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.80" - - __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")] - - - LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"' - JS_KEY_PATTERN = r'DoShow\(\'mfpromo1\'\);[^{]*{((\w+)=\'\';.*?)eval\(\2\);' - JS_ZMODULO_PATTERN = r'\(\'z-index\'\)\) \% (\d+)\)\);' - PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>' - PASSWORD_PATTERN = r'<form name="form_password"' - - NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' - INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)' - OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' - - - def setup(self): - self.multiDL = False - - - def process(self, pyfile): - pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) - - self.url, result = checkHTMLHeader(pyfile.url) - self.logDebug("Location (%d): %s" % (result, self.url)) - - if result == 0: - self.html = self.load(self.url, decode=True) - self.checkCaptcha() - self.multiDL = True - self.check_data = self.getFileInfo() - - if self.account: - self.handlePremium() - else: - self.handleFree() - elif result == 1: - self.offline() - else: - self.multiDL = True - self.download(self.url, disposition=True) - - - def handleFree(self): - passwords = self.getPassword().splitlines() - while self.PASSWORD_PATTERN in self.html: - if len(passwords): - password = passwords.pop(0) - self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(self.url, post={"downloadp": password}) - else: - self.fail(_("No or incorrect password")) - - m = re.search(r'kNO = r"(http://.*?)";', self.html) - if m is None: - self.error(_("No download URL")) - - download_url = m.group(1) - self.download(download_url) - - - def checkCaptcha(self): - solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - self.html = self.load(self.url, - post={'adcopy_challenge': challenge, - 'adcopy_response' : response}, - decode=True) |