From 8d3d5625aa14614f5799621137a27f07d08e3dca Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Tue, 29 Nov 2011 21:45:27 +0100 Subject: update hellspy.cz, add bayfiles.com --- module/plugins/hoster/EnteruploadCom.py | 81 +++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 module/plugins/hoster/EnteruploadCom.py (limited to 'module/plugins/hoster/EnteruploadCom.py') diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py new file mode 100644 index 000000000..5e899ae96 --- /dev/null +++ b/module/plugins/hoster/EnteruploadCom.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class EnteruploadCom(SimpleHoster): + __name__ = "EnteruploadCom" + __type__ = "hoster" + __pattern__ = r"http://(?:www\.)?enterupload.com/\w+.*" + __version__ = "0.01" + __description__ = """EnterUpload.com plugin - free only""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = r'

(?P[^<]+)

\s*File size:\s*(?P[0-9.]+)\s*(?P[kKMG])i?B' + FILE_OFFLINE_PATTERN = r'<(b|h2)>File Not Found|No such file with this filename' + URL_REPLACEMENTS = [(r"(http://(?:www\.)?enterupload.com/\w+).*", r"\1")] + + FORM1_PATTERN = r'
(.*?)
' + FORM2_PATTERN = r'
]*>(.*?)
' + FORM3_PATTERN = r'
' + FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]*)"[^>]*>' + WAIT_PATTERN = r'Wait <[^>]*>(\d+) seconds' + + def handleFree(self): + # Page 1 + try: + form = re.search(self.FORM1_PATTERN, self.html, re.DOTALL).group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + except Exception, e: + self.logError(e) + self.parseError("Form 1") + + inputs['method_free'] = 'Free Download' + self.logDebug(inputs) + self.html = self.load(self.pyfile.url, post = inputs, decode = True, cookies = True, ref = True) + + # Page 2 + try: + form = re.search(self.FORM2_PATTERN, self.html, re.DOTALL).group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + except Exception, e: + self.logError(e) + self.parseError("Form 2") + + inputs['method_free'] = self.pyfile.url + self.logDebug(inputs) + + found = re.search(self.WAIT_PATTERN, self.html) + if found: + self.setWait(int(found.group(1)) + 1) + self.wait() + + self.html = self.load(self.pyfile.url, post = inputs, decode = True, cookies = True, ref = True) + + # Page 3 + found = re.search(self.FORM3_PATTERN, self.html) + if not found: self.parseError("Form 3") + url = found.group(1) + + # Download + self.logDebug("Download URL: " + url) + self.download(url, cookies = True, ref = True) + +getInfo = create_getInfo(EnteruploadCom) \ No newline at end of file -- cgit v1.2.3