diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-23 15:28:44 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-23 15:28:44 +0100 |
commit | 02c58f1009cc7f6b7ee36f1a34e43bec02735f05 (patch) | |
tree | 10fa0f86b54119769912ae2bc52775c0342d0f5f | |
parent | fix 4shared, replace easy-share with crocko (diff) | |
download | pyload-02c58f1009cc7f6b7ee36f1a34e43bec02735f05.tar.xz |
add uploadbox.com, fshare.vn
-rw-r--r-- | module/plugins/hoster/FshareVn.py | 42 | ||||
-rw-r--r-- | module/plugins/hoster/IfileIt.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/UploadboxCom.py | 89 |
3 files changed, 133 insertions, 2 deletions
diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py new file mode 100644 index 000000000..13f15716f --- /dev/null +++ b/module/plugins/hoster/FshareVn.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +import re + +class FshareVn(SimpleHoster): + __name__ = "FshareVn" + __type__ = "hoster" + __pattern__ = r"http://(www\.)?fshare.vn/file/.*" + __version__ = "0.10" + __description__ = """FshareVn Download Hoster""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_INFO_PATTERN = ur'<p><b>Tên file:</b>\s*(?P<N>[^<]+)</p>\s*<p><b>Dung lượng file:</b>\s*(?P<S>[0-9,.]+)\s*(?P<U>[kKMG])i?B</p>' + FILE_OFFLINE_PATTERN = r'<span class="error_number">511</span>' + + DOWNLOAD_URL_PATTERN = r"<a class=\"bt_down\" id=\"down\".*window.location='([^']+)'\">" + FORM_PATTERN = r'<form action="" method="post" name="frm_download">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' + + def handleFree(self): + found = re.search(self.FORM_PATTERN, self.html, re.DOTALL) + if not found: self.parseError('FORM') + form = found.group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + + self.html = self.load(self.pyfile.url, post = inputs) + + found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + if not found: self.parseError('Free URL') + url = found.group(1) + + found = re.search(r'var count = (\d+)', self.html) + self.setWait(int(found.group(1)) if found else 30) + self.wait() + + self.download(url) + +getInfo = create_getInfo(FshareVn) +
\ No newline at end of file diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index b0e60d25a..ec830f3b2 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -25,8 +25,8 @@ from module.network.RequestFactory import getURL class IfileIt(SimpleHoster): __name__ = "IfileIt" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)*ifile\.it/(\w+).*" - __version__ = "0.23" + __pattern__ = r"http://(?:\w*\.)*(?:ifile\.it|mihd\.net)/(\w+).*" + __version__ = "0.24" __description__ = """Ifile.it""" __author_name__ = ("zoidberg") diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py new file mode 100644 index 000000000..04b4ac6aa --- /dev/null +++ b/module/plugins/hoster/UploadboxCom.py @@ -0,0 +1,89 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.network.RequestFactory import getURL + +def getInfo(urls): + for url in urls: + file_id = re.search(UploadboxCom.__pattern__, url).group(1) + html = unicode(getURL('http://uploadbox.com/files/%s/?ac=lang&lang_new=en' % file_id), 'cp1251') + file_info = parseFileInfo(UploadboxCom, url, html) + yield file_info + +class UploadboxCom(SimpleHoster): + __name__ = "Uploadbox" + __type__ = "hoster" + __pattern__ = r"http://(?:www\.)?uploadbox\.com/files/([^/]+).*" + __version__ = "0.02" + __description__ = """UploadBox.com plugin - free only""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_NAME_PATTERN = r'<p><span>File name:</span>\s*(?P<N>[^<]+)</p>' + FILE_SIZE_PATTERN = r'<span>Size:</span>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B <span>' + FILE_OFFLINE_PATTERN = r'<strong>File deleted from service</strong>' + + FREE_FORM_PATTERN = r'<form action="([^"]+)" method="post" id="free" name="free">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)" />' + LIMIT_EXCEEDED_PATTERN = r'<strong>The limit of traffic for you is exceeded. Please </strong> <br />wait <strong>(\d+)</strong> minutes' + DOWNLOAD_URL_PATTERN = r'<iframe id="file_download"[^>]*src="([^"]+)"></iframe>' + + def process(self, pyfile): + self.file_id = re.search(self.__pattern__, pyfile.url).group(1) + self.html = unicode(self.load('http://uploadbox.com/files/%s/?ac=lang&lang_new=en' % self.file_id), 'cp1251') + self.getFileInfo() + self.handleFree() + + def handleFree(self): + # Solve captcha + url = 'http://uploadbox.com/files/' + self.file_id + + for i in range(5): + self.html = self.load(url, post = {"free": "yes"}) + found = re.search(self.LIMIT_EXCEEDED_PATTERN, self.html) + if found: + self.setWait(int(found.group(1))*60, True) + self.wait() + else: + break + else: + self.fail("Unable to get free download slot") + + for i in range(5): + try: + action, form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).groups() + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + except Exception, e: + self.logError(e) + self.fail("Parse error on page 2") + + captcha_url = 'http://uploadbox.com/?ac=captcha&code=' + inputs['code'] + inputs['enter'] = self.decryptCaptcha(captcha_url) + self.html = self.load('http://uploadbox.com/' + action, post = inputs) + found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + if found: + self.correctCaptcha() + download_url = found.group(1) + break + else: + self.fail("Incorrect captcha entered 5 times") + + # Download + self.download(download_url)
\ No newline at end of file |