diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 36 | ||||
-rw-r--r-- | module/plugins/hoster/ExtabitCom.py | 81 | ||||
-rw-r--r-- | module/plugins/hoster/NarodRu.py | 66 | ||||
-rw-r--r-- | module/plugins/hoster/OneFichierCom.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/UlozTo.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/UnibytesCom.py | 80 | ||||
-rw-r--r-- | module/plugins/hoster/WebshareCz.py | 44 | ||||
-rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 126 |
8 files changed, 397 insertions, 46 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 87e5e7254..c5cca6409 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -3,50 +3,26 @@ import re from urllib import unquote -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.network.RequestFactory import getURL from module.plugins.ReCaptcha import ReCaptcha -def getInfo(urls): - result = [] - - for url in urls: - file_info = parseFileInfo(DepositfilesCom, url, getURL(re.sub(r"\.com(/.*?)?/files", ".com/en/files", url), decode=True)) - result.append(file_info) - - yield result - class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" - __version__ = "0.36" + __version__ = "0.37" __description__ = """Depositfiles.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") FILE_INFO_PATTERN = r'File name: <b title="(?P<N>[^"]+)">.*\s*<span class="nowrap">File size: <b>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</b>' FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' + FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")] + RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)', this\);" DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"' - def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False - - self.pyfile.url = re.sub(r"\.com(/.*?)?/files", ".com/en/files", self.pyfile.url) - - def process(self, pyfile): - if re.search(r"(.*)\.html", self.pyfile.url): - self.pyfile.url = re.search(r"(.*)\.html", self.pyfile.url).group(1) - - self.html = self.load(self.pyfile.url, cookies=True if self.account else False, decode = True) - self.getFileInfo() - - if self.account: - self.handlePremium() - else: - self.handleFree() - def handleFree(self): self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}) if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() @@ -117,4 +93,6 @@ class DepositfilesCom(SimpleHoster): def handlePremium(self): link = unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1)) - self.download(link)
\ No newline at end of file + self.download(link) + +getInfo = create_getInfo(DepositfilesCom)
\ No newline at end of file diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py new file mode 100644 index 000000000..1cbc997f0 --- /dev/null +++ b/module/plugins/hoster/ExtabitCom.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 <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +import re +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class ExtabitCom(SimpleHoster): + __name__ = "ExtabitCom" + __type__ = "hoster" + __pattern__ = r"http://(www\.)?extabit\.com/[a-zA-Z0-9-._ ]{11}B" + __version__ = "0.1" + __description__ = """UniBytes.com""" + __author_name__ = ("zoidberg") + + FILE_NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' + FILE_SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' + + DOMAIN = 'http://www.unibytes.com' + + WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' + DOWNLOAD_LINK_PATTERN = r'<a href="([^"]+)">Download</a>' + + def handleFree(self): + action, post_data = self.parseHtmlForm('id="startForm"') + self.req.http.c.setopt(FOLLOWLOCATION, 0) + + for i in range(8): + self.logDebug(action, post_data) + self.html = self.load(self.DOMAIN + action, post = post_data) + + found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) + if found: + url = found.group(1) + break + + if '>Somebody else is already downloading using your IP-address<' in self.html: + self.setWait(600, True) + self.wait() + self.retry() + + if post_data['step'] == 'last': + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if found: + url = found.group(1) + self.correctCaptcha() + break + else: + self.invalidCaptcha() + + last_step = post_data['step'] + action, post_data = self.parseHtmlForm('id="stepForm"') + + if last_step == 'timer': + found = re.search(self.WAIT_PATTERN, self.html) + self.setWait(int(found.group(1)) if found else 60, False) + self.wait() + elif last_step in ('captcha', 'last'): + post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg') + else: + self.fail("No valid captcha code entered") + + self.logDebug('Download link: ' + url) + self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.download(url) + +getInfo = create_getInfo(UnibytesCom)
\ No newline at end of file diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py new file mode 100644 index 000000000..335860de9 --- /dev/null +++ b/module/plugins/hoster/NarodRu.py @@ -0,0 +1,66 @@ +# -*- 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 random import random +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class NarodRu(SimpleHoster): + __name__ = "NarodRu" + __type__ = "hoster" + __pattern__ = r"http://(www\.)?narod(\.yandex)?\.ru/(disk|start/[0-9]+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+" + __version__ = "0.1" + __description__ = """Narod.ru""" + __author_name__ = ("zoidberg") + + FILE_NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>' + FILE_SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>' + FILE_OFFLINE_PATTERN = r'<title>404</title>|Файл удален с сервиса|Закончился срок хранения файла\.' + + FILE_SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')] + FILE_URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), (r"/start/[0-9]+\.\w+-narod\.yandex\.ru/([0-9]{6,15})/\w+/(\w+)", r"/disk/\1/\2")] + + CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' + DOWNLOAD_LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' + + def handleFree(self): + for i in range(5): + self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) + found = re.search(self.CAPTCHA_PATTERN, self.html) + if not found: self.parseError('Captcha') + post_data = {"action": "sendcapcha"} + captcha_url, post_data['key'] = found.groups() + post_data['rep'] = self.decryptCaptcha(captcha_url) + + self.html = self.load(self.pyfile.url, post = post_data, decode = True) + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if found: + url = 'http://narod.ru' + found.group(1) + self.correctCaptcha() + break + elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: + self.invalidCaptcha() + else: + self.parseError('Download link') + else: + self.fail("No valid captcha code entered") + + self.logDebug('Download link: ' + url) + self.download(url) + +getInfo = create_getInfo(NarodRu)
\ No newline at end of file diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 16401891b..e4a0a6ed7 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -7,13 +7,13 @@ class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" __pattern__ = r"(http://\w+\.((1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))" - __version__ = "0.4" + __version__ = "0.41" __description__ = """1fichier.com download hoster""" __author_name__ = ("fragonib", "the-razer", "zoidberg") __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz") - FILE_NAME_PATTERN = r'">File name :</th>[\t\r\n ]+<td>(?P<N>.*?)</td>' - FILE_SIZE_PATTERN = r'<th>File size :</th>\s+<td>(?P<S>[\d\.]*) (?P<U>\w+)</td>' + FILE_NAME_PATTERN = r'">File name :</th>\s*<td>(?P<N>[^<]+)</td>' + FILE_SIZE_PATTERN = r'<th>File size :</th>\s*<td>(?P<S>[^<]+</td>' FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)' FILE_URL_REPLACEMENTS = [(r'(http://[^/]*).*', r'\1/en/')] diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 618bdd872..5f482e189 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -26,8 +26,8 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?P<id>\d+/[^/?]*)" - __version__ = "0.82" + __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\d+/[^/?]*)" + __version__ = "0.83" __description__ = """uloz.to""" __author_name__ = ("zoidberg") diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py new file mode 100644 index 000000000..3c8552271 --- /dev/null +++ b/module/plugins/hoster/UnibytesCom.py @@ -0,0 +1,80 @@ +# -*- 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 pycurl import FOLLOWLOCATION +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + +class UnibytesCom(SimpleHoster): + __name__ = "UnibytesCom" + __type__ = "hoster" + __pattern__ = r"http://(www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B" + __version__ = "0.1" + __description__ = """UniBytes.com""" + __author_name__ = ("zoidberg") + + FILE_INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' + DOMAIN = 'http://www.unibytes.com' + + WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' + DOWNLOAD_LINK_PATTERN = r'<a href="([^"]+)">Download</a>' + + def handleFree(self): + action, post_data = self.parseHtmlForm('id="startForm"') + self.req.http.c.setopt(FOLLOWLOCATION, 0) + + for i in range(8): + self.logDebug(action, post_data) + self.html = self.load(self.DOMAIN + action, post = post_data) + + found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) + if found: + url = found.group(1) + break + + if '>Somebody else is already downloading using your IP-address<' in self.html: + self.setWait(600, True) + self.wait() + self.retry() + + if post_data['step'] == 'last': + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if found: + url = found.group(1) + self.correctCaptcha() + break + else: + self.invalidCaptcha() + + last_step = post_data['step'] + action, post_data = self.parseHtmlForm('id="stepForm"') + + if last_step == 'timer': + found = re.search(self.WAIT_PATTERN, self.html) + self.setWait(int(found.group(1)) if found else 60, False) + self.wait() + elif last_step in ('captcha', 'last'): + post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg') + else: + self.fail("No valid captcha code entered") + + self.logDebug('Download link: ' + url) + self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.download(url) + +getInfo = create_getInfo(UnibytesCom)
\ No newline at end of file diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py new file mode 100644 index 000000000..f214ab749 --- /dev/null +++ b/module/plugins/hoster/WebshareCz.py @@ -0,0 +1,44 @@ +# -*- 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, create_getInfo +from module.network.HTTPRequest import BadHeader + +class WebshareCz(SimpleHoster): + __name__ = "WebshareCz" + __type__ = "hoster" + __pattern__ = r"http://(\w+\.)?webshare.cz/(stahnout/)?(?P<ID>\w{10})-.+" + __version__ = "0.1" + __description__ = """WebShare.cz""" + __author_name__ = ("zoidberg") + + FILE_NAME_PATTERN = r'<h3>Stahujete soubor: </h3>\s*<div class="textbox">(?P<N>[^<]+)</div>' + FILE_SIZE_PATTERN = r'<h3>Velikost souboru je: </h3>\s*<div class="textbox">(?P<S>[^<]+)</div>' + FILE_OFFLINE_PATTERN = r'<h3>Soubor ".*?" nebyl nalezen.</h3>' + + DOWNLOAD_LINK_PATTERN = r'id="download_link" href="(?P<url>.*?)"' + + def handleFree(self): + found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + if not found: self.parseError('Download link') + url = found.group('url') + self.logDebug('Download link: ' + url) + self.download(url) + +getInfo = create_getInfo(WebshareCz)
\ No newline at end of file diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 5b32b4068..a0c70d7bb 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -1,14 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +import re, subprocess, tempfile, os +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp +from module.plugins.ReCaptcha import ReCaptcha +from module.common.json_layer import json_loads class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __pattern__ = r"(http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(\d+)" - __version__ = "0.31" + __pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)" + __version__ = "0.32" __description__ = """Zippyshare.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") @@ -18,34 +20,134 @@ class ZippyshareCom(SimpleHoster): FILE_OFFLINE_PATTERN = r'>File does not exist on this server</div>' DOWNLOAD_URL_PATTERN = r"document\.getElementById\('dlbutton'\).href = ([^;]+);" - SEED_PATTERN = r"seed: (\d*)" + SEED_PATTERN = r'swfobject.embedSWF\("([^"]+)".*?seed: (\d+)' + CAPTCHA_KEY_PATTERN = r'Recaptcha.create\("([^"]+)"' + CAPTCHA_SHORTENCODE_PATTERN = r"shortencode: '([^']+)'" + CAPTCHA_DOWNLOAD_PATTERN = r"document.location = '([^']+)'" + + LAST_KNOWN_VALUES = (1, 1424574) #time = (seed * multimply) % modulo def setup(self): self.html = None self.wantReconnect = False self.multiDL = True - def handleFree(self): + def handleFree(self): url = self.get_file_url() + if not url: self.fail("Download URL not found.") self.logDebug("Download URL %s" % url) self.download(url, cookies = True) + check = self.checkDownload({ + "swf_values": re.compile(self.SEED_PATTERN) + }) + + if check == "swf_values": + swf_sts = self.getStorage("swf_sts") + if not swf_sts: + self.setStorage("swf_sts", 2) + self.setStorage("swf_stamp", 0) + elif swf_sts == '1': + self.setStorage("swf_sts", 2) + + self.retry(max_tries = 1) + def get_file_url(self): """ returns the absolute downloadable filepath """ - file_host, file_key = re.search(self.__pattern__, self.pyfile.url).groups() + url = multiply = modulo = None found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) if found: + #Method #1: JS eval url = self.js.eval(found.group(1)) else: + #Method #2: SWF eval seed_search = re.search(self.SEED_PATTERN, self.html) - if seed_search is None: self.parseError('SEED') + if seed_search: + swf_url, file_seed = seed_search.groups() + + swf_sts = self.getStorage("swf_sts") + swf_stamp = int(self.getStorage("swf_stamp") or 0) + self.logDebug("SWF", swf_sts, swf_stamp) + + if not swf_sts: + self.logDebug('Using default values') + multiply, modulo = self.LAST_KNOWN_VALUES + elif swf_sts == "1": + self.logDebug('Using stored values') + multiply = self.getStorage("multiply") + modulo = self.getStorage("modulo") + elif swf_sts == "2" and (swf_stamp + 3600000) < timestamp(): + multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url) + + if multiply and modulo: + self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo)) + url = "/download?key=%s&time=%d" % (self.file_info['KEY'], (int(file_seed) * int(multiply)) % int(modulo)) + + if not url: + #Method #3: Captcha + url = self.do_recaptcha() + + return self.file_info['HOST'] + url + + def get_swf_values(self, swf_url): + self.logDebug('Parsing values from %s' % swf_url) + multiply = modulo = None + + fd, fpath = tempfile.mkstemp() + try: + swf_data = self.load(swf_url) + os.write(fd, swf_data) + + p = subprocess.Popen(['swfdump', '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + + if err: + self.logError(err) + else: + m_str = re.search(r'::break.*?{(.*?)}', out, re.S).group(1) + multiply = re.search(r'pushbyte (\d+)', m_str).group(1) + modulo = re.search(r'pushint (\d+)', m_str).group(1) + finally: + os.close(fd) + os.remove(fpath) + + if multiply and modulo: + self.setStorage("multiply", multiply) + self.setStorage("modulo", modulo) + self.setStorage("swf_sts", 1) + else: + self.logError("Parsing SWF failed: swfdump not installed or plugin out of date") + self.setStorage("swf_sts", 2) - file_seed = int(seed_search.group(1)) - time = str((file_seed * 24) % 6743256) - url = "/download?key=" + str(file_key) + "&time=" + str(time) + self.setStorage("swf_stamp", timestamp()) + + return multiply, modulo + + def do_recaptcha(self): + self.logDebug('Trying to solve captcha') + captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) + shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1) + url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1) + + recaptcha = ReCaptcha(self) + + for i in range(5): + challenge, code = recaptcha.challenge(captcha_key) + + response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test', + post={'challenge': challenge, + 'response': code, + 'shortencode': shortencode})) + self.logDebug("reCaptcha response : %s" % response) + if response == True: + self.correctCaptcha + break + else: + self.invalidCaptcha() + else: self.fail("Invalid captcha") - return file_host + url + return url getInfo = create_getInfo(ZippyshareCom)
\ No newline at end of file |