diff options
Diffstat (limited to 'pyload/plugin/hoster')
207 files changed, 11402 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/AlldebridCom.py b/pyload/plugin/hoster/AlldebridCom.py new file mode 100644 index 000000000..9f1f689cd --- /dev/null +++ b/pyload/plugin/hoster/AlldebridCom.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import parseFileSize + + +class AlldebridCom(MultiHoster): + __name = "AlldebridCom" + __type = "hoster" + __version = "0.46" + + __pattern = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Alldebrid.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Andy Voigt", "spamsales@online.de")] + + + def setup(self): + self.chunkLimit = 16 + + + def handle_premium(self, pyfile): + password = self.getPassword() + + data = json_loads(self.load("http://www.alldebrid.com/service.php", + get={'link': pyfile.url, 'json': "true", 'pw': password})) + + self.logDebug("Json data", data) + + if data['error']: + if data['error'] == "This link isn't available on the hoster website.": + self.offline() + else: + self.logWarning(data['error']) + self.tempOffline() + else: + if pyfile.name and not pyfile.name.endswith('.tmp'): + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + self.link = data['link'] + + if self.getConfig('ssl'): + self.link = self.link.replace("http://", "https://") + else: + self.link = self.link.replace("https://", "http://") diff --git a/pyload/plugin/hoster/AndroidfilehostCom.py b/pyload/plugin/hoster/AndroidfilehostCom.py new file mode 100644 index 000000000..22cc71857 --- /dev/null +++ b/pyload/plugin/hoster/AndroidfilehostCom.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://www.androidfilehost.com/?fid=95916177934518197 + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class AndroidfilehostCom(SimpleHoster): + __name = "AndroidfilehostCom" + __type = "hoster" + __version = "0.01" + + __pattern = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Androidfilehost.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<br />(?P<N>.*?)</h1>' + SIZE_PATTERN = r'<h4>size</h4>\s*<p>(?P<S>[\d.,]+)(?P<U>[\w^_]+)</p>' + HASHSUM_PATTERN = r'<h4>(?P<T>.*?)</h4>\s*<p><code>(?P<H>.*?)</code></p>' + + OFFLINE_PATTERN = r'404 not found' + + WAIT_PATTERN = r'users must wait <strong>(\d+) secs' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + wait = re.search(self.WAIT_PATTERN, self.html) + self.logDebug("Waiting time: %s seconds" % wait.group(1)) + + fid = re.search(r'id="fid" value="(\d+)" />', self.html).group(1) + self.logDebug("fid: %s" % fid) + + html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php", + post={'submit': 'submit', + 'action': 'getdownloadmirrors', + 'fid' : fid}, + decode=True) + + self.link = re.findall('"url":"(.*?)"', html)[0].replace("\\", "") + mirror_host = self.link.split("/")[2] + + self.logDebug("Mirror Host: %s" % mirror_host) + + html = self.load("https://www.androidfilehost.com/libs/otf/stats.otf.php", + get={'fid' : fid, + 'w' : 'download', + 'mirror': mirror_host}, + decode=True) diff --git a/pyload/plugin/hoster/BasketbuildCom.py b/pyload/plugin/hoster/BasketbuildCom.py new file mode 100644 index 000000000..2e94eefe2 --- /dev/null +++ b/pyload/plugin/hoster/BasketbuildCom.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://s.basketbuild.com/filedl/devs?dev=pacman&dl=pacman/falcon/RC-3/pac_falcon-RC-3-20141103.zip +# https://s.basketbuild.com/filedl/gapps?dl=gapps-gb-20110828-signed.zip + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class BasketbuildCom(SimpleHoster): + __name = "BasketbuildCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """basketbuild.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'File Name:</strong> (?P<N>.+?)<br/>' + SIZE_PATTERN = r'File Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'404 - Page Not Found' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + try: + link1 = re.search(r'href="(.+dlgate/.+)"', self.html).group(1) + self.html = self.load(link1) + + except AttributeError: + self.error(_("Hop #1 not found")) + + else: + self.logDebug("Next hop: %s" % link1) + + try: + wait = re.search(r'var sec = (\d+)', self.html).group(1) + self.logDebug("Wait %s seconds" % wait) + self.wait(wait) + + except AttributeError: + self.logDebug("No wait time found") + + try: + self.link = re.search(r'id="dlLink">\s*<a href="(.+?)"', self.html).group(1) + + except AttributeError: + self.error(_("DL-Link not found")) diff --git a/pyload/plugin/hoster/BayfilesCom.py b/pyload/plugin/hoster/BayfilesCom.py new file mode 100644 index 000000000..b14e28dcb --- /dev/null +++ b/pyload/plugin/hoster/BayfilesCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class BayfilesCom(DeadHoster): + __name = "BayfilesCom" + __type = "hoster" + __version = "0.09" + + __pattern = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' + __config = [] + + __description = """Bayfiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugin/hoster/BezvadataCz.py b/pyload/plugin/hoster/BezvadataCz.py new file mode 100644 index 000000000..33e641635 --- /dev/null +++ b/pyload/plugin/hoster/BezvadataCz.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class BezvadataCz(SimpleHoster): + __name = "BezvadataCz" + __type = "hoster" + __version = "0.26" + + __pattern = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """BezvaData.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>' + SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[^<]+)</li>' + OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + # download button + m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) + if m is None: + self.error(_("Page 1 URL not found")) + url = "http://bezvadata.cz%s" % m.group(1) + + # captcha form + self.html = self.load(url) + self.checkErrors() + for _i in xrange(5): + action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm') + if not inputs: + self.error(_("FreeForm")) + + m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html) + if m is None: + self.error(_("Wrong captcha image")) + + # captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url + self.load, proper_load = self.loadcaptcha, self.load + try: + inputs['captcha'] = self.decryptCaptcha(m.group(1), imgtype='png') + finally: + self.load = proper_load + + if '<img src="data:image/png;base64' in self.html: + self.invalidCaptcha() + else: + self.correctCaptcha() + break + else: + self.fail(_("No valid captcha code entered")) + + # download url + self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) + self.checkErrors() + m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) + if m is None: + self.error(_("Page 2 URL not found")) + url = "http://bezvadata.cz%s" % m.group(1) + self.logDebug("DL URL %s" % url) + + # countdown + m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) + wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 + self.wait(wait_time, False) + + self.link = url + + + def checkErrors(self): + if 'images/button-download-disable.png' in self.html: + self.longWait(5 * 60, 24) #: parallel dl limit + elif '<div class="infobox' in self.html: + self.tempOffline() + + self.info.pop('error', None) + + + def loadcaptcha(self, data, *args, **kwargs): + return data.decode('base64') diff --git a/pyload/plugin/hoster/BillionuploadsCom.py b/pyload/plugin/hoster/BillionuploadsCom.py new file mode 100644 index 000000000..bed3a1d54 --- /dev/null +++ b/pyload/plugin/hoster/BillionuploadsCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class BillionuploadsCom(DeadHoster): + __name = "BillionuploadsCom" + __type = "hoster" + __version = "0.06" + + __pattern = r'http://(?:www\.)?billionuploads\.com/\w{12}' + + __description = """Billionuploads.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/BitshareCom.py b/pyload/plugin/hoster/BitshareCom.py new file mode 100644 index 000000000..0d26c2d53 --- /dev/null +++ b/pyload/plugin/hoster/BitshareCom.py @@ -0,0 +1,156 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class BitshareCom(SimpleHoster): + __name = "BitshareCom" + __type = "hoster" + __version = "0.53" + + __pattern = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Bitshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("Paul King", ""), + ("fragonib", "fragonib[AT]yahoo[DOT]es")] + + + COOKIES = [("bitshare.com", "language_selection", "EN")] + + INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</h1>' + OFFLINE_PATTERN = r'[Ff]ile (not available|was deleted|was not found)' + + AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' + TRAFFIC_USED_UP = r'Your Traffic is used up for today' + + + def setup(self): + self.multiDL = self.premium + self.chunkLimit = 1 + + + def process(self, pyfile): + if self.premium: + self.account.relogin(self.user) + + # File id + m = re.match(self.__pattern, pyfile.url) + self.file_id = max(m.group('ID1'), m.group('ID2')) + self.logDebug("File id is [%s]" % self.file_id) + + # Load main page + self.html = self.load(pyfile.url, ref=False, decode=True) + + # Check offline + if re.search(self.OFFLINE_PATTERN, self.html): + self.offline() + + # Check Traffic used up + if re.search(self.TRAFFIC_USED_UP, self.html): + self.logInfo(_("Your Traffic is used up for today")) + self.wait(30 * 60, True) + self.retry() + + # File name + m = re.match(self.__pattern, pyfile.url) + name1 = m.group('NAME') if m else None + + m = re.search(self.INFO_PATTERN, self.html) + name2 = m.group('N') if m else None + + pyfile.name = max(name1, name2) + + # Ajax file id + self.ajaxid = re.search(self.AJAXID_PATTERN, self.html).group(1) + self.logDebug("File ajax id is [%s]" % self.ajaxid) + + # This may either download our file or forward us to an error page + self.link = self.getDownloadUrl() + + if self.checkDownload({"error": ">Error occured<"}): + self.retry(5, 5 * 60, "Bitshare host : Error occured") + + + def getDownloadUrl(self): + # Return location if direct download is active + if self.premium: + header = self.load(self.pyfile.url, just_header=True) + if 'location' in header: + return header['location'] + + # Get download info + self.logDebug("Getting download info") + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "generateID", "ajaxid": self.ajaxid}) + + self.handleErrors(res, ':') + + parts = res.split(":") + filetype = parts[0] + wait = int(parts[1]) + captcha = int(parts[2]) + + self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) + + # Waiting + if wait > 0: + self.logDebug("Waiting %d seconds." % wait) + if wait < 120: + self.wait(wait, False) + else: + self.wait(wait - 55, True) + self.retry() + + # Resolve captcha + if captcha == 1: + self.logDebug("File is captcha protected") + recaptcha = ReCaptcha(self) + + # Try up to 3 times + for _i in xrange(3): + response, challenge = recaptcha.challenge() + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request" : "validateCaptcha", + "ajaxid" : self.ajaxid, + "recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response}) + if self.handleCaptchaErrors(res): + break + + # Get download URL + self.logDebug("Getting download url") + res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", + post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + + self.handleErrors(res, '#') + + url = res.split("#")[-1] + + return url + + + def handleErrors(self, res, separator): + self.logDebug("Checking response [%s]" % res) + if "ERROR:Session timed out" in res: + self.retry() + elif "ERROR" in res: + msg = res.split(separator)[-1] + self.fail(msg) + + + def handleCaptchaErrors(self, res): + self.logDebug("Result of captcha resolving [%s]" % res) + if "SUCCESS" in res: + self.correctCaptcha() + return True + elif "ERROR:SESSION ERROR" in res: + self.retry() + + self.invalidCaptcha() diff --git a/pyload/plugin/hoster/BoltsharingCom.py b/pyload/plugin/hoster/BoltsharingCom.py new file mode 100644 index 000000000..10716e695 --- /dev/null +++ b/pyload/plugin/hoster/BoltsharingCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class BoltsharingCom(DeadHoster): + __name = "BoltsharingCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?boltsharing\.com/\w{12}' + __config = [] + + __description = """Boltsharing.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/CatShareNet.py b/pyload/plugin/hoster/CatShareNet.py new file mode 100644 index 000000000..124d22591 --- /dev/null +++ b/pyload/plugin/hoster/CatShareNet.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class CatShareNet(SimpleHoster): + __name = "CatShareNet" + __type = "hoster" + __version = "0.13" + + __pattern = r'http://(?:www\.)?catshare\.net/\w{16}' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """CatShare.net hoster plugin""" + __license = "GPLv3" + __authors = [("z00nx", "z00nx0@gmail.com"), + ("prOq", ""), + ("Walter Purcaro", "vuolter@gmail.com")] + + + TEXT_ENCODING = True + + INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' + OFFLINE_PATTERN = r'<div class="alert alert-error"' + + IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' + WAIT_PATTERN = r'var\scount\s=\s(\d+);' + + LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' + LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' + + + def setup(self): + self.multiDL = self.premium + self.resumeDownload = True + + + def checkErrors(self): + m = re.search(self.IP_BLOCKED_PATTERN, self.html) + if m: + self.fail(_("Only connections from Polish IP address are allowed")) + + return super(CatShareNet, self).checkErrors() + + + def handle_free(self, pyfile): + recaptcha = ReCaptcha(self) + + response, challenge = recaptcha.challenge() + self.html = self.load(pyfile.url, + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) diff --git a/pyload/plugin/hoster/CloudzerNet.py b/pyload/plugin/hoster/CloudzerNet.py new file mode 100644 index 000000000..c1b3beae8 --- /dev/null +++ b/pyload/plugin/hoster/CloudzerNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class CloudzerNet(DeadHoster): + __name = "CloudzerNet" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' + __config = [] + + __description = """Cloudzer.net hoster plugin""" + __license = "GPLv3" + __authors = [("gs", "I-_-I-_-I@web.de"), + ("z00nx", "z00nx0@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/CloudzillaTo.py b/pyload/plugin/hoster/CloudzillaTo.py new file mode 100644 index 000000000..7b1faaed2 --- /dev/null +++ b/pyload/plugin/hoster/CloudzillaTo.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class CloudzillaTo(SimpleHoster): + __name = "CloudzillaTo" + __type = "hoster" + __version = "0.06" + + __pattern = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Cloudzilla.to hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'title="(?P<N>.+?)">\1</span> <span class="size">\((?P<S>[\d.]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File not found...<' + + PASSWORD_PATTERN = r'<div id="pwd_protected">' + + + def checkErrors(self): + m = re.search(self.PASSWORD_PATTERN, self.html) + if m: + self.html = self.load(self.pyfile.url, get={'key': self.getPassword()}) + + if re.search(self.PASSWORD_PATTERN, self.html): + self.retry(reason="Wrong password") + + + def handle_free(self, pyfile): + self.html = self.load("http://www.cloudzilla.to/generateticket/", + post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) + + ticket = dict(re.findall(r'<(.+?)>([^<>]+?)</', self.html)) + + self.logDebug(ticket) + + if 'error' in ticket: + if "File is password protected" in ticket['error']: + self.retry(reason="Wrong password") + else: + self.fail(ticket['error']) + + if 'wait' in ticket: + self.wait(ticket['wait'], int(ticket['wait']) > 5) + + self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], + 'file_id' : self.info['pattern']['ID'], + 'ticket_id': ticket['ticket_id']} + + + def handle_premium(self, pyfile): + return self.handle_free(pyfile) diff --git a/pyload/plugin/hoster/CramitIn.py b/pyload/plugin/hoster/CramitIn.py new file mode 100644 index 000000000..9d8d4960d --- /dev/null +++ b/pyload/plugin/hoster/CramitIn.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class CramitIn(XFSHoster): + __name = "CramitIn" + __type = "hoster" + __version = "0.07" + + __pattern = r'http://(?:www\.)?cramit\.in/\w{12}' + + __description = """Cramit.in hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' + + LINK_PATTERN = r'href="(http://cramit\.in/file_download/.*?)"' diff --git a/pyload/plugin/hoster/CrockoCom.py b/pyload/plugin/hoster/CrockoCom.py new file mode 100644 index 000000000..aaced0cdb --- /dev/null +++ b/pyload/plugin/hoster/CrockoCom.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class CrockoCom(SimpleHoster): + __name = "CrockoCom" + __type = "hoster" + __version = "0.19" + + __pattern = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Crocko hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' + SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' + OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found' + + CAPTCHA_PATTERN = r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';" + + FORM_PATTERN = r'<form method="post" action="(.+?)">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?.*?>' + + NAME_REPLACEMENTS = [(r'<.*?>', '')] + + + def handle_free(self, pyfile): + if "You need Premium membership to download this file." in self.html: + self.fail(_("You need Premium membership to download this file")) + + for _i in xrange(5): + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + url, wait_time = 'http://crocko.com' + m.group(1), int(m.group(2)) + self.wait(wait_time) + self.html = self.load(url) + else: + break + + m = re.search(self.FORM_PATTERN, self.html, re.S) + if m is None: + self.error(_("FORM_PATTERN not found")) + + action, form = m.groups() + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + self.download(action, post=inputs) + + if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): + self.invalidCaptcha() + else: + break + else: + self.fail(_("No valid captcha solution received")) diff --git a/pyload/plugin/hoster/CyberlockerCh.py b/pyload/plugin/hoster/CyberlockerCh.py new file mode 100644 index 000000000..b56736a8e --- /dev/null +++ b/pyload/plugin/hoster/CyberlockerCh.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class CyberlockerCh(DeadHoster): + __name = "CyberlockerCh" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?cyberlocker\.ch/\w+' + __config = [] + + __description = """Cyberlocker.ch hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/CzshareCom.py b/pyload/plugin/hoster/CzshareCom.py new file mode 100644 index 000000000..85ed238f0 --- /dev/null +++ b/pyload/plugin/hoster/CzshareCom.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://czshare.com/5278880/random.bin + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import parseFileSize + + +class CzshareCom(SimpleHoster): + __name = "CzshareCom" + __type = "hoster" + __version = "0.99" + + __pattern = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """CZshare.com hoster plugin, now Sdilej.cz""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=.*?>(?P<N>[^<]+)</a>' + SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>' + OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">' + + SIZE_REPLACEMENTS = [(' ', '')] + URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + + CHECK_TRAFFIC = True + + FREE_URL_PATTERN = r'<a href="(.+?)" class="page-download">[^>]*alt="(.+?)" /></a>' + FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>' + PREMIUM_FORM_PATTERN = r'<form action="/profi_down\.php" method="post">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="(.+?)" value="(.+?)"[^>]*/>' + MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>' + USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' + + + def checkTrafficLeft(self): + # check if user logged in + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: + self.account.relogin(self.user) + self.html = self.load(self.pyfile.url, decode=True) + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: + return False + + # check user credit + try: + credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) + self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) + self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) + if credit < self.pyfile.size: + self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) + return False + except Exception, e: + # let's continue and see what happens... + self.logError(e) + + return True + + + def handle_premium(self, pyfile): + # parse download link + try: + form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + except Exception, e: + self.logError(e) + self.resetAccount() + + # download the file, destination is determined by pyLoad + self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) + + + def handle_free(self, pyfile): + # get free url + m = re.search(self.FREE_URL_PATTERN, self.html) + if m is None: + self.error(_("FREE_URL_PATTERN not found")) + + parsed_url = "http://sdilej.cz" + m.group(1) + + self.logDebug("PARSED_URL:" + parsed_url) + + # get download ticket and parse html + self.html = self.load(parsed_url, decode=True) + if re.search(self.MULTIDL_PATTERN, self.html): + self.longWait(5 * 60, 12) + + try: + form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) + inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) + pyfile.size = int(inputs['size']) + + except Exception, e: + self.logError(e) + self.error(_("Form")) + + # get and decrypt captcha + captcha_url = 'http://sdilej.cz/captcha.php' + for _i in xrange(5): + inputs['captchastring2'] = self.decryptCaptcha(captcha_url) + self.html = self.load(parsed_url, post=inputs, decode=True) + + if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html: + self.invalidCaptcha() + + elif re.search(self.MULTIDL_PATTERN, self.html): + self.longWait(5 * 60, 12) + + else: + self.correctCaptcha() + break + else: + self.fail(_("No valid captcha code entered")) + + m = re.search("countdown_number = (\d+);", self.html) + self.setWait(int(m.group(1)) if m else 50) + + # download the file, destination is determined by pyLoad + self.logDebug("WAIT URL", self.req.lastEffectiveURL) + + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) + if m is None: + self.error(_("Download URL not found")) + + self.link = "http://%s/download.php?%s" % (m.group(1), m.group(2)) + + self.wait() + + + def checkFile(self, rules={}): + # check download + check = self.checkDownload({ + "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + "multi-dl" : re.compile(self.MULTIDL_PATTERN), + "captcha" : "<li>Zadaný ověřovací kód nesouhlasí!</li>" + }) + + if check == "temp offline": + self.fail(_("File not available - try later")) + + elif check == "credit": + self.resetAccount() + + elif check == "multi-dl": + self.longWait(5 * 60, 12) + + elif check == "captcha": + self.invalidCaptcha() + self.retry() + + return super(CzshareCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/DailymotionCom.py b/pyload/plugin/hoster/DailymotionCom.py new file mode 100644 index 000000000..3fdac761c --- /dev/null +++ b/pyload/plugin/hoster/DailymotionCom.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.datatype.File import statusMap +from pyload.utils import json_loads +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster + + +def getInfo(urls): + result = [] + regex = re.compile(DailymotionCom.__pattern) + apiurl = "https://api.dailymotion.com/video/%s" + request = {"fields": "access_error,status,title"} + + for url in urls: + id = regex.match(url).group('ID') + html = getURL(apiurl % id, get=request) + info = json_loads(html) + + name = info['title'] + ".mp4" if "title" in info else url + + if "error" in info or info['access_error']: + status = "offline" + else: + status = info['status'] + if status in ("ready", "published"): + status = "online" + elif status in ("waiting", "processing"): + status = "temp. offline" + else: + status = "offline" + + result.append((name, 0, statusMap[status], url)) + + return result + + +class DailymotionCom(Hoster): + __name = "DailymotionCom" + __type = "hoster" + __version = "0.20" + + __pattern = r'https?://(?:www\.)?dailymotion\.com/.*video/(?P<ID>[\w^_]+)' + __config = [("quality", "Lowest;LD 144p;LD 240p;SD 384p;HQ 480p;HD 720p;HD 1080p;Highest", "Quality", "Highest")] + + __description = """Dailymotion.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def getStreams(self): + streams = [] + + for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", + self.html): + url = result.group('URL') + qf = result.group('QF') + + link = url.replace("\\", "") + quality = tuple(int(x) for x in qf.split("x")) + + streams.append((quality, link)) + + return sorted(streams, key=lambda x: x[0][::-1]) + + + def getQuality(self): + q = self.getConfig('quality') + + if q == "Lowest": + quality = 0 + elif q == "Highest": + quality = -1 + else: + quality = int(q.rsplit(" ")[1][:-1]) + + return quality + + + def getLink(self, streams, quality): + if quality > 0: + for x, s in [item for item in enumerate(streams)][::-1]: + qf = s[0][1] + if qf <= quality: + idx = x + break + else: + idx = 0 + else: + idx = quality + + s = streams[idx] + + self.logInfo(_("Download video quality %sx%s") % s[0]) + + return s[1] + + + def checkInfo(self, pyfile): + pyfile.name, pyfile.size, pyfile.status, pyfile.url = getInfo([pyfile.url])[0] + + if pyfile.status == 1: + self.offline() + + elif pyfile.status == 6: + self.tempOffline() + + + def process(self, pyfile): + self.checkInfo(pyfile) + + id = re.match(self.__pattern, pyfile.url).group('ID') + self.html = self.load("http://www.dailymotion.com/embed/video/" + id, decode=True) + + streams = self.getStreams() + quality = self.getQuality() + + self.download(self.getLink(streams, quality)) diff --git a/pyload/plugin/hoster/DataHu.py b/pyload/plugin/hoster/DataHu.py new file mode 100644 index 000000000..16b3c2737 --- /dev/null +++ b/pyload/plugin/hoster/DataHu.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://data.hu/get/6381232/random.bin + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class DataHu(SimpleHoster): + __name = "DataHu" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?data\.hu/get/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Data.hu hoster plugin""" + __license = "GPLv3" + __authors = [("crash", ""), + ("stickell", "l.stickell@yahoo.it")] + + + INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>' + OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' + LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="(.+?)">' + + + def setup(self): + self.resumeDownload = True + self.multiDL = self.premium diff --git a/pyload/plugin/hoster/DataportCz.py b/pyload/plugin/hoster/DataportCz.py new file mode 100644 index 000000000..15ae7d0d6 --- /dev/null +++ b/pyload/plugin/hoster/DataportCz.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class DataportCz(SimpleHoster): + __name = "DataportCz" + __type = "hoster" + __version = "0.41" + + __pattern = r'http://(?:www\.)?dataport\.cz/file/(.+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Dataport.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<span itemprop="name">(?P<N>[^<]+)</span>' + SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>' + OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>' + + CAPTCHA_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"' + FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' + + + def handle_free(self, pyfile): + captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} + + for _i in xrange(60): + action, inputs = self.parseHtmlForm('free_download_form') + self.logDebug(action, inputs) + if not action or not inputs: + self.error(_("free_download_form")) + + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] + else: + self.error(_("captcha")) + + self.download("http://www.dataport.cz%s" % action, post=inputs) + + check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + if check == "captcha": + self.error(_("invalid captcha")) + + elif check == "slot": + self.logDebug("No free slots - wait 60s and retry") + self.wait(60, False) + self.html = self.load(pyfile.url, decode=True) + continue + + else: + break diff --git a/pyload/plugin/hoster/DateiTo.py b/pyload/plugin/hoster/DateiTo.py new file mode 100644 index 000000000..eaca8d6db --- /dev/null +++ b/pyload/plugin/hoster/DateiTo.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class DateiTo(SimpleHoster): + __name = "DateiTo" + __type = "hoster" + __version = "0.07" + + __pattern = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Datei.to hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</' + SIZE_PATTERN = r'Dateigröße:</td>\s*<td colspan="2">(?P<S>.*?)</' + OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wähle deine Datei aus... <' + + WAIT_PATTERN = r'countdown\({seconds: (\d+)' + MULTIDL_PATTERN = r'>Du lädst bereits eine Datei herunter<' + + DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' + + + def handle_free(self, pyfile): + url = 'http://datei.to/ajax/download.php' + data = {'P': 'I', 'ID': self.info['pattern']['ID']} + recaptcha = ReCaptcha(self) + + for _i in xrange(10): + self.logDebug("URL", url, "POST", data) + self.html = self.load(url, post=data) + self.checkErrors() + + if url.endswith('download.php') and 'P' in data: + if data['P'] == 'I': + self.doWait() + + elif data['P'] == 'IV': + break + + m = re.search(self.DATA_PATTERN, self.html) + if m is None: + self.error(_("data")) + url = 'http://datei.to/' + m.group(1) + data = dict(x.split('=') for x in m.group(2).split('&')) + + if url.endswith('recaptcha.php'): + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() + else: + self.fail(_("Too bad...")) + + self.link = self.html + + + def checkErrors(self): + m = re.search(self.MULTIDL_PATTERN, self.html) + if m: + m = re.search(self.WAIT_PATTERN, self.html) + wait_time = int(m.group(1)) if m else 30 + + errmsg = self.info['error'] = _("Parallel downloads") + self.retry(wait_time=wait_time, reason=errmsg) + + self.info.pop('error', None) + + + def doWait(self): + m = re.search(self.WAIT_PATTERN, self.html) + wait_time = int(m.group(1)) if m else 30 + + self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) + self.wait(wait_time, False) diff --git a/pyload/plugin/hoster/DdlstorageCom.py b/pyload/plugin/hoster/DdlstorageCom.py new file mode 100644 index 000000000..53c0df7cb --- /dev/null +++ b/pyload/plugin/hoster/DdlstorageCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class DdlstorageCom(DeadHoster): + __name = "DdlstorageCom" + __type = "hoster" + __version = "1.02" + + __pattern = r'https?://(?:www\.)?ddlstorage\.com/\w+' + __config = [] + + __description = """DDLStorage.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/DebridItaliaCom.py b/pyload/plugin/hoster/DebridItaliaCom.py new file mode 100644 index 000000000..56bb355d5 --- /dev/null +++ b/pyload/plugin/hoster/DebridItaliaCom.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class DebridItaliaCom(MultiHoster): + __name = "DebridItaliaCom" + __type = "hoster" + __version = "0.17" + + __pattern = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Debriditalia.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [("https://", "http://")] + + + def handle_premium(self, pyfile): + self.html = self.load("http://www.debriditalia.com/api.php", + get={'generate': "on", 'link': pyfile.url, 'p': self.getPassword()}) + + if "ERROR:" not in self.html: + self.link = self.html.strip() + else: + self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip() + + self.html = self.load("http://debriditalia.com/linkgen2.php", + post={'xjxfun' : "convertiLink", + 'xjxargs[]': "S<![CDATA[%s]]>" % pyfile.url, + 'xjxargs[]': "S%s" % self.getPassword()}) + try: + self.link = re.search(r'<a href="(.+?)"', self.html).group(1) + except AttributeError: + pass diff --git a/pyload/plugin/hoster/DepositfilesCom.py b/pyload/plugin/hoster/DepositfilesCom.py new file mode 100644 index 000000000..49f9d4384 --- /dev/null +++ b/pyload/plugin/hoster/DepositfilesCom.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class DepositfilesCom(SimpleHoster): + __name = "DepositfilesCom" + __type = "hoster" + __version = "0.55" + + __pattern = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Depositfiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\'' + SIZE_PATTERN = r': <b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</b>' + OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>' + + NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), + (r'.*<b title="(?P<N>.+?)".*', "\g<N>")] + URL_REPLACEMENTS = [(__pattern + ".*", "https://dfiles.eu/files/\g<ID>")] + + COOKIES = [("dfiles.eu", "lang_current", "en")] + + WAIT_PATTERN = r'(?:download_waiter_remain">|html_download_api-limit_interval">|>Please wait|>Try in).+' + ERROR_PATTER = r'File is checked, please try again in a minute' + + LINK_FREE_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' + LINK_PREMIUM_PATTERN = r'class="repeat"><a href="(.+?)"' + LINK_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' + + + def handle_free(self, pyfile): + self.html = self.load(pyfile.url, post={'gateway_result': "1"}) + + self.checkErrors() + + m = re.search(r"var fid = '(\w+)';", self.html) + if m is None: + self.retry(wait_time=5) + params = {'fid': m.group(1)} + self.logDebug("FID: %s" % params['fid']) + + self.checkErrors() + + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key is None: + return + + self.html = self.load("https://dfiles.eu/get_file.php", get=params) + + if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: + params['response'], params['challenge'] = recaptcha.challenge(captcha_key) + self.html = self.load("https://dfiles.eu/get_file.php", get=params) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = urllib.unquote(m.group(1)) + + + def handle_premium(self, pyfile): + if '<span class="html_download_api-gold_traffic_limit">' in self.html: + self.logWarning(_("Download limit reached")) + self.retry(25, 60 * 60, "Download limit reached") + + elif 'onClick="show_gold_offer' in self.html: + self.account.relogin(self.user) + self.retry() + + else: + link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) + + if link: + self.link = link.group(1) + + elif mirror: + self.link = mirror.group(1) diff --git a/pyload/plugin/hoster/DevhostSt.py b/pyload/plugin/hoster/DevhostSt.py new file mode 100644 index 000000000..f35530523 --- /dev/null +++ b/pyload/plugin/hoster/DevhostSt.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://d-h.st/mM8 + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class DevhostSt(SimpleHoster): + __name = "DevhostSt" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """d-h.st hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<span title="(?P<N>.*?)"' + SIZE_PATTERN = r'</span> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<br' + HASHSUM_PATTERN = r'>(?P<T>.*?) Sum</span>: (?P<H>.*?)<br' + + OFFLINE_PATTERN = r'>File Not Found' + LINK_FREE_PATTERN = r'var product_download_url= \'(.+?)\'' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 diff --git a/pyload/plugin/hoster/DlFreeFr.py b/pyload/plugin/hoster/DlFreeFr.py new file mode 100644 index 000000000..2c4889d67 --- /dev/null +++ b/pyload/plugin/hoster/DlFreeFr.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re + +from pyload.network.Browser import Browser +from pyload.network.CookieJar import CookieJar +from pyload.plugin.captcha.AdYouLike import AdYouLike +from pyload.plugin.internal.SimpleHoster import SimpleHoster, replace_patterns +from pyload.utils import json_loads + + +class CustomBrowser(Browser): + + def __init__(self, bucket=None, options={}): + Browser.__init__(self, bucket, options) + + + def load(self, *args, **kwargs): + post = kwargs.get("post") + + if post is None and len(args) > 2: + post = args[2] + + if post: + self.http.c.setopt(pycurl.FOLLOWLOCATION, 0) + self.http.c.setopt(pycurl.POST, 1) + self.http.c.setopt(pycurl.CUSTOMREQUEST, "POST") + else: + self.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + self.http.c.setopt(pycurl.POST, 0) + self.http.c.setopt(pycurl.CUSTOMREQUEST, "GET") + + return Browser.load(self, *args, **kwargs) + + +class DlFreeFr(SimpleHoster): + __name = "DlFreeFr" + __type = "hoster" + __version = "0.28" + + __pattern = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Dl.free.fr hoster plugin""" + __license = "GPLv3" + __authors = [("the-razer", "daniel_ AT gmx DOT net"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Toilal", "toilal.dev@gmail.com")] + + + NAME_PATTERN = r'Fichier:</td>\s*<td.*?>(?P<N>[^>]*)</td>' + SIZE_PATTERN = r'Taille:</td>\s*<td.*?>(?P<S>[\d.,]+\w)o' + OFFLINE_PATTERN = r'Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n\'a pas été trouvé' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.limitDL = 5 + self.chunkLimit = 1 + + + def init(self): + factory = self.core.requestFactory + self.req = CustomBrowser(factory.bucket, factory.getOptions()) + + + def process(self, pyfile): + pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) + valid_url = pyfile.url + headers = self.load(valid_url, just_header=True) + + if headers.get('code') == 302: + valid_url = headers.get('location') + headers = self.load(valid_url, just_header=True) + + if headers.get('code') == 200: + content_type = headers.get('content-type') + if content_type and content_type.startswith("text/html"): + # Undirect acces to requested file, with a web page providing it (captcha) + self.html = self.load(valid_url) + self.handle_free(pyfile) + else: + # Direct access to requested file for users using free.fr as Internet Service Provider. + self.link = valid_url + + elif headers.get('code') == 404: + self.offline() + + else: + self.fail(_("Invalid return code: ") + str(headers.get('code'))) + + + def handle_free(self, pyfile): + action, inputs = self.parseHtmlForm('action="getfile.pl"') + + adyoulike = AdYouLike(self) + response, challenge = adyoulike.challenge() + inputs.update(response) + + self.load("http://dl.free.fr/getfile.pl", post=inputs) + headers = self.getLastHeaders() + if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers: + m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie")) + cj = CookieJar(__name) + if m: + cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) + else: + self.fail(_("Cookie error")) + + self.link = headers.get("location") + + self.req.setCookieJar(cj) + else: + self.fail(_("Invalid response")) + + + def getLastHeaders(self): + # parse header + header = {"code": self.req.code} + for line in self.req.http.header.splitlines(): + line = line.strip() + if not line or ":" not in line: + continue + + key, none, value = line.partition(":") + key = key.lower().strip() + value = value.strip() + + if key in header: + if type(header[key]) == list: + header[key].append(value) + else: + header[key] = [header[key], value] + else: + header[key] = value + return header diff --git a/pyload/plugin/hoster/DodanePl.py b/pyload/plugin/hoster/DodanePl.py new file mode 100644 index 000000000..8edbb64c0 --- /dev/null +++ b/pyload/plugin/hoster/DodanePl.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class DodanePl(DeadHoster): + __name = "DodanePl" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?dodane\.pl/file/\d+' + __config = [] + + __description = """Dodane.pl hoster plugin""" + __license = "GPLv3" + __authors = [("z00nx", "z00nx0@gmail.com")] diff --git a/pyload/plugin/hoster/DuploadOrg.py b/pyload/plugin/hoster/DuploadOrg.py new file mode 100644 index 000000000..decd1a7ff --- /dev/null +++ b/pyload/plugin/hoster/DuploadOrg.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class DuploadOrg(DeadHoster): + __name = "DuploadOrg" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?dupload\.org/\w{12}' + __config = [] + + __description = """Dupload.grg hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/EasybytezCom.py b/pyload/plugin/hoster/EasybytezCom.py new file mode 100644 index 000000000..8dcb04b98 --- /dev/null +++ b/pyload/plugin/hoster/EasybytezCom.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class EasybytezCom(XFSHoster): + __name = "EasybytezCom" + __type = "hoster" + __version = "0.23" + + __pattern = r'http://(?:www\.)?easybytez\.com/\w{12}' + + __description = """Easybytez.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + OFFLINE_PATTERN = r'>File not available' + + LINK_PATTERN = r'(http://(\w+\.(easybytez|easyload|ezbytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/.+?)["\'<]' diff --git a/pyload/plugin/hoster/EdiskCz.py b/pyload/plugin/hoster/EdiskCz.py new file mode 100644 index 000000000..7f5f76b73 --- /dev/null +++ b/pyload/plugin/hoster/EdiskCz.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class EdiskCz(SimpleHoster): + __name = "EdiskCz" + __type = "hoster" + __version = "0.23" + + __pattern = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Edisk.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<span class="fl" title="(?P<N>.+?)">\s*.*?\((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</h1></span>' + OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>' + + ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' + LINK_FREE_PATTERN = r'http://.*edisk\.cz.*\.html' + + + def setup(self): + self.multiDL = False + + + def process(self, pyfile): + url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) + + self.logDebug("URL:" + url) + + m = re.search(self.ACTION_PATTERN, url) + if m is None: + self.error(_("ACTION_PATTERN not found")) + action = m.group(1) + + self.html = self.load(url, decode=True) + self.getFileInfo() + + self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url)) + + url = self.load(re.sub("/en/download/", "/x-download/", url), post={ + "action": action + }) + + if not re.match(self.LINK_FREE_PATTERN, url): + self.fail(_("Unexpected server response")) + + self.link = url diff --git a/pyload/plugin/hoster/EgoFilesCom.py b/pyload/plugin/hoster/EgoFilesCom.py new file mode 100644 index 000000000..f87c96dd1 --- /dev/null +++ b/pyload/plugin/hoster/EgoFilesCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class EgoFilesCom(DeadHoster): + __name = "EgoFilesCom" + __type = "hoster" + __version = "0.16" + + __pattern = r'https?://(?:www\.)?egofiles\.com/\w+' + __config = [] + + __description = """Egofiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/EnteruploadCom.py b/pyload/plugin/hoster/EnteruploadCom.py new file mode 100644 index 000000000..e64c284f6 --- /dev/null +++ b/pyload/plugin/hoster/EnteruploadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class EnteruploadCom(DeadHoster): + __name = "EnteruploadCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?enterupload\.com/\w+' + __config = [] + + __description = """EnterUpload.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/EpicShareNet.py b/pyload/plugin/hoster/EpicShareNet.py new file mode 100644 index 000000000..05a1aca40 --- /dev/null +++ b/pyload/plugin/hoster/EpicShareNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class EpicShareNet(DeadHoster): + __name = "EpicShareNet" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)?epicshare\.net/\w{12}' + __config = [] + + __description = """EpicShare.net hoster plugin""" + __license = "GPLv3" + __authors = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] diff --git a/pyload/plugin/hoster/EuroshareEu.py b/pyload/plugin/hoster/EuroshareEu.py new file mode 100644 index 000000000..09fd1bf5b --- /dev/null +++ b/pyload/plugin/hoster/EuroshareEu.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class EuroshareEu(SimpleHoster): + __name = "EuroshareEu" + __type = "hoster" + __version = "0.28" + + __pattern = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Euroshare.eu hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' + + LINK_FREE_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' + + ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' + + URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] + + + def handle_premium(self, pyfile): + if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: + self.account.relogin(self.user) + self.retry(reason=_("User not logged in")) + + self.link = pyfile.url.rstrip('/') + "/download/" + + check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), + "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + + if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): + self.account.relogin(self.user) + self.retry(reason=_("Access token expired")) + + elif check == "json": + self.fail(self.lastCheck.group(1)) + + + def handle_free(self, pyfile): + if re.search(self.ERR_PARDL_PATTERN, self.html): + self.longWait(5 * 60, 12) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = "http://euroshare.eu%s" % m.group(1) + + + def checkFile(self, rules={}): + if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) + self.longWait(5 * 60, 12) + + return super(EuroshareEu, self).checkFile(rules) diff --git a/pyload/plugin/hoster/ExashareCom.py b/pyload/plugin/hoster/ExashareCom.py new file mode 100644 index 000000000..6036da66d --- /dev/null +++ b/pyload/plugin/hoster/ExashareCom.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class ExashareCom(XFSHoster): + __name = "ExashareCom" + __type = "hoster" + __version = "0.01" + + __pattern = r'http://(?:www\.)?exashare\.com/\w{12}' + + __description = """Exashare.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'>(?P<NAME>.+?)<small>\( (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + LINK_FREE_PATTERN = r'file: "(.+?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + else: + self.link = m.group(1) diff --git a/pyload/plugin/hoster/ExtabitCom.py b/pyload/plugin/hoster/ExtabitCom.py new file mode 100644 index 000000000..6fd65842d --- /dev/null +++ b/pyload/plugin/hoster/ExtabitCom.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.utils import json_loads + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, secondsToMidnight + + +class ExtabitCom(SimpleHoster): + __name = "ExtabitCom" + __type = "hoster" + __version = "0.65" + + __pattern = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Extabit.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>.+?)">' + SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' + OFFLINE_PATTERN = r'>File not found<' + TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' + + LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' + + + def handle_free(self, pyfile): + if r">Only premium users can download this file" in self.html: + self.fail(_("Only premium users can download this file")) + + m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html) + if m: + self.wait(int(m.group(1)) * 60, True) + elif "The daily downloads limit from your IP is exceeded" in self.html: + self.logWarning(_("You have reached your daily downloads limit for today")) + self.wait(secondsToMidnight(gmt=2), True) + + self.logDebug("URL: " + self.req.http.lastEffectiveURL) + m = re.match(self.__pattern, self.req.http.lastEffectiveURL) + fileID = m.group('ID') if m else self.info['pattern']['ID'] + + m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) + if m: + recaptcha = ReCaptcha(self) + captcha_key = m.group(1) + + for _i in xrange(5): + get_data = {"type": "recaptcha"} + get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) + res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + if "ok" in res: + self.correctCaptcha() + break + else: + self.invalidCaptcha() + else: + self.fail(_("Invalid captcha")) + else: + self.error(_("Captcha")) + + if not "href" in res: + self.error(_("Bad JSON response")) + + self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/FastixRu.py b/pyload/plugin/hoster/FastixRu.py new file mode 100644 index 000000000..0f79ac44c --- /dev/null +++ b/pyload/plugin/hoster/FastixRu.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class FastixRu(MultiHoster): + __name = "FastixRu" + __type = "hoster" + __version = "0.11" + + __pattern = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Fastix multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Massimo Rosamilia", "max@spiritix.eu")] + + + def setup(self): + self.chunkLimit = 3 + + + def handle_premium(self, pyfile): + api_key = self.account.getAccountData(self.user) + api_key = api_key['api'] + + self.html = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) + + data = json_loads(self.html) + + self.logDebug("Json data", data) + + if "error\":true" in self.html: + self.offline() + else: + self.link = data['downloadlink'] diff --git a/pyload/plugin/hoster/FastshareCz.py b/pyload/plugin/hoster/FastshareCz.py new file mode 100644 index 000000000..cd054b61c --- /dev/null +++ b/pyload/plugin/hoster/FastshareCz.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FastshareCz(SimpleHoster): + __name = "FastshareCz" + __type = "hoster" + __version = "0.29" + + __pattern = r'http://(?:www\.)?fastshare\.cz/\d+/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FastShare.cz hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + URL_REPLACEMENTS = [("#.*", "")] + + COOKIES = [("fastshare.cz", "lang", "en")] + + NAME_PATTERN = r'<h3 class="section_title">(?P<N>.+?)<' + SIZE_PATTERN = r'>Size\s*:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)' + + LINK_FREE_PATTERN = r'>Enter the code\s*:</em>\s*<span><img src="(.+?)"' + LINK_PREMIUM_PATTERN = r'(http://\w+\.fastshare\.cz/download\.php\?id=\d+&)' + + SLOT_ERROR = "> 100% of FREE slots are full" + CREDIT_ERROR = " credit for " + + + def checkErrors(self): + if self.SLOT_ERROR in self.html: + errmsg = self.info['error'] = _("No free slots") + self.retry(12, 60, errmsg) + + if self.CREDIT_ERROR in self.html: + errmsg = self.info['error'] = _("Not enough traffic left") + self.logWarning(errmsg) + self.resetAccount() + + self.info.pop('error', None) + + + def handle_free(self, pyfile): + m = re.search(self.FREE_URL_PATTERN, self.html) + if m: + action, captcha_src = m.groups() + else: + self.error(_("FREE_URL_PATTERN not found")) + + baseurl = "http://www.fastshare.cz" + captcha = self.decryptCaptcha(urlparse.urljoin(baseurl, captcha_src)) + self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) + + + def checkFile(self, rules={}): + check = self.checkDownload({ + 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), + 'wrong captcha': re.compile(r'Download for FREE'), + 'credit' : re.compile(self.CREDIT_ERROR) + }) + + if check == "paralell-dl": + self.retry(6, 10 * 60, _("Paralell download")) + + elif check == "wrong captcha": + self.retry(max_tries=5, reason=_("Wrong captcha")) + + elif check == "credit": + self.resetAccount() + + return super(FastshareCz, self).checkFile(rules) diff --git a/pyload/plugin/hoster/FileApeCom.py b/pyload/plugin/hoster/FileApeCom.py new file mode 100644 index 000000000..87d995817 --- /dev/null +++ b/pyload/plugin/hoster/FileApeCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FileApeCom(DeadHoster): + __name = "FileApeCom" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' + __config = [] + + __description = """FileApe.com hoster plugin""" + __license = "GPLv3" + __authors = [("espes", "")] diff --git a/pyload/plugin/hoster/FileSharkPl.py b/pyload/plugin/hoster/FileSharkPl.py new file mode 100644 index 000000000..9a90352bb --- /dev/null +++ b/pyload/plugin/hoster/FileSharkPl.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FileSharkPl(SimpleHoster): + __name = "FileSharkPl" + __type = "hoster" + __version = "0.10" + + __pattern = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FileShark.pl hoster plugin""" + __license = "GPLv3" + __authors = [("prOq", ""), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>' + SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>' + OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' + + LINK_FREE_PATTERN = r'<a rel="nofollow" href="(.*?)" class="btn-upload-free">' + LINK_PREMIUM_PATTERN = r'<a rel="nofollow" href="(.*?)" class="btn-upload-premium">' + + WAIT_PATTERN = r'var timeToDownload = (\d+);' + ERROR_PATTERN = r'<p class="lead text-center alert alert-warning">(.*?)</p>' + IP_ERROR_PATTERN = r'Strona jest dost.pna wy..cznie dla u.ytkownik.w znajduj.cych si. na terenie Polski' + SLOT_ERROR_PATTERN = r'Osi.gni.to maksymaln. liczb. .ci.ganych jednocze.nie plik.w\.' + + CAPTCHA_PATTERN = r'<img src="data:image/jpeg;base64,(.*?)" title="captcha"' + TOKEN_PATTERN = r'name="form\[_token\]" value="(.*?)" />' + + + def setup(self): + self.resumeDownload = True + + if self.premium: + self.multiDL = True + self.limitDL = 20 + else: + self.multiDL = False + + + def checkErrors(self): + # check if file is now available for download (-> file name can be found in html body) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + errmsg = self.info['error'] = _("Another download already run") + self.retry(15, int(m.group(1)), errmsg) + + m = re.search(self.ERROR_PATTERN, self.html) + if m: + alert = m.group(1) + + if re.match(self.IP_ERROR_PATTERN, alert): + self.fail(_("Only connections from Polish IP are allowed")) + + elif re.match(self.SLOT_ERROR_PATTERN, alert): + errmsg = self.info['error'] = _("No free download slots available") + self.logWarning(errmsg) + self.retry(10, 30 * 60, _("Still no free download slots available")) + + else: + self.info['error'] = alert + self.retry(10, 10 * 60, _("Try again later")) + + self.info.pop('error', None) + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Download url not found")) + + link = urlparse.urljoin("http://fileshark.pl", m.group(1)) + + self.html = self.load(link) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + seconds = int(m.group(1)) + self.logDebug("Wait %s seconds" % seconds) + self.wait(seconds) + + action, inputs = self.parseHtmlForm('action=""') + + m = re.search(self.TOKEN_PATTERN, self.html) + if m is None: + self.retry(reason=_("Captcha form not found")) + + inputs['form[_token]'] = m.group(1) + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.retry(reason=_("Captcha image not found")) + + tmp_load = self.load + self.load = self._decode64 #: work-around: injects decode64 inside decryptCaptcha + + inputs['form[captcha]'] = self.decryptCaptcha(m.group(1), imgtype='jpeg') + inputs['form[start]'] = "" + + self.load = tmp_load + + self.download(link, post=inputs, disposition=True) + + + def _decode64(self, data, *args, **kwargs): + return data.decode('base64') diff --git a/pyload/plugin/hoster/FileStoreTo.py b/pyload/plugin/hoster/FileStoreTo.py new file mode 100644 index 000000000..8670577df --- /dev/null +++ b/pyload/plugin/hoster/FileStoreTo.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FileStoreTo(SimpleHoster): + __name = "FileStoreTo" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FileStore.to hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] + + + INFO_PATTERN = r'File: <span.*?>(?P<N>.+?)<.*>Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + TEMP_OFFLINE_PATTERN = r'>Der Download ist nicht bereit !<' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + self.wait(10) + self.link = self.load("http://filestore.to/ajax/download.php", + get={'D': re.search(r'"D=(\w+)', self.html).group(1)}) diff --git a/pyload/plugin/hoster/FilebeerInfo.py b/pyload/plugin/hoster/FilebeerInfo.py new file mode 100644 index 000000000..a929a0787 --- /dev/null +++ b/pyload/plugin/hoster/FilebeerInfo.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FilebeerInfo(DeadHoster): + __name = "FilebeerInfo" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' + __config = [] + + __description = """Filebeer.info plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/FilecloudIo.py b/pyload/plugin/hoster/FilecloudIo.py new file mode 100644 index 000000000..0475edeff --- /dev/null +++ b/pyload/plugin/hoster/FilecloudIo.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.utils import json_loads +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FilecloudIo(SimpleHoster): + __name = "FilecloudIo" + __type = "hoster" + __version = "0.08" + + __pattern = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Filecloud.io hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' + SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' + + UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' + + LINK_FREE_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + data = {"ukey": self.info['pattern']['ID']} + + m = re.search(self.AB1_PATTERN, self.html) + if m is None: + self.error(_("__AB1")) + data['__ab1'] = m.group(1) + + recaptcha = ReCaptcha(self) + + m = re.search(self.RECAPTCHA_PATTERN, self.html) + captcha_key = m.group(1) if m else recaptcha.detect_key() + + if captcha_key is None: + self.error(_("ReCaptcha key not found")) + + response, challenge = recaptcha.challenge(captcha_key) + self.account.form_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response} + self.account.relogin(self.user) + self.retry(2) + + json_url = "http://filecloud.io/download-request.json" + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) + + if "error" in res and res['error']: + self.fail(res) + + self.logDebug(res) + if res['captcha']: + data['ctype'] = "recaptcha" + + for _i in xrange(5): + data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) + + json_url = "http://filecloud.io/download-request.json" + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) + + if "retry" in res and res['retry']: + self.invalidCaptcha() + else: + self.correctCaptcha() + break + else: + self.fail(_("Incorrect captcha")) + + if res['dl']: + self.html = self.load('http://filecloud.io/download.html') + + m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + if "size" in self.info and self.info['size']: + self.check_data = {"size": int(self.info['size'])} + + self.link = m.group(1) + else: + self.fail(_("Unexpected server response")) + + + def handle_premium(self, pyfile): + akey = self.account.getAccountData(self.user)['akey'] + ukey = self.info['pattern']['ID'] + self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) + rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", + post={"akey": akey, "ukey": ukey}) + self.logDebug("FetchDownloadUrl: " + rep) + rep = json_loads(rep) + if rep['status'] == 'ok': + self.link = rep['download_url'] + else: + self.fail(rep['message']) diff --git a/pyload/plugin/hoster/FilefactoryCom.py b/pyload/plugin/hoster/FilefactoryCom.py new file mode 100644 index 000000000..6c4e0b807 --- /dev/null +++ b/pyload/plugin/hoster/FilefactoryCom.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo + + +def getInfo(urls): + for url in urls: + h = getURL(url, just_header=True) + m = re.search(r'Location: (.+)\r\n', h) + if m and not re.match(m.group(1), FilefactoryCom.__pattern): #: It's a direct link! Skipping + yield (url, 0, 3, url) + else: #: It's a standard html page + yield parseFileInfo(FilefactoryCom, url, getURL(url)) + + +class FilefactoryCom(SimpleHoster): + __name = "FilefactoryCom" + __type = "hoster" + __version = "0.55" + + __pattern = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Filefactory.com hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+) uploaded' + OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available|Invalid Download Link' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' + + WAIT_PATTERN = r'<div id="countdown_clock" data-delay="(\d+)">' + PREMIUM_ONLY_PATTERN = r'>Premium Account Required' + + COOKIES = [("filefactory.com", "locale", "en_US.utf8")] + + + def handle_free(self, pyfile): + if "Currently only Premium Members can download files larger than" in self.html: + self.fail(_("File too large for free download")) + elif "All free download slots on this server are currently in use" in self.html: + self.retry(50, 15 * 60, _("All free slots are busy")) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + self.link = m.group(1) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1)) + + + def checkFile(self, rules={}): + check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", + 'error' : '<div id="errorMessage">'}) + + if check == "multiple": + self.logDebug("Parallel downloads detected; waiting 15 minutes") + self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) + + elif check == "error": + self.error(_("Unknown error")) + + return super(FilefactoryCom, self).checkFile(rules) + + + def handle_premium(self, pyfile): + self.link = self.directLink(self.load(pyfile.url, just_header=True)) + + if not self.link: + html = self.load(pyfile.url) + m = re.search(self.LINK_PREMIUM_PATTERN, html) + if m: + self.link = m.group(1) + else: + self.error(_("Premium download link not found")) diff --git a/pyload/plugin/hoster/FilejungleCom.py b/pyload/plugin/hoster/FilejungleCom.py new file mode 100644 index 000000000..2fe238de8 --- /dev/null +++ b/pyload/plugin/hoster/FilejungleCom.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.hoster.FileserveCom import FileserveCom, checkFile +from pyload.plugin.Plugin import chunks + + +class FilejungleCom(FileserveCom): + __name = "FilejungleCom" + __type = "hoster" + __version = "0.51" + + __pattern = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+)' + + __description = """Filejungle.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + URLS = ["http://www.filejungle.com/f/", "http://www.filejungle.com/check_links.php", + "http://www.filejungle.com/checkReCaptcha.php"] + LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>' + LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<.*?>| )*([^<]*)' + + LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>' + + +def getInfo(urls): + for chunk in chunks(urls, 100): + yield checkFile(FilejungleCom, chunk) diff --git a/pyload/plugin/hoster/FileomCom.py b/pyload/plugin/hoster/FileomCom.py new file mode 100644 index 000000000..b01b34db0 --- /dev/null +++ b/pyload/plugin/hoster/FileomCom.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://fileom.com/gycaytyzdw3g/random.bin.html + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class FileomCom(XFSHoster): + __name = "FileomCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?fileom\.com/\w{12}' + + __description = """Fileom.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' + SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + + LINK_PATTERN = r'var url2 = \'(.+?)\';' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium diff --git a/pyload/plugin/hoster/FilepostCom.py b/pyload/plugin/hoster/FilepostCom.py new file mode 100644 index 000000000..4f7862588 --- /dev/null +++ b/pyload/plugin/hoster/FilepostCom.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from pyload.utils import json_loads +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FilepostCom(SimpleHoster): + __name = "FilepostCom" + __type = "hoster" + __version = "0.33" + + __pattern = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Filepost.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<input type="text" id="url" value=\'<a href.*?>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>' + OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">' + + PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' + RECAPTCHA_PATTERN = r'Captcha.init\({\s*key:\s*\'(.+?)\'' + FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' + + + def handle_free(self, pyfile): + m = re.search(self.FLP_TOKEN_PATTERN, self.html) + if m is None: + self.error(_("Token")) + flp_token = m.group(1) + + m = re.search(self.RECAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("Captcha key")) + captcha_key = m.group(1) + + # Get wait time + get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time.time() * 10000)) + '-xml'} + post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']} + wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) + + if wait_time > 0: + self.wait(wait_time) + + post_dict = {"token": flp_token, "code": self.info['pattern']['ID'], "file_pass": ''} + + if 'var is_pass_exists = true;' in self.html: + # Solve password + password = self.getPassword() + + if password: + self.logInfo(_("Password protected link, trying ") + file_pass) + + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' + post_dict['file_pass'] = file_pass + + self.link = self.getJsonResponse(get_dict, post_dict, 'link') + + if not self.link: + self.fail(_("Incorrect password")) + else: + self.fail(_("No password found")) + + else: + # Solve recaptcha + recaptcha = ReCaptcha(self) + + for i in xrange(5): + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' + if i: + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( + captcha_key) + self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( + captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) + + self.link = self.getJsonResponse(get_dict, post_dict, 'link') + + else: + self.fail(_("Invalid captcha")) + + + def getJsonResponse(self, get_dict, post_dict, field): + res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) + + self.logDebug(res) + + if not 'js' in res: + self.error(_("JSON %s 1") % field) + + # i changed js_answer to res['js'] since js_answer is nowhere set. + # i don't know the JSON-HTTP specs in detail, but the previous author + # accessed res['js']['error'] as well as js_answer['error']. + # see the two lines commented out with "# ~?". + if 'error' in res['js']: + + if res['js']['error'] == 'download_delay': + self.retry(wait_time=res['js']['params']['next_download']) + # ~? self.retry(wait_time=js_answer['params']['next_download']) + + elif 'Wrong file password' in res['js']['error'] \ + or 'You entered a wrong CAPTCHA code' in res['js']['error'] \ + or 'CAPTCHA Code nicht korrekt' in res['js']['error']: + return None + + elif 'CAPTCHA' in res['js']['error']: + self.logDebug("Error response is unknown, but mentions CAPTCHA") + return None + + else: + self.fail(res['js']['error']) + + if not 'answer' in res['js'] or not field in res['js']['answer']: + self.error(_("JSON %s 2") % field) + + return res['js']['answer'][field] diff --git a/pyload/plugin/hoster/FilepupNet.py b/pyload/plugin/hoster/FilepupNet.py new file mode 100644 index 000000000..6f6689de7 --- /dev/null +++ b/pyload/plugin/hoster/FilepupNet.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.filepup.net/files/k5w4ZVoF1410184283.html +# http://www.filepup.net/files/R4GBq9XH1410186553.html + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FilepupNet(SimpleHoster): + __name = "FilepupNet" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?filepup\.net/files/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Filepup.net hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'>(?P<N>.+?)</h1>' + SIZE_PATTERN = r'class="fa fa-archive"></i> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' + + OFFLINE_PATTERN = r'>This file has been deleted' + + LINK_FREE_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Download link not found")) + + dl_link = m.group(1) + self.download(dl_link, post={'task': "download"}) diff --git a/pyload/plugin/hoster/FilerNet.py b/pyload/plugin/hoster/FilerNet.py new file mode 100644 index 000000000..a0abe97cb --- /dev/null +++ b/pyload/plugin/hoster/FilerNet.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://filer.net/get/ivgf5ztw53et3ogd +# http://filer.net/get/hgo14gzcng3scbvv + +import re +import urlparse + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FilerNet(SimpleHoster): + __name = "FilerNet" + __type = "hoster" + __version = "0.19" + + __pattern = r'https?://(?:www\.)?filer\.net/get/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Filer.net hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>[\w^_]+)</small></h1>' + OFFLINE_PATTERN = r'Nicht gefunden' + + WAIT_PATTERN = r'musst du <span id="time">(\d+)' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' + + + def handle_free(self, pyfile): + inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1] + if 'token' not in inputs: + self.error(_("Unable to detect token")) + + self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True) + + inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1] + if 'hash' not in inputs: + self.error(_("Unable to detect hash")) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'hash': inputs['hash']}, follow_location=False) + + if 'location' in self.req.http.header.lower(): + self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) + self.correctCaptcha() + else: + self.invalidCaptcha() diff --git a/pyload/plugin/hoster/FilerioCom.py b/pyload/plugin/hoster/FilerioCom.py new file mode 100644 index 000000000..c55fd2c0b --- /dev/null +++ b/pyload/plugin/hoster/FilerioCom.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class FilerioCom(XFSHoster): + __name = "FilerioCom" + __type = "hoster" + __version = "0.07" + + __pattern = r'http://(?:www\.)?(filerio\.(in|com)|filekeen\.com)/\w{12}' + + __description = """FileRio.in hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + URL_REPLACEMENTS = [(r'filekeen\.com', "filerio.in")] + + OFFLINE_PATTERN = r'>"File Not Found|File has been removed' diff --git a/pyload/plugin/hoster/FilesMailRu.py b/pyload/plugin/hoster/FilesMailRu.py new file mode 100644 index 000000000..0d7f47536 --- /dev/null +++ b/pyload/plugin/hoster/FilesMailRu.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.plugin.Plugin import chunks + + +def getInfo(urls): + result = [] + for chunk in chunks(urls, 10): + for url in chunk: + html = getURL(url) + if r'<div class="errorMessage mb10">' in html: + result.append((url, 0, 1, url)) + elif r'Page cannot be displayed' in html: + result.append((url, 0, 1, url)) + else: + try: + url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' + file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0] + result.append((file_name, 0, 2, url)) + except Exception: + pass + + # status 1=OFFLINE, 2=OK, 3=UNKNOWN + # result.append((#name,#size,#status,#url)) + yield result + + +class FilesMailRu(Hoster): + __name = "FilesMailRu" + __type = "hoster" + __version = "0.32" + + __pattern = r'http://(?:www\.)?files\.mail\.ru/.+' + + __description = """Files.mail.ru hoster plugin""" + __license = "GPLv3" + __authors = [("oZiRiz", "ich@oziriz.de")] + + + def setup(self): + self.multiDL = bool(self.account) + + + def process(self, pyfile): + self.html = self.load(pyfile.url) + self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' + + # marks the file as "offline" when the pattern was found on the html-page''' + if r'<div class="errorMessage mb10">' in self.html: + self.offline() + + elif r'Page cannot be displayed' in self.html: + self.offline() + + # the filename that will be showed in the list (e.g. test.part1.rar)''' + pyfile.name = self.getFileName() + + # prepare and download''' + if not self.account: + self.prepare() + self.download(self.getFileUrl()) + self.myPostProcess() + else: + self.download(self.getFileUrl()) + self.myPostProcess() + + + def prepare(self): + """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected""" + self.setWait(10) + self.wait() + return True + + + def getFileUrl(self): + """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html""" + return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0] + + + def getFileName(self): + """gives you the Name for each file. Also extracted from the HTML-Page""" + return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0] + + + def myPostProcess(self): + # searches the file for HTMl-Code. Sometimes the Redirect + # doesn't work (maybe a curl Problem) and you get only a small + # HTML file and the Download is marked as "finished" + # then the download will be restarted. It's only bad for these + # who want download a HTML-File (it's one in a million ;-) ) + # + # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB + # so i set it to check every download because sometimes there are downloads + # that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file + # (Loading 100MB in to ram is not an option) + check = self.checkDownload({"html": "<meta name="}, read_size=50000) + if check == "html": + self.logInfo(_( + "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % + self.pyfile.name)) + self.retry() diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py new file mode 100644 index 000000000..e368adbcc --- /dev/null +++ b/pyload/plugin/hoster/FileserveCom.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.utils import json_loads +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.plugin.Plugin import chunks +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import secondsToMidnight +from pyload.utils import parseFileSize + + +def checkFile(plugin, urls): + html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True) + + file_info = [] + for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): + try: + cols = re.findall(plugin.LINKCHECK_TD, li.group(1)) + if cols: + file_info.append(( + cols[1] if cols[1] != '--' else cols[0], + parseFileSize(cols[2]) if cols[2] != '--' else 0, + 2 if cols[3].startswith('Available') else 1, + cols[0])) + except Exception, e: + continue + + return file_info + + +class FileserveCom(Hoster): + __name = "FileserveCom" + __type = "hoster" + __version = "0.54" + + __pattern = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' + + __description = """Fileserve.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("Paul King", ""), + ("zoidberg", "zoidberg@mujmail.cz")] + + + URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", + "http://www.fileserve.com/checkReCaptcha.php"] + LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>' + LINKCHECK_TD = r'<td>(?:<.*?>| )*([^<]*)' + + CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' + LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' + LINK_EXPIRED_PATTERN = r'Your download link has expired' + DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' + NOT_LOGGED_IN_PATTERN = r'<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login\.php">Login</a></li>' + + + def setup(self): + self.resumeDownload = self.multiDL = self.premium + self.file_id = re.match(self.__pattern, self.pyfile.url).group('ID') + self.url = "%s%s" % (self.URLS[0], self.file_id) + + self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) + + + def process(self, pyfile): + pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0] + if status != 2: + self.offline() + self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size)) + + if self.premium: + self.handle_premium(pyfile) + else: + self.handle_free(pyfile) + + + def handle_free(self, pyfile): + self.html = self.load(self.url) + action = self.load(self.url, post={"checkDownload": "check"}, decode=True) + action = json_loads(action) + self.logDebug(action) + + if "fail" in action: + if action['fail'] == "timeLimit": + self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}, + decode=True) + + self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) + + elif action['fail'] == "parallelDownload": + self.logWarning(_("Parallel download error, now waiting 60s")) + self.retry(wait_time=60, reason=_("parallelDownload")) + + else: + self.fail(_("Download check returned: %s") % action['fail']) + + elif "success" in action: + if action['success'] == "showCaptcha": + self.doCaptcha() + self.doTimmer() + elif action['success'] == "showTimmer": + self.doTimmer() + + else: + self.error(_("Unknown server response")) + + # show download link + res = self.load(self.url, post={"downloadLink": "show"}, decode=True) + self.logDebug("Show downloadLink response: %s" % res) + if "fail" in res: + self.error(_("Couldn't retrieve download url")) + + # this may either download our file or forward us to an error page + self.download(self.url, post={"download": "normal"}) + self.logDebug(self.req.http.lastEffectiveURL) + + check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN, + "wait" : re.compile(self.LONG_WAIT_PATTERN), + "limit" : self.DAILY_LIMIT_PATTERN}) + + if check == "expired": + self.logDebug("Download link was expired") + self.retry() + + elif check == "wait": + self.doLongWait(self.lastCheck) + + elif check == "limit": + self.logWarning(_("Download limited reached for today")) + self.setWait(secondsToMidnight(gmt=2), True) + self.wait() + self.retry() + + self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel + + + def doTimmer(self): + res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) + self.logDebug("Wait response: %s" % res[:80]) + + if "fail" in res: + self.fail(_("Failed getting wait time")) + + if self.getClassName() == "FilejungleCom": + m = re.search(r'"waitTime":(\d+)', res) + if m is None: + self.fail(_("Cannot get wait time")) + wait_time = int(m.group(1)) + else: + wait_time = int(res) + 3 + + self.setWait(wait_time) + self.wait() + + + def doCaptcha(self): + captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + response, challenge = recaptcha.challenge(captcha_key) + res = json_loads(self.load(self.URLS[2], + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, + 'recaptcha_shortencode_field': self.file_id})) + if not res['success']: + self.invalidCaptcha() + else: + self.correctCaptcha() + break + else: + self.fail(_("Invalid captcha")) + + + def doLongWait(self, m): + wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 12 * 60 + self.setWait(wait_time, True) + self.wait() + self.retry() + + + def handle_premium(self, pyfile): + premium_url = None + if self.getClassName() == "FileserveCom": + # try api download + res = self.load("http://app.fileserve.com/api/download/premium/", + post={"username": self.user, + "password": self.account.getAccountData(self.user)['password'], + "shorten": self.file_id}, + decode=True) + if res: + res = json_loads(res) + if res['error_code'] == "302": + premium_url = res['next'] + elif res['error_code'] in ["305", "500"]: + self.tempOffline() + elif res['error_code'] in ["403", "605"]: + self.resetAccount() + elif res['error_code'] in ["606", "607", "608"]: + self.offline() + else: + self.logError(res['error_code'], res['error_message']) + + self.download(premium_url or pyfile.url) + + if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin(self.user) + self.retry(reason=_("Not logged in")) + + +def getInfo(urls): + for chunk in chunks(urls, 100): + yield checkFile(FileserveCom, chunk) diff --git a/pyload/plugin/hoster/FileshareInUa.py b/pyload/plugin/hoster/FileshareInUa.py new file mode 100644 index 000000000..8b09a086a --- /dev/null +++ b/pyload/plugin/hoster/FileshareInUa.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FileshareInUa(DeadHoster): + __name = "FileshareInUa" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' + __config = [] + + __description = """Fileshare.in.ua hoster plugin""" + __license = "GPLv3" + __authors = [("fwannmacher", "felipe@warhammerproject.com")] diff --git a/pyload/plugin/hoster/FilesonicCom.py b/pyload/plugin/hoster/FilesonicCom.py new file mode 100644 index 000000000..f02f7bff6 --- /dev/null +++ b/pyload/plugin/hoster/FilesonicCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FilesonicCom(DeadHoster): + __name = "FilesonicCom" + __type = "hoster" + __version = "0.35" + + __pattern = r'http://(?:www\.)?filesonic\.com/file/\w+' + __config = [] + + __description = """Filesonic.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("paulking", "")] diff --git a/pyload/plugin/hoster/FilezyNet.py b/pyload/plugin/hoster/FilezyNet.py new file mode 100644 index 000000000..bd6ac5984 --- /dev/null +++ b/pyload/plugin/hoster/FilezyNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FilezyNet(DeadHoster): + __name = "FilezyNet" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?filezy\.net/\w{12}' + __config = [] + + __description = """Filezy.net hoster plugin""" + __license = "GPLv3" + __authors = [] diff --git a/pyload/plugin/hoster/FiredriveCom.py b/pyload/plugin/hoster/FiredriveCom.py new file mode 100644 index 000000000..a5e56191f --- /dev/null +++ b/pyload/plugin/hoster/FiredriveCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FiredriveCom(DeadHoster): + __name = "FiredriveCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config = [] + + __description = """Firedrive.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugin/hoster/FlyFilesNet.py b/pyload/plugin/hoster/FlyFilesNet.py new file mode 100644 index 000000000..4f1d71d21 --- /dev/null +++ b/pyload/plugin/hoster/FlyFilesNet.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FlyFilesNet(SimpleHoster): + __name = "FlyFilesNet" + __type = "hoster" + __version = "0.10" + + __pattern = r'http://(?:www\.)?flyfiles\.net/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FlyFiles.net hoster plugin""" + __license = "GPLv3" + __authors = [] + + SESSION_PATTERN = r'flyfiles\.net/(.*)/.*' + NAME_PATTERN = r'flyfiles\.net/.*/(.*)' + + + def process(self, pyfile): + name = re.search(self.NAME_PATTERN, pyfile.url).group(1) + pyfile.name = urllib.unquote_plus(name) + + session = re.search(self.SESSION_PATTERN, pyfile.url).group(1) + + url = "http://flyfiles.net" + + # get download URL + parsed_url = getURL(url, post={"getDownLink": session}) + self.logDebug("Parsed URL: %s" % parsed_url) + + if parsed_url == '#downlink|' or parsed_url == "#downlink|#": + self.logWarning(_("Could not get the download URL. Please wait 10 minutes")) + self.wait(10 * 60, True) + self.retry() + + self.link = parsed_url.replace('#downlink|', '') diff --git a/pyload/plugin/hoster/FourSharedCom.py b/pyload/plugin/hoster/FourSharedCom.py new file mode 100644 index 000000000..cda3bb7a3 --- /dev/null +++ b/pyload/plugin/hoster/FourSharedCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class FourSharedCom(SimpleHoster): + __name = "FourSharedCom" + __type = "hoster" + __version = "0.31" + + __pattern = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """4Shared.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<meta name="title" content="(?P<N>.+?)"' + SIZE_PATTERN = r'<span title="Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)">' + OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted.' + + NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] + SIZE_REPLACEMENTS = [(",", "")] + + DIRECT_LINK = False + LOGIN_ACCOUNT = True + + LINK_FREE_PATTERN = r'name="d3link" value="(.*?)"' + LINK_BTN_PATTERN = r'id="btnLink" href="(.*?)"' + + ID_PATTERN = r'name="d3fid" value="(.*?)"' + + + def handle_free(self, pyfile): + m = re.search(self.LINK_BTN_PATTERN, self.html) + if m: + link = m.group(1) + else: + link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url) + + self.html = self.load(link) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Download link")) + + self.link = m.group(1) + + try: + m = re.search(self.ID_PATTERN, self.html) + res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) + self.logDebug(res) + except Exception: + pass + + self.wait(20) diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py new file mode 100644 index 000000000..6cf447128 --- /dev/null +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -0,0 +1,182 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import secondsToMidnight + + +class FreakshareCom(Hoster): + __name = "FreakshareCom" + __type = "hoster" + __version = "0.40" + + __pattern = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' + + __description = """Freakshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("sitacuisses", "sitacuisses@yahoo.de"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("Toilal", "toilal.dev@gmail.com")] + + + def setup(self): + self.multiDL = False + self.req_opts = [] + + + def process(self, pyfile): + self.pyfile = pyfile + + pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/") + + if self.account: + self.html = self.load(pyfile.url, cookies=False) + pyfile.name = self.get_file_name() + self.download(pyfile.url) + + else: + self.prepare() + self.get_file_url() + + self.download(pyfile.url, post=self.req_opts) + + check = self.checkDownload({"bad" : "bad try", + "paralell" : "> Sorry, you cant download more then 1 files at time. <", + "empty" : "Warning: Unknown: Filename cannot be empty", + "wrong_captcha" : "Wrong Captcha!", + "downloadserver": "No Downloadserver. Please try again later!"}) + + if check == "bad": + self.fail(_("Bad Try")) + + elif check == "paralell": + self.setWait(300, True) + self.wait() + self.retry() + + elif check == "empty": + self.fail(_("File not downloadable")) + + elif check == "wrong_captcha": + self.invalidCaptcha() + self.retry() + + elif check == "downloadserver": + self.retry(5, 15 * 60, _("No Download server")) + + + def prepare(self): + pyfile = self.pyfile + + self.download_html() + + if not self.file_exists(): + self.offline() + + self.setWait(self.get_waiting_time()) + + pyfile.name = self.get_file_name() + pyfile.size = self.get_file_size() + + self.wait() + + return True + + + def download_html(self): + self.load("http://freakshare.com/index.php", {"language": "EN"}) #: Set english language in server session + self.html = self.load(self.pyfile.url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + if not self.wantReconnect: + self.req_opts = self.get_download_options() #: get the Post options for the Request + # file_url = self.pyfile.url + # return file_url + else: + self.offline() + + + def get_file_name(self): + if not self.html: + self.download_html() + + if not self.wantReconnect: + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) + if m: + file_name = m.group(1) + else: + file_name = self.pyfile.url + + return file_name + else: + return self.pyfile.url + + + def get_file_size(self): + size = 0 + if not self.html: + self.download_html() + + if not self.wantReconnect: + m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) + if m: + units = float(m.group(1).replace(",", "")) + pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] + size = int(units * (2 ** 20) ** pow) + + return size + + + def get_waiting_time(self): + if not self.html: + self.download_html() + + if "Your Traffic is used up for today" in self.html: + self.wantReconnect = True + return secondsToMidnight(gmt=2) + + timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html) + if timestring: + return int(timestring.group(1)) + else: + return 60 + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + if re.search(r"This file does not exist!", self.html): + return False + else: + return True + + + def get_download_options(self): + re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", + self.html).group(0) #: get the whole request + to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) + request_options = dict((n, v) for (v, n) in to_sort) + + herewego = self.load(self.pyfile.url, None, request_options) #: the actual download-Page + + to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) + request_options = dict((n, v) for (v, n) in to_sort) + + challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) + + if challenge: + re_captcha = ReCaptcha(self) + (request_options['recaptcha_challenge_field'], + request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) + + return request_options diff --git a/pyload/plugin/hoster/FreeWayMe.py b/pyload/plugin/hoster/FreeWayMe.py new file mode 100644 index 000000000..1459bb858 --- /dev/null +++ b/pyload/plugin/hoster/FreeWayMe.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class FreeWayMe(MultiHoster): + __name = "FreeWayMe" + __type = "hoster" + __version = "0.16" + + __pattern = r'https://(?:www\.)?free-way\.me/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FreeWayMe multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Nicolas Giese", "james@free-way.me")] + + + def setup(self): + self.resumeDownload = False + self.multiDL = self.premium + self.chunkLimit = 1 + + + def handle_premium(self, pyfile): + user, data = self.account.selectAccount() + + for _i in xrange(5): + # try it five times + header = self.load("https://www.free-way.me/load.php", + get={'multiget': 7, + 'url' : pyfile.url, + 'user' : user, + 'pw' : self.account.getAccountData(user)['password'], + 'json' : ""}, + just_header=True) + + if 'location' in header: + headers = self.load(header['location'], just_header=True) + if headers['code'] == 500: + # error on 2nd stage + self.logError(_("Error [stage2]")) + else: + # seems to work.. + self.download(header['location']) + break + else: + # error page first stage + self.logError(_("Error [stage1]")) + + #@TODO: handle errors diff --git a/pyload/plugin/hoster/FreevideoCz.py b/pyload/plugin/hoster/FreevideoCz.py new file mode 100644 index 000000000..f616097f2 --- /dev/null +++ b/pyload/plugin/hoster/FreevideoCz.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class FreevideoCz(DeadHoster): + __name = "FreevideoCz" + __type = "hoster" + __version = "0.30" + + __pattern = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' + __config = [] + + __description = """Freevideo.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/FshareVn.py b/pyload/plugin/hoster/FshareVn.py new file mode 100644 index 000000000..b44553149 --- /dev/null +++ b/pyload/plugin/hoster/FshareVn.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- + +import re +import time +import urlparse + +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo + + +def getInfo(urls): + for url in urls: + html = getURL("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': url}, + decode=True) + + yield parseFileInfo(FshareVn, url, html) + + +def doubleDecode(m): + return m.group(1).decode('raw_unicode_escape') + + +class FshareVn(SimpleHoster): + __name = "FshareVn" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?fshare\.vn/file/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """FshareVn hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<p>(?P<N>[^<]+)<\\/p>[\\trn\s]*<p>(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)<\\/p>' + OFFLINE_PATTERN = r'<div class=\\"f_left file_w\\"|<\\/p>\\t\\t\\t\\t\\r\\n\\t\\t<p><\\/p>\\t\\t\\r\\n\\t\\t<p>0 KB<\\/p>' + + NAME_REPLACEMENTS = [("(.*)", doubleDecode)] + + LINK_FREE_PATTERN = r'action="(http://download.*?)[#"]' + WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' + + + def preload(self): + self.html = self.load("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': pyfile.url}, + decode=True) + + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) + + + def handle_free(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + + self.checkErrors() + + action, inputs = self.parseHtmlForm('frm_download') + url = urlparse.urljoin(pyfile.url, action) + + if not inputs: + self.error(_("No FORM")) + + elif 'link_file_pwd_dl' in inputs: + password = self.getPassword() + + if password: + self.logInfo(_("Password protected link, trying ") + password) + inputs['link_file_pwd_dl'] = password + self.html = self.load(url, post=inputs, decode=True) + + if 'name="link_file_pwd_dl"' in self.html: + self.fail(_("Incorrect password")) + else: + self.fail(_("No password found")) + + else: + self.html = self.load(url, post=inputs, decode=True) + + self.checkErrors() + + m = re.search(r'var count = (\d+)', self.html) + self.setWait(int(m.group(1)) if m else 30) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = m.group(1) + self.wait() + + + def checkErrors(self): + if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn không tồn" in self.html: + self.offline() + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logInfo(_("Wait until %s ICT") % m.group(1)) + wait_until = time.mktime.time(time.strptime.time(m.group(1), "%d/%m/%Y %H:%M")) + self.wait(wait_until - time.mktime.time(time.gmtime.time()) - 7 * 60 * 60, True) + self.retry() + elif '<ul class="message-error">' in self.html: + msg = "Unknown error occured or wait time not parsed" + self.logError(msg) + self.retry(30, 2 * 60, msg) + + self.info.pop('error', None) diff --git a/pyload/plugin/hoster/Ftp.py b/pyload/plugin/hoster/Ftp.py new file mode 100644 index 000000000..d26e3ad0b --- /dev/null +++ b/pyload/plugin/hoster/Ftp.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re +import urllib +import urlparse + +from pyload.plugin.Hoster import Hoster + + +class Ftp(Hoster): + __name = "Ftp" + __type = "hoster" + __version = "0.51" + + __pattern = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' + + __description = """Download from ftp directory""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.com"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + def setup(self): + self.chunkLimit = -1 + self.resumeDownload = True + def process(self, pyfile): + parsed_url = urlparse.urlparse(pyfile.url) + netloc = parsed_url.netloc + + pyfile.name = parsed_url.path.rpartition('/')[2] + try: + pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') + except Exception: + pass + + if not "@" in netloc: + servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else [] + + if netloc in servers: + self.logDebug("Logging on to %s" % netloc) + self.req.addAuth(self.account.getAccountInfo(netloc)['password']) + else: + pwd = self.getPassword() + if ':' in pwd: + self.req.addAuth(pwd) + + self.req.http.c.setopt(pycurl.NOBODY, 1) + + try: + res = self.load(pyfile.url) + except pycurl.error, e: + self.fail(_("Error %d: %s") % e.args) + + self.req.http.c.setopt(pycurl.NOBODY, 0) + self.logDebug(self.req.http.header) + + m = re.search(r"Content-Length:\s*(\d+)", res) + if m: + pyfile.size = int(m.group(1)) + self.download(pyfile.url) + else: + # Naive ftp directory listing + if re.search(r'^25\d.*?"', self.req.http.header, re.M): + pyfile.url = pyfile.url.rstrip('/') + pkgname = "/".join(pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]) + pyfile.url += '/' + self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY + res = self.load(pyfile.url, decode=False) + links = [pyfile.url + urllib.quote(x) for x in res.splitlines()] + self.logDebug("LINKS", links) + self.core.api.addPackage(pkgname, links) + else: + self.fail(_("Unexpected server response")) diff --git a/pyload/plugin/hoster/GamefrontCom.py b/pyload/plugin/hoster/GamefrontCom.py new file mode 100644 index 000000000..81568e376 --- /dev/null +++ b/pyload/plugin/hoster/GamefrontCom.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.utils import parseFileSize + + +class GamefrontCom(Hoster): + __name = "GamefrontCom" + __type = "hoster" + __version = "0.04" + + __pattern = r'http://(?:www\.)?gamefront\.com/files/\w+' + + __description = """Gamefront.com hoster plugin""" + __license = "GPLv3" + __authors = [("fwannmacher", "felipe@warhammerproject.com")] + + + PATTERN_FILENAME = r'<title>(.*?) | Game Front' + PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' + PATTERN_OFFLINE = r'This file doesn\'t exist, or has been removed.' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 + + + def process(self, pyfile): + self.pyfile = pyfile + self.html = self.load(pyfile.url, decode=True) + + if not self._checkOnline(): + self.offline() + + pyfile.name = self._getName() + + link = self._getLink() + + if not link.startswith('http://'): + link = "http://www.gamefront.com/" + link + + self.download(link) + + + def _checkOnline(self): + if re.search(self.PATTERN_OFFLINE, self.html): + return False + else: + return True + + + def _getName(self): + name = re.search(self.PATTERN_FILENAME, self.html) + if name is None: + self.fail(_("Plugin broken") + + return name.group(1) + + + def _getLink(self): + self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", + self.html).group(1)) + return re.search("<a href=\"(http://media\d+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") + + +def getInfo(urls): + result = [] + + for url in urls: + html = getURL(url) + + if re.search(GamefrontCom.PATTERN_OFFLINE, html): + result.append((url, 0, 1, url)) + else: + name = re.search(GamefrontCom.PATTERN_FILENAME, html) + if name is None: + result.append((url, 0, 1, url)) + else: + name = name.group(1) + size = re.search(GamefrontCom.PATTERN_FILESIZE, html) + size = parseFileSize(size.group(1)) + + result.append((name, size, 3, url)) + + yield result diff --git a/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py new file mode 100644 index 000000000..668760d17 --- /dev/null +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import random +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class GigapetaCom(SimpleHoster): + __name = "GigapetaCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?gigapeta\.com/dl/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """GigaPeta.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>' + SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>' + OFFLINE_PATTERN = r'<div id="page_error">' + + COOKIES = [("gigapeta.com", "lang", "us")] + + + def handle_free(self, pyfile): + captcha_key = str(random.randint(1, 100000000)) + captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key + + for _i in xrange(5): + self.checkErrors() + + captcha = self.decryptCaptcha(captcha_url) + self.html = self.load(pyfile.url, + post={'captcha_key': captcha_key, + 'captcha' : captcha, + 'download' : "Download"}, + follow_location=False) + + m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) + if m: + self.link = m.group(1) + break + elif "Entered figures don`t coincide with the picture" in self.html: + self.invalidCaptcha() + else: + self.fail(_("No valid captcha code entered")) + + + def checkErrors(self): + if "All threads for IP" in self.html: + self.logDebug("Your IP is already downloading a file") + self.wait(5 * 60, True) + self.retry() + + self.info.pop('error', None) diff --git a/pyload/plugin/hoster/GooIm.py b/pyload/plugin/hoster/GooIm.py new file mode 100644 index 000000000..50e16de4b --- /dev/null +++ b/pyload/plugin/hoster/GooIm.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# https://goo.im/devs/liquidsmooth/3.x/codina/Nightly/LS-KK-v3.2-2014-08-01-codina.zip + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class GooIm(SimpleHoster): + __name = "GooIm" + __type = "hoster" + __version = "0.04" + + __pattern = r'https?://(?:www\.)?goo\.im/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Goo.im hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'You will be redirected to .*(?P<N>[^/ ]+) in' + OFFLINE_PATTERN = r'The file you requested was not found' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + self.wait(10) + self.link = pyfile.url diff --git a/pyload/plugin/hoster/GoogledriveCom.py b/pyload/plugin/hoster/GoogledriveCom.py new file mode 100644 index 000000000..8c94bd9b4 --- /dev/null +++ b/pyload/plugin/hoster/GoogledriveCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import html_unescape + + +class GoogledriveCom(SimpleHoster): + __name = "GoogledriveCom" + __type = "hoster" + __version = "0.08" + + __pattern = r'https?://(?:www\.)?drive\.google\.com/file/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Drive.google.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + DISPOSITION = False #: Remove in 0.4.10 + + NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' + OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + try: + link1 = re.search(r'"(https://docs.google.com/uc\?id.*?export=download)",', + self.html.decode('unicode-escape')).group(1) + + except AttributeError: + self.error(_("Hop #1 not found")) + + else: + self.logDebug("Next hop: %s" % link1) + + self.html = self.load(link1).decode('unicode-escape') + + try: + link2 = html_unescape(re.search(r'href="(/uc\?export=download.*?)">', + self.html).group(1)) + + except AttributeError: + self.error(_("Hop #2 not found")) + + else: + self.logDebug("Next hop: %s" % link2) + + link3 = self.load("https://docs.google.com" + link2, just_header=True) + self.logDebug("DL-Link: %s" % link3['location']) + + self.link = link3['location'] diff --git a/pyload/plugin/hoster/HellshareCz.py b/pyload/plugin/hoster/HellshareCz.py new file mode 100644 index 000000000..0e909c599 --- /dev/null +++ b/pyload/plugin/hoster/HellshareCz.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class HellshareCz(SimpleHoster): + __name = "HellshareCz" + __type = "hoster" + __version = "0.85" + + __pattern = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Hellshare.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + CHECK_TRAFFIC = True + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' + SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + OFFLINE_PATTERN = r'<h1>File not found.</h1>' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' + + + def setup(self): + self.resumeDownload = self.multiDL = bool(self.account) + self.chunkLimit = 1 diff --git a/pyload/plugin/hoster/HellspyCz.py b/pyload/plugin/hoster/HellspyCz.py new file mode 100644 index 000000000..b64becf9c --- /dev/null +++ b/pyload/plugin/hoster/HellspyCz.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class HellspyCz(DeadHoster): + __name = "HellspyCz" + __type = "hoster" + __version = "0.28" + + __pattern = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' + __config = [] + + __description = """HellSpy.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/HostujeNet.py b/pyload/plugin/hoster/HostujeNet.py new file mode 100644 index 000000000..ffe9243ef --- /dev/null +++ b/pyload/plugin/hoster/HostujeNet.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class HostujeNet(SimpleHoster): + __name = "HostujeNet" + __type = "hoster" + __version = "0.01" + + __pattern = r'http://(?:www\.)?hostuje\.net/\w+' + + __description = """Hostuje.net hoster plugin""" + __license = "GPLv3" + __authors = [("GammaC0de", None)] + + + NAME_PATTERN = r'<input type="hidden" name="name" value="(?P<N>.+?)">' + SIZE_PATTERN = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>' + OFFLINE_PATTERN = ur'Podany plik nie został odnaleziony\.\.\.' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html) + if m: + jscript = self.load("http://hostuje.net/" + m.group(1)) + m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript) + if m: + self.load("http://hostuje.net/" + m.group(1)) + else: + self.error(_("unexpected javascript format")) + else: + self.error(_("script not found")) + + action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?")) + if not action: + self.error(_("form not found")) + + self.download(action, post=inputs) diff --git a/pyload/plugin/hoster/HotfileCom.py b/pyload/plugin/hoster/HotfileCom.py new file mode 100644 index 000000000..743c24e23 --- /dev/null +++ b/pyload/plugin/hoster/HotfileCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class HotfileCom(DeadHoster): + __name = "HotfileCom" + __type = "hoster" + __version = "0.37" + + __pattern = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' + __config = [] + + __description = """Hotfile.com hoster plugin""" + __license = "GPLv3" + __authors = [("sitacuisses", "sitacuisses@yhoo.de"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("JoKoT3", "jokot3@gmail.com")] diff --git a/pyload/plugin/hoster/HugefilesNet.py b/pyload/plugin/hoster/HugefilesNet.py new file mode 100644 index 000000000..25a337739 --- /dev/null +++ b/pyload/plugin/hoster/HugefilesNet.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class HugefilesNet(XFSHoster): + __name = "HugefilesNet" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?hugefiles\.net/\w{12}' + + __description = """Hugefiles.net hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + SIZE_PATTERN = r'File Size:</span>\s*<span.*?>(?P<S>[^<]+)</span></div>' + + FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/pyload/plugin/hoster/HundredEightyUploadCom.py b/pyload/plugin/hoster/HundredEightyUploadCom.py new file mode 100644 index 000000000..de312245e --- /dev/null +++ b/pyload/plugin/hoster/HundredEightyUploadCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class HundredEightyUploadCom(XFSHoster): + __name = "HundredEightyUploadCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?180upload\.com/\w{12}' + + __description = """180upload.com hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + OFFLINE_PATTERN = r'>File Not Found' diff --git a/pyload/plugin/hoster/IFileWs.py b/pyload/plugin/hoster/IFileWs.py new file mode 100644 index 000000000..57c86d490 --- /dev/null +++ b/pyload/plugin/hoster/IFileWs.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class IFileWs(DeadHoster): + __name = "IFileWs" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?ifile\.ws/\w{12}' + __config = [] + + __description = """Ifile.ws hoster plugin""" + __license = "GPLv3" + __authors = [("z00nx", "z00nx0@gmail.com")] diff --git a/pyload/plugin/hoster/IcyFilesCom.py b/pyload/plugin/hoster/IcyFilesCom.py new file mode 100644 index 000000000..88ec57a98 --- /dev/null +++ b/pyload/plugin/hoster/IcyFilesCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class IcyFilesCom(DeadHoster): + __name = "IcyFilesCom" + __type = "hoster" + __version = "0.06" + + __pattern = r'http://(?:www\.)?icyfiles\.com/(.+)' + __config = [] + + __description = """IcyFiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("godofdream", "soilfiction@gmail.com")] diff --git a/pyload/plugin/hoster/IfileIt.py b/pyload/plugin/hoster/IfileIt.py new file mode 100644 index 000000000..647e06c01 --- /dev/null +++ b/pyload/plugin/hoster/IfileIt.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class IfileIt(DeadHoster): + __name = "IfileIt" + __type = "hoster" + __version = "0.29" + + __pattern = r'^unmatchable$' + __config = [] + + __description = """Ifile.it""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/IfolderRu.py b/pyload/plugin/hoster/IfolderRu.py new file mode 100644 index 000000000..4cbddfaa3 --- /dev/null +++ b/pyload/plugin/hoster/IfolderRu.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class IfolderRu(SimpleHoster): + __name = "IfolderRu" + __type = "hoster" + __version = "0.39" + + __pattern = r'http://(?:www)?(files\.)?(ifolder\.ru|metalarea\.org|rusfolder\.(com|net|ru))/(files/)?(?P<ID>\d+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Ifolder.ru hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')] + + NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' + SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' + OFFLINE_PATTERN = ur'<p>Файл номер <b>.*?</b> (не найден|удален) !!!</p>' + + SESSION_ID_PATTERN = r'<input type="hidden" name="session" value="(.+?)"' + INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "(.+?)";\}' + HIDDEN_INPUT_PATTERN = r'var v = .*?name=\'(.+?)\' value=\'1\'' + + LINK_FREE_PATTERN = r'<a href="(.+?)" class="downloadbutton_files"' + + WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' + + + def setup(self): + self.resumeDownload = self.multiDL = bool(self.account) + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + url = "http://rusfolder.com/%s" % self.info['pattern']['ID'] + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], decode=True) + self.getFileInfo() + + session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() + + captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id + for _i in xrange(5): + action, inputs = self.parseHtmlForm('id="download-step-one-form"') + inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies=True) + inputs['action'] = '1' + self.logDebug(inputs) + + self.html = self.load(url, decode=True, post=inputs) + if self.WRONG_CAPTCHA_PATTERN in self.html: + self.invalidCaptcha() + else: + break + else: + self.fail(_("Invalid captcha")) + + self.link = re.search(self.LINK_FREE_PATTERN, self.html).group(1) diff --git a/pyload/plugin/hoster/JumbofilesCom.py b/pyload/plugin/hoster/JumbofilesCom.py new file mode 100644 index 000000000..47a8ebca1 --- /dev/null +++ b/pyload/plugin/hoster/JumbofilesCom.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class JumbofilesCom(SimpleHoster): + __name = "JumbofilesCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """JumboFiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("godofdream", "soilfiction@gmail.com")] + + + INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' + LINK_FREE_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} + html = self.load(self.pyfile.url, post=post_data, decode=True) + self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) diff --git a/pyload/plugin/hoster/JunocloudMe.py b/pyload/plugin/hoster/JunocloudMe.py new file mode 100644 index 000000000..9054734fb --- /dev/null +++ b/pyload/plugin/hoster/JunocloudMe.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class JunocloudMe(XFSHoster): + __name = "JunocloudMe" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:\w+\.)?junocloud\.me/\w{12}' + + __description = """Junocloud.me hoster plugin""" + __license = "GPLv3" + __authors = [("guidobelix", "guidobelix@hotmail.it")] + + + URL_REPLACEMENTS = [(r'//(www\.)?junocloud', "//dl3.junocloud")] + + OFFLINE_PATTERN = r'>No such file with this filename<' + TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' diff --git a/pyload/plugin/hoster/Keep2ShareCc.py b/pyload/plugin/hoster/Keep2ShareCc.py new file mode 100644 index 000000000..464cac9bb --- /dev/null +++ b/pyload/plugin/hoster/Keep2ShareCc.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class Keep2ShareCc(SimpleHoster): + __name = "Keep2ShareCc" + __type = "hoster" + __version = "0.21" + + __pattern = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Keep2Share.cc hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(__pattern + ".*", "http://keep2s.cc/file/\g<ID>")] + + NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' + SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' + + OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' + TEMP_OFFLINE_PATTERN = r'Downloading blocked due to' + + LINK_FREE_PATTERN = r'"(.+?url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' + + CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' + + WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' + TEMP_ERROR_PATTERN = r'>\s*(Download count files exceed|Traffic limit exceed|Free account does not allow to download more than one file at the same time)' + ERROR_PATTERN = r'>\s*(Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file)' + + + def checkErrors(self): + m = re.search(self.TEMP_ERROR_PATTERN, self.html) + if m: + self.info['error'] = m.group(1) + self.wantReconnect = True + self.retry(wait_time=30 * 60, reason=m.group(0)) + + m = re.search(self.ERROR_PATTERN, self.html) + if m: + errmsg = self.info['error'] = m.group(1) + self.error(errmsg) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logDebug("Hoster told us to wait for %s" % m.group(1)) + + # string to time convert courtesy of https://stackoverflow.com/questions/10663720 + ftr = [3600, 60, 1] + wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) + + self.wantReconnect = True + self.retry(wait_time=wait_time, reason="Please wait to download this file") + + self.info.pop('error', None) + + + def handle_free(self, pyfile): + self.fid = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1) + self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + + # self.logDebug(self.fid) + # self.logDebug(pyfile.url) + + self.checkErrors() + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.handleCaptcha() + self.wait(31) + self.html = self.load(pyfile.url) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + self.link = m.group(1) + + + def handleCaptcha(self): + post_data = {'free' : 1, + 'freeDownloadRequest': 1, + 'uniqueId' : self.fid, + 'yt0' : ''} + + m = re.search(r'id="(captcha\-form)"', self.html) + self.logDebug("captcha-form found %s" % m) + + m = re.search(self.CAPTCHA_PATTERN, self.html) + self.logDebug("CAPTCHA_PATTERN found %s" % m) + if m: + captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) + post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) + else: + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + self.html = self.load(self.pyfile.url, post=post_data) + + if 'verification code is incorrect' not in self.html: + self.correctCaptcha() + else: + self.invalidCaptcha() diff --git a/pyload/plugin/hoster/KickloadCom.py b/pyload/plugin/hoster/KickloadCom.py new file mode 100644 index 000000000..11c79cef9 --- /dev/null +++ b/pyload/plugin/hoster/KickloadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class KickloadCom(DeadHoster): + __name = "KickloadCom" + __type = "hoster" + __version = "0.21" + + __pattern = r'http://(?:www\.)?kickload\.com/get/.+' + __config = [] + + __description = """Kickload.com hoster plugin""" + __license = "GPLv3" + __authors = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugin/hoster/KingfilesNet.py b/pyload/plugin/hoster/KingfilesNet.py new file mode 100644 index 000000000..b8223ceb6 --- /dev/null +++ b/pyload/plugin/hoster/KingfilesNet.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.SolveMedia import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class KingfilesNet(SimpleHoster): + __name = "KingfilesNet" + __type = "hoster" + __version = "0.07" + + __pattern = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Kingfiles.net hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'name="fname" value="(?P<N>.+?)">' + SIZE_PATTERN = r'>Size: .+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + + OFFLINE_PATTERN = r'>(File Not Found</b><br><br>|File Not Found</h2>)' + + RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' + + LINK_FREE_PATTERN = r'var download_url = \'(.+)\';' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + # Click the free user button + post_data = {'op' : "download1", + 'usr_login' : "", + 'id' : self.info['pattern']['ID'], + 'fname' : pyfile.name, + 'referer' : "", + 'method_free': "+"} + + self.html = self.load(pyfile.url, post=post_data, decode=True) + + solvemedia = SolveMedia(self) + response, challenge = solvemedia.challenge() + + # Make the downloadlink appear and load the file + m = re.search(self.RAND_ID_PATTERN, self.html) + if m is None: + self.error(_("Random key not found")) + + rand = m.group(1) + self.logDebug("rand = ", rand) + + post_data = {'op' : "download2", + 'id' : self.info['pattern']['ID'], + 'rand' : rand, + 'referer' : pyfile.url, + 'method_free' : "+", + 'method_premium' : "", + 'adcopy_response' : response, + 'adcopy_challenge': challenge, + 'down_direct' : "1"} + + self.html = self.load(pyfile.url, post=post_data, decode=True) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Download url not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/LemUploadsCom.py b/pyload/plugin/hoster/LemUploadsCom.py new file mode 100644 index 000000000..c43867a99 --- /dev/null +++ b/pyload/plugin/hoster/LemUploadsCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class LemUploadsCom(DeadHoster): + __name = "LemUploadsCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)?lemuploads\.com/\w{12}' + __config = [] + + __description = """LemUploads.com hoster plugin""" + __license = "GPLv3" + __authors = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] diff --git a/pyload/plugin/hoster/LetitbitNet.py b/pyload/plugin/hoster/LetitbitNet.py new file mode 100644 index 000000000..9751c2658 --- /dev/null +++ b/pyload/plugin/hoster/LetitbitNet.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +# +# API Documentation: +# http://api.letitbit.net/reg/static/api.pdf +# +# Test links: +# http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html + +import re +import urlparse + +from pyload.utils import json_loads, json_dumps +from pyload.network.RequestFactory import getURL +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, secondsToMidnight + + +def api_response(url): + json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] + api_rep = getURL("http://api.letitbit.net/json", + post={'r': json_dumps(json_data)}) + return json_loads(api_rep) + + +def getInfo(urls): + for url in urls: + api_rep = api_response(url) + if api_rep['status'] == 'OK': + info = api_rep['data'][0] + yield (info['name'], info['size'], 2, url) + else: + yield (url, 0, 1, url) + + +class LetitbitNet(SimpleHoster): + __name = "LetitbitNet" + __type = "hoster" + __version = "0.30" + + __pattern = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Letitbit.net hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("z00nx", "z00nx0@gmail.com")] + + + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] + + SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' + CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(.+?)\'' + + + def setup(self): + self.resumeDownload = True + + + def handle_free(self, pyfile): + action, inputs = self.parseHtmlForm('id="ifree_form"') + if not action: + self.error(_("ifree_form")) + + pyfile.size = float(inputs['sssize']) + self.logDebug(action, inputs) + inputs['desc'] = "" + + self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs) + + m = re.search(self.SECONDS_PATTERN, self.html) + seconds = int(m.group(1)) if m else 60 + + self.logDebug("Seconds found", seconds) + + m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) + recaptcha_control_field = m.group(1) + + self.logDebug("ReCaptcha control field found", recaptcha_control_field) + + self.wait(seconds) + + res = self.load("http://letitbit.net/ajax/download3.php", post=" ") + if res != '1': + self.error(_("Unknown response - ajax_check_url")) + + self.logDebug(res) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + post_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field": response, + "recaptcha_control_field": recaptcha_control_field} + + self.logDebug("Post data to send", post_data) + + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) + + self.logDebug(res) + + if not res: + self.invalidCaptcha() + + if res == "error_free_download_blocked": + self.logWarning(_("Daily limit reached")) + self.wait(secondsToMidnight(gmt=2), True) + + if res == "error_wrong_captcha": + self.invalidCaptcha() + self.retry() + + elif res.startswith('['): + urls = json_loads(res) + + elif res.startswith('http://'): + urls = [res] + + else: + self.error(_("Unknown response - captcha check")) + + self.link = urls[0] + + + def handle_premium(self, pyfile): + api_key = self.user + premium_key = self.account.getAccountData(self.user)['password'] + + json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] + api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) + self.logDebug("API Data: " + api_rep) + api_rep = json_loads(api_rep) + + if api_rep['status'] == 'FAIL': + self.fail(api_rep['data']) + + self.link = api_rep['data'][0][0] diff --git a/pyload/plugin/hoster/LinksnappyCom.py b/pyload/plugin/hoster/LinksnappyCom.py new file mode 100644 index 000000000..cd15301db --- /dev/null +++ b/pyload/plugin/hoster/LinksnappyCom.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.utils import json_loads, json_dumps +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class LinksnappyCom(MultiHoster): + __name = "LinksnappyCom" + __type = "hoster" + __version = "0.08" + + __pattern = r'https?://(?:[^/]+\.)?linksnappy\.com' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Linksnappy.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + SINGLE_CHUNK_HOSTERS = ["easybytez.com"] + + + def handle_premium(self, pyfile): + host = self._get_host(pyfile.url) + json_params = json_dumps({'link' : pyfile.url, + 'type' : host, + 'username': self.user, + 'password': self.account.getAccountData(self.user)['password']}) + + r = self.load("http://gen.linksnappy.com/genAPI.php", + post={'genLinks': json_params}) + + self.logDebug("JSON data: " + r) + + j = json_loads(r)['links'][0] + + if j['error']: + self.error(_("Error converting the link")) + + pyfile.name = j['filename'] + self.link = j['generated'] + + if host in self.SINGLE_CHUNK_HOSTERS: + self.chunkLimit = 1 + else: + self.setup() + + + @staticmethod + def _get_host(url): + host = urlparse.urlsplit(url).netloc + return re.search(r'[\w-]+\.\w+$', host).group(0) diff --git a/pyload/plugin/hoster/LoadTo.py b/pyload/plugin/hoster/LoadTo.py new file mode 100644 index 000000000..1f9696a52 --- /dev/null +++ b/pyload/plugin/hoster/LoadTo.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.load.to/JWydcofUY6/random.bin +# http://www.load.to/oeSmrfkXE/random100.bin + +import re + +from pyload.plugin.captcha.SolveMedia import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class LoadTo(SimpleHoster): + __name = "LoadTo" + __type = "hoster" + __version = "0.22" + + __pattern = r'http://(?:www\.)?load\.to/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Load.to hoster plugin""" + __license = "GPLv3" + __authors = [("halfman", "Pulpan3@gmail.com"), + ("stickell", "l.stickell@yahoo.it")] + + + NAME_PATTERN = r'<h1>(?P<N>.+)</h1>' + SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>Can\'t find file' + + LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"' + WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' + + URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + # Search for Download URL + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = m.group(1) + + # Set Timer - may be obsolete + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1)) + + # Load.to is using solvemedia captchas since ~july 2014: + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() + + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.download(self.link, + post={'adcopy_challenge': challenge, + 'adcopy_response' : response, + 'returnUrl' : pyfile.url}) diff --git a/pyload/plugin/hoster/LolabitsEs.py b/pyload/plugin/hoster/LolabitsEs.py new file mode 100644 index 000000000..b98563bcf --- /dev/null +++ b/pyload/plugin/hoster/LolabitsEs.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -* + +import HTMLParser +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class LolabitsEs(SimpleHoster): + __name = "LolabitsEs" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)?lolabits\.es/.+' + + __description = """Lolabits.es hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'Descargar: <b>(?P<N>.+?)<' + SIZE_PATTERN = r'class="fileSize">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'Un usuario con este nombre no existe' + + FILEID_PATTERN = r'name="FileId" value="(\d+)"' + TOKEN_PATTERN = r'name="__RequestVerificationToken" type="hidden" value="(.+?)"' + LINK_PATTERN = r'"redirectUrl":"(.+?)"' + + + def setup(self): + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + fileid = re.search(self.FILEID_PATTERN, self.html).group(1) + self.logDebug("FileID: " + fileid) + + token = re.search(self.TOKEN_PATTERN, self.html).group(1) + self.logDebug("Token: " + token) + + self.html = self.load("http://lolabits.es/action/License/Download", + post={'fileId' : fileid, + '__RequestVerificationToken' : token}).decode('unicode-escape') + + self.link = HTMLParser.HTMLParser().unescape(re.search(self.LINK_PATTERN, self.html).group(1)) diff --git a/pyload/plugin/hoster/LomafileCom.py b/pyload/plugin/hoster/LomafileCom.py new file mode 100644 index 000000000..de56d2d58 --- /dev/null +++ b/pyload/plugin/hoster/LomafileCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class LomafileCom(DeadHoster): + __name = "LomafileCom" + __type = "hoster" + __version = "0.52" + + __pattern = r'http://lomafile\.com/\w{12}' + __config = [] + + __description = """Lomafile.com hoster plugin""" + __license = "GPLv3" + __authors = [("nath_schwarz", "nathan.notwhite@gmail.com"), + ("guidobelix", "guidobelix@hotmail.it")] diff --git a/pyload/plugin/hoster/LuckyShareNet.py b/pyload/plugin/hoster/LuckyShareNet.py new file mode 100644 index 000000000..d07500d93 --- /dev/null +++ b/pyload/plugin/hoster/LuckyShareNet.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import json_loads + + +class LuckyShareNet(SimpleHoster): + __name = "LuckyShareNet" + __type = "hoster" + __version = "0.06" + + __pattern = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """LuckyShare.net hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + INFO_PATTERN = r'<h1 class=\'file_name\'>(?P<N>\S+)</h1>\s*<span class=\'file_size\'>Filesize: (?P<S>[\d.,]+)(?P<U>[\w^_]+)</span>' + OFFLINE_PATTERN = r'There is no such file available' + + + def parseJson(self, rep): + if 'AJAX Error' in rep: + html = self.load(self.pyfile.url, decode=True) + m = re.search(r"waitingtime = (\d+);", html) + if m: + seconds = int(m.group(1)) + self.logDebug("You have to wait %d seconds between free downloads" % seconds) + self.retry(wait_time=seconds) + else: + self.error(_("Unable to detect wait time between free downloads")) + elif 'Hash expired' in rep: + self.retry(reason=_("Hash expired")) + return json_loads(rep) + + + # TODO: There should be a filesize limit for free downloads + # TODO: Some files could not be downloaded in free mode + + + def handle_free(self, pyfile): + rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + + self.logDebug("JSON: " + rep) + + json = self.parseJson(rep) + self.wait(json['time']) + + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + response, challenge = recaptcha.challenge() + rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % + (challenge, response, json['hash']), decode=True) + self.logDebug("JSON: " + rep) + if 'link' in rep: + json.update(self.parseJson(rep)) + self.correctCaptcha() + break + elif 'Verification failed' in rep: + self.invalidCaptcha() + else: + self.error(_("Unable to get downlaod link")) + + if not json['link']: + self.fail(_("No Download url retrieved/all captcha attempts failed")) + + self.link = json['link'] diff --git a/pyload/plugin/hoster/MediafireCom.py b/pyload/plugin/hoster/MediafireCom.py new file mode 100644 index 000000000..c3069d021 --- /dev/null +++ b/pyload/plugin/hoster/MediafireCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.captcha.SolveMedia import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class MediafireCom(SimpleHoster): + __name = "MediafireCom" + __type = "hoster" + __version = "0.86" + + __pattern = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)\w{15}' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Mediafire.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>.+?)"/>' + SIZE_PATTERN = r'<li>File size: <span>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'.*?\',\'(?P<N>.+?)\',\'(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\',\'\',\'(?P<H>.+?)\'\)' + OFFLINE_PATTERN = r'class="error_msg_title"' + + LINK_FREE_PATTERN = r'kNO = "(.+?)"' + + PASSWORD_PATTERN = r'<form name="form_password"' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() + + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.html = self.load(pyfile.url, + post={'adcopy_challenge': challenge, + 'adcopy_response' : response}, + decode=True) + + if self.PASSWORD_PATTERN in self.html: + password = self.getPassword() + + if not password: + self.fail(_("No password found")) + else: + self.logInfo(_("Password protected link, trying: ") + password) + self.html = self.load(self.link, post={'downloadp': password}) + + if self.PASSWORD_PATTERN in self.html: + self.fail(_("Incorrect password")) + + return super(MediafireCom, self).handle_free(pyfile) diff --git a/pyload/plugin/hoster/MegaCoNz.py b/pyload/plugin/hoster/MegaCoNz.py new file mode 100644 index 000000000..83409fde9 --- /dev/null +++ b/pyload/plugin/hoster/MegaCoNz.py @@ -0,0 +1,215 @@ +# -*- coding: utf-8 -*- + +import array +import base64 +import os +# import pycurl +import random +import re + +import Crypto + +from pyload.utils import json_loads, json_dumps +from pyload.plugin.Hoster import Hoster +from pyload.utils import decode, fs_decode, fs_encode + + +############################ General errors ################################### +# EINTERNAL (-1): An internal error has occurred. Please submit a bug report, detailing the exact circumstances in which this error occurred +# EARGS (-2): You have passed invalid arguments to this command +# EAGAIN (-3): (always at the request level) A temporary congestion or server malfunction prevented your request from being processed. No data was altered. Retry. Retries must be spaced with exponential backoff +# ERATELIMIT (-4): You have exceeded your command weight per time quota. Please wait a few seconds, then try again (this should never happen in sane real-life applications) +# +############################ Upload errors #################################### +# EFAILED (-5): The upload failed. Please restart it from scratch +# ETOOMANY (-6): Too many concurrent IP addresses are accessing this upload target URL +# ERANGE (-7): The upload file packet is out of range or not starting and ending on a chunk boundary +# EEXPIRED (-8): The upload target URL you are trying to access has expired. Please request a fresh one +# +############################ Stream/System errors ############################# +# ENOENT (-9): Object (typically, node or user) not found +# ECIRCULAR (-10): Circular linkage attempted +# EACCESS (-11): Access violation (e.g., trying to write to a read-only share) +# EEXIST (-12): Trying to create an object that already exists +# EINCOMPLETE (-13): Trying to access an incomplete resource +# EKEY (-14): A decryption operation failed (never returned by the API) +# ESID (-15): Invalid or expired user session, please relogin +# EBLOCKED (-16): User blocked +# EOVERQUOTA (-17): Request over quota +# ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later +# ETOOMANYCONNECTIONS (-19): Too many connections on this resource +# EWRITE (-20): Write failed +# EREAD (-21): Read failed +# EAPPKEY (-22): Invalid application key; request not processed + + +class MegaCoNz(Hoster): + __name = "MegaCoNz" + __type = "hoster" + __version = "0.26" + + __pattern = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)' + + __description = """Mega.co.nz hoster plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + API_URL = "https://eu.api.mega.co.nz/cs" + FILE_SUFFIX = ".crypted" + + + def b64_decode(self, data): + data = data.replace("-", "+").replace("_", "/") + return base64.standard_b64decode(data + '=' * (-len(data) % 4)) + + + def getCipherKey(self, key): + """ Construct the cipher key from the given data """ + a = array.array("I", self.b64_decode(key)) + + k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) + iv = a[4:6] + array.array("I", (0, 0)) + meta_mac = a[6:8] + + return k, iv, meta_mac + + + def api_response(self, **kwargs): + """ Dispatch a call to the api, see https://mega.co.nz/#developers """ + + # generate a session id, no idea where to obtain elsewhere + uid = random.random.randint(10 << 9, 10 ** 10) + + res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) + self.logDebug("Api Response: " + res) + return json_loads(res) + + + def decryptAttr(self, data, key): + k, iv, meta_mac = self.getCipherKey(key) + cbc = Crypto.Cipher.AES.new(k, Crypto.Cipher.AES.MODE_CBC, "\0" * 16) + attr = decode(cbc.decrypt(self.b64_decode(data))) + + self.logDebug("Decrypted Attr: %s" % attr) + if not attr.startswith("MEGA"): + self.fail(_("Decryption failed")) + + # Data is padded, 0-bytes must be stripped + return json_loads(re.search(r'{.+?}', attr).group(0)) + + + def decryptFile(self, key): + """ Decrypts the file at lastDownload` """ + + # upper 64 bit of counter start + n = self.b64_decode(key)[16:24] + + # convert counter to long and shift bytes + k, iv, meta_mac = self.getCipherKey(key) + ctr = Crypto.Util.Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = Crypto.Cipher.AES.new(k, Crypto.Cipher.AES.MODE_CTR, counter=ctr) + + self.pyfile.setStatus("decrypting") + self.pyfile.setProgress(0) + + file_crypted = fs_encode(self.lastDownload) + file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] + + try: + f = open(file_crypted, "rb") + df = open(file_decrypted, "wb") + + except IOError, e: + self.fail(e) + + chunk_size = 2 ** 15 #: buffer size, 32k + # file_mac = [0, 0, 0, 0] #: calculate CBC-MAC for checksum + + chunks = os.path.getsize(file_crypted) / chunk_size + 1 + for i in xrange(chunks): + buf = f.read(chunk_size) + if not buf: + break + + chunk = cipher.decrypt(buf) + df.write(chunk) + + self.pyfile.setProgress(int((100.0 / chunks) * i)) + + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array.array("I", block) + + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) + + self.pyfile.setProgress(100) + + f.close() + df.close() + + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail(_("Checksum mismatch")) + + os.remove(file_crypted) + self.lastDownload = fs_decode(file_decrypted) + + + def checkError(self, code): + ecode = abs(code) + + if ecode in (9, 16, 21): + self.offline() + + elif ecode in (3, 13, 17, 18, 19): + self.tempOffline() + + elif ecode in (1, 4, 6, 10, 15, 21): + self.retry(5, 30, _("Error code: [%s]") % -ecode) + + else: + self.fail(_("Error code: [%s]") % -ecode) + + + def process(self, pyfile): + pattern = re.match(self.__pattern, pyfile.url).groupdict() + id = pattern['ID'] + key = pattern['KEY'] + public = pattern['TYPE'] == '' + + self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) + + # g is for requesting a download url + # this is similar to the calls in the mega js app, documentation is very bad + if public: + mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] + else: + mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] + + if isinstance(mega, int): + self.checkError(mega) + elif "e" in mega: + self.checkError(mega['e']) + + attr = self.decryptAttr(mega['at'], key) + + pyfile.name = attr['n'] + self.FILE_SUFFIX + pyfile.size = mega['s'] + + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + + self.download(mega['g']) + + self.decryptFile(key) + + # Everything is finished and final name can be set + pyfile.name = attr['n'] diff --git a/pyload/plugin/hoster/MegaDebridEu.py b/pyload/plugin/hoster/MegaDebridEu.py new file mode 100644 index 000000000..4eeb07d1d --- /dev/null +++ b/pyload/plugin/hoster/MegaDebridEu.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class MegaDebridEu(MultiHoster): + __name = "MegaDebridEu" + __type = "hoster" + __version = "0.47" + + __pattern = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """mega-debrid.eu multi-hoster plugin""" + __license = "GPLv3" + __authors = [("D.Ducatel", "dducatel@je-geek.fr")] + + + API_URL = "https://www.mega-debrid.eu/api.php" + + + def api_load(self): + """ + Connexion to the mega-debrid API + Return True if succeed + """ + user, data = self.account.selectAccount() + jsonResponse = self.load(self.API_URL, + get={'action': 'connectUser', 'login': user, 'password': data['password']}) + res = json_loads(jsonResponse) + + if res['response_code'] == "ok": + self.token = res['token'] + return True + else: + return False + + + def handle_premium(self, pyfile): + """ + Debrid a link + Return The debrided link if succeed or original link if fail + """ + if not self.api_load(): + self.error("Unable to connect to remote API") + + jsonResponse = self.load(self.API_URL, + get={'action': 'getLink', 'token': self.token}, + post={'link': pyfile.url}) + + res = json_loads(jsonResponse) + if res['response_code'] == "ok": + self.link = res['debridLink'][1:-1] diff --git a/pyload/plugin/hoster/MegaFilesSe.py b/pyload/plugin/hoster/MegaFilesSe.py new file mode 100644 index 000000000..51667c786 --- /dev/null +++ b/pyload/plugin/hoster/MegaFilesSe.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class MegaFilesSe(DeadHoster): + __name = "MegaFilesSe" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?megafiles\.se/\w{12}' + __config = [] + + __description = """MegaFiles.se hoster plugin""" + __license = "GPLv3" + __authors = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] diff --git a/pyload/plugin/hoster/MegaRapidCz.py b/pyload/plugin/hoster/MegaRapidCz.py new file mode 100644 index 000000000..41e6e7412 --- /dev/null +++ b/pyload/plugin/hoster/MegaRapidCz.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re + +from pyload.network.HTTPRequest import BadHeader +from pyload.network.RequestFactory import getRequest +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo + + +def getInfo(urls): + h = getRequest() + h.c.setopt(pycurl.HTTPHEADER, + ["Accept: text/html", + "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) + + for url in urls: + html = h.load(url, decode=True) + yield parseFileInfo(MegaRapidCz, url, html) + + +class MegaRapidCz(SimpleHoster): + __name = "MegaRapidCz" + __type = "hoster" + __version = "0.56" + + __pattern = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """MegaRapid.cz hoster plugin""" + __license = "GPLv3" + __authors = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<h1.*?><span.*?>(?:<a.*?>)?(?P<N>[^<]+)' + SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong></td>' + OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' + + CHECK_TRAFFIC = True + + LINK_PREMIUM_PATTERN = r'<a href="(.+?)" title="Stahnout">([^<]+)</a>' + + ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' + ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' + + + def setup(self): + self.chunkLimit = 1 + + + def handle_premium(self, pyfile): + m = re.search(self.LINK_PREMIUM_PATTERN, self.html) + if m: + self.link = m.group(1) + else: + if re.search(self.ERR_LOGIN_PATTERN, self.html): + self.relogin(self.user) + self.retry(wait_time=60, reason=_("User login failed")) + elif re.search(self.ERR_CREDIT_PATTERN, self.html): + self.fail(_("Not enough credit left")) + else: + self.fail(_("Download link not found")) diff --git a/pyload/plugin/hoster/MegaRapidoNet.py b/pyload/plugin/hoster/MegaRapidoNet.py new file mode 100644 index 000000000..484f8e72f --- /dev/null +++ b/pyload/plugin/hoster/MegaRapidoNet.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +import random + +from pyload.plugin.internal.MultiHoster import MultiHoster + + +def random_with_N_digits(n): + rand = "0." + not_zero = 0 + for _i in xrange(1, n + 1): + r = random.randint(0, 9) + if(r > 0): + not_zero += 1 + rand += str(r) + + if not_zero > 0: + return rand + else: + return random_with_N_digits(n) + + +class MegaRapidoNet(MultiHoster): + __name = "MegaRapidoNet" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """MegaRapido.net multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + LINK_PREMIUM_PATTERN = r'<\s*?a[^>]*?title\s*?=\s*?["\'].*?download["\'][^>]*?href=["\']([^"\']+)' + + ERROR_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error.*?>([^<]*)' + + + def handle_premium(self, pyfile): + self.html = self.load("http://megarapido.net/gerar.php", + post={'rand' :random_with_N_digits(16), + 'urllist' : pyfile.url, + 'links' : pyfile.url, + 'exibir' : "normal", + 'usar' : "premium", + 'user' : self.account.getAccountInfo(self.user).get('sid', None), + 'autoreset': ""}) + + if "desloga e loga novamente para gerar seus links" in self.html.lower(): + self.error("You have logged in at another place") + + return super(MegaRapidoNet, self).handle_premium(pyfile) diff --git a/pyload/plugin/hoster/MegacrypterCom.py b/pyload/plugin/hoster/MegacrypterCom.py new file mode 100644 index 000000000..264ad958d --- /dev/null +++ b/pyload/plugin/hoster/MegacrypterCom.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.utils import json_loads, json_dumps + +from pyload.plugin.hoster.MegaCoNz import MegaCoNz + + +class MegacrypterCom(MegaCoNz): + __name = "MegacrypterCom" + __type = "hoster" + __version = "0.22" + + __pattern = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' + + __description = """Megacrypter.com decrypter plugin""" + __license = "GPLv3" + __authors = [("GonzaloSR", "gonzalo@gonzalosr.com")] + + + API_URL = "http://megacrypter.com/api" + FILE_SUFFIX = ".crypted" + + + def api_response(self, **kwargs): + """ Dispatch a call to the api, see megacrypter.com/api_doc """ + self.logDebug("JSON request: " + json_dumps(kwargs)) + res = self.load(self.API_URL, post=json_dumps(kwargs)) + self.logDebug("API Response: " + res) + return json_loads(res) + + + def process(self, pyfile): + # match is guaranteed because plugin was chosen to handle url + node = re.match(self.__pattern, pyfile.url).group(0) + + # get Mega.co.nz link info + info = self.api_response(link=node, m="info") + + # get crypted file URL + dl = self.api_response(link=node, m="dl") + + # TODO: map error codes, implement password protection + # if info['pass'] is True: + # crypted_file_key, md5_file_key = info['key'].split("#") + + key = self.b64_decode(info['key']) + + pyfile.name = info['name'] + self.FILE_SUFFIX + + self.download(dl['url']) + + self.decryptFile(key) + + # Everything is finished and final name can be set + pyfile.name = info['name'] diff --git a/pyload/plugin/hoster/MegareleaseOrg.py b/pyload/plugin/hoster/MegareleaseOrg.py new file mode 100644 index 000000000..65f1242a9 --- /dev/null +++ b/pyload/plugin/hoster/MegareleaseOrg.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class MegareleaseOrg(DeadHoster): + __name = "MegareleaseOrg" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)?megarelease\.org/\w{12}' + __config = [] + + __description = """Megarelease.org hoster plugin""" + __license = "GPLv3" + __authors = [("derek3x", "derek3x@vmail.me"), + ("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/MegasharesCom.py b/pyload/plugin/hoster/MegasharesCom.py new file mode 100644 index 000000000..11010b63e --- /dev/null +++ b/pyload/plugin/hoster/MegasharesCom.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class MegasharesCom(SimpleHoster): + __name = "MegasharesCom" + __type = "hoster" + __version = "0.28" + + __pattern = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Megashares.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>.+?)">' + SIZE_PATTERN = r'<strong><span class="black">Filesize:</span></strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<dd class="red">(Invalid Link Request|Link has been deleted|Invalid link)' + + LINK_PATTERN = r'<div id="show_download_button_%d".*?>\s*<a href="(.+?)">' + + PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <.*?>(\w+).*?You have.*?<.*?>.*?([\d.]+) (\w+)' + PASSPORT_RENEW_PATTERN = r'(\d+):<strong>(\d+)</strong>:<strong>(\d+)</strong>' + REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />' + REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />' + REQUEST_URI_PATTERN = r'var request_uri = "(.+?)";' + NO_SLOTS_PATTERN = r'<dd class="red">All download slots for this link are currently filled' + + + def setup(self): + self.resumeDownload = True + self.multiDL = self.premium + + + def handle_premium(self, pyfile): + self.handleDownload(True) + + + def handle_free(self, pyfile): + if self.NO_SLOTS_PATTERN in self.html: + self.retry(wait_time=5 * 60) + + m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) + if m: + passport_num = m.group(1) + request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) + + for _i in xrange(5): + random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) + + verifyinput = self.decryptCaptcha("http://d01.megashares.com/index.php", + get={'secgfx': "gfx", 'random_num': random_num}) + + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) + + res = self.load("http://d01.megashares.com%s" % request_uri, + get={'rs' : "check_passport_renewal", + 'rsargs[]': verifyinput, + 'rsargs[]': random_num, + 'rsargs[]': passport_num, + 'rsargs[]': "replace_sec_pprenewal", + 'rsrnd[]' : str(int(time.time() * 1000))}) + + if 'Thank you for reactivating your passport.' in res: + self.correctCaptcha() + self.retry() + else: + self.invalidCaptcha() + else: + self.fail(_("Failed to reactivate passport")) + + m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) + if m: + time = [int(x) for x in m.groups()] + renew = time[0] + (time[1] * 60) + (time[2] * 60) + self.logDebug("Waiting %d seconds for a new passport" % renew) + self.retry(wait_time=renew, reason=_("Passport renewal")) + + # Check traffic left on passport + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) + if m is None: + self.fail(_("Passport not found")) + + self.logInfo(_("Download passport: %s") % m.group(1)) + data_left = float(m.group(2)) * (2 ** 20) ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) + + if not data_left: + self.retry(wait_time=600, reason=_("Passport renewal")) + + self.handleDownload(False) + + + def handleDownload(self, premium=False): + # Find download link; + m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) + msg = _('%s download URL' % ('Premium' if premium else 'Free')) + if m is None: + self.error(msg) + + self.link = m.group(1) + self.logDebug("%s: %s" % (msg, self.link)) diff --git a/pyload/plugin/hoster/MegauploadCom.py b/pyload/plugin/hoster/MegauploadCom.py new file mode 100644 index 000000000..20acad9a6 --- /dev/null +++ b/pyload/plugin/hoster/MegauploadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class MegauploadCom(DeadHoster): + __name = "MegauploadCom" + __type = "hoster" + __version = "0.31" + + __pattern = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' + __config = [] + + __description = """Megaupload.com hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org")] diff --git a/pyload/plugin/hoster/MegavideoCom.py b/pyload/plugin/hoster/MegavideoCom.py new file mode 100644 index 000000000..f50ce4365 --- /dev/null +++ b/pyload/plugin/hoster/MegavideoCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class MegavideoCom(DeadHoster): + __name = "MegavideoCom" + __type = "hoster" + __version = "0.21" + + __pattern = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' + __config = [] + + __description = """Megavideo.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugin/hoster/MovReelCom.py b/pyload/plugin/hoster/MovReelCom.py new file mode 100644 index 000000000..fb942c59f --- /dev/null +++ b/pyload/plugin/hoster/MovReelCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class MovReelCom(XFSHoster): + __name = "MovReelCom" + __type = "hoster" + __version = "1.24" + + __pattern = r'http://(?:www\.)?movreel\.com/\w{12}' + + __description = """MovReel.com hoster plugin""" + __license = "GPLv3" + __authors = [("JorisV83", "jorisv83-pyload@yahoo.com")] + + + LINK_PATTERN = r'<a href="(.+?)">Download Link' diff --git a/pyload/plugin/hoster/MultihostersCom.py b/pyload/plugin/hoster/MultihostersCom.py new file mode 100644 index 000000000..1bb2452bb --- /dev/null +++ b/pyload/plugin/hoster/MultihostersCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.hoster.ZeveraCom import ZeveraCom + + +class MultihostersCom(ZeveraCom): + __name = "MultihostersCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description = """Multihosters.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("tjeh", "tjeh@gmx.net")] diff --git a/pyload/plugin/hoster/MultishareCz.py b/pyload/plugin/hoster/MultishareCz.py new file mode 100644 index 000000000..ade049f50 --- /dev/null +++ b/pyload/plugin/hoster/MultishareCz.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +import random + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class MultishareCz(SimpleHoster): + __name = "MultishareCz" + __type = "hoster" + __version = "0.40" + + __pattern = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """MultiShare.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + SIZE_REPLACEMENTS = [(' ', '')] + + CHECK_TRAFFIC = True + MULTI_HOSTER = True + + INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' + OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' + + + def handle_free(self, pyfile): + self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) + + + def handle_premium(self, pyfile): + self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) + + + def handle_multi(self, pyfile): + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True) + + self.checkInfo() + + if not self.checkTrafficLeft(): + self.fail(_("Not enough credit left to download file")) + + self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), + get={'u_ID' : self.acc_info['u_ID'], + 'u_hash': self.acc_info['u_hash'], + 'link' : pyfile.url}, + disposition=True) diff --git a/pyload/plugin/hoster/MyfastfileCom.py b/pyload/plugin/hoster/MyfastfileCom.py new file mode 100644 index 000000000..4ed89f8f7 --- /dev/null +++ b/pyload/plugin/hoster/MyfastfileCom.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class MyfastfileCom(MultiHoster): + __name = "MyfastfileCom" + __type = "hoster" + __version = "0.08" + + __pattern = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Myfastfile.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] + + + def setup(self): + self.chunkLimit = -1 + + + def handle_premium(self, pyfile): + self.html = self.load('http://myfastfile.com/api.php', + get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + 'link': pyfile.url}) + self.logDebug("JSON data: " + self.html) + + self.html = json_loads(self.html) + if self.html['status'] != 'ok': + self.fail(_("Unable to unrestrict link")) + + self.link = self.html['link'] diff --git a/pyload/plugin/hoster/MystoreTo.py b/pyload/plugin/hoster/MystoreTo.py new file mode 100644 index 000000000..1518dd75f --- /dev/null +++ b/pyload/plugin/hoster/MystoreTo.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# +# Test link: +# http://mystore.to/dl/mxcA50jKfP + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class MystoreTo(SimpleHoster): + __name = "MystoreTo" + __type = "hoster" + __version = "0.03" + + __pattern = r'https?://(?:www\.)?mystore\.to/dl/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Mystore.to hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "")] + + + NAME_PATTERN = r'<h1>(?P<N>.+?)<' + SIZE_PATTERN = r'FILESIZE: (?P<S>[\d\.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>file not found<' + + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + try: + fid = re.search(r'wert="(.+?)"', self.html).group(1) + + except AttributeError: + self.error(_("File-ID not found")) + + self.link = self.load("http://mystore.to/api/download", + post={'FID': fid}) diff --git a/pyload/plugin/hoster/MyvideoDe.py b/pyload/plugin/hoster/MyvideoDe.py new file mode 100644 index 000000000..08652cdc9 --- /dev/null +++ b/pyload/plugin/hoster/MyvideoDe.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster +from pyload.utils import html_unescape + + +class MyvideoDe(Hoster): + __name = "MyvideoDe" + __type = "hoster" + __version = "0.90" + + __pattern = r'http://(?:www\.)?myvideo\.de/watch/' + + __description = """Myvideo.de hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org")] + + + def process(self, pyfile): + self.pyfile = pyfile + self.download_html() + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + def download_html(self): + self.html = self.load(self.pyfile.url) + + + def get_file_url(self): + videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) + videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1) + file_url = videoServer + videoId + ".flv" + return file_url + + + def get_file_name(self): + file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" + return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + + + def file_exists(self): + self.download_html() + self.load(str(self.pyfile.url), cookies=False, just_header=True) + if self.req.lastEffectiveURL == "http://www.myvideo.de/": + return False + return True diff --git a/pyload/plugin/hoster/NahrajCz.py b/pyload/plugin/hoster/NahrajCz.py new file mode 100644 index 000000000..14f041e17 --- /dev/null +++ b/pyload/plugin/hoster/NahrajCz.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class NahrajCz(DeadHoster): + __name = "NahrajCz" + __type = "hoster" + __version = "0.21" + + __pattern = r'http://(?:www\.)?nahraj\.cz/content/download/.+' + __config = [] + + __description = """Nahraj.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/NarodRu.py b/pyload/plugin/hoster/NarodRu.py new file mode 100644 index 000000000..38c867304 --- /dev/null +++ b/pyload/plugin/hoster/NarodRu.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +import random +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class NarodRu(SimpleHoster): + __name = "NarodRu" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Narod.ru hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>' + SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>' + OFFLINE_PATTERN = r'<title>404</title>|Файл удален с сервиса|Закончился срок хранения файла\.' + + SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')] + URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), + (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] + + CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' + LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' + + + def handle_free(self, pyfile): + for _i in xrange(5): + self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777)) + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("Captcha")) + + post_data = {"action": "sendcapcha"} + captcha_url, post_data['key'] = m.groups() + post_data['rep'] = self.decryptCaptcha(captcha_url) + + self.html = self.load(pyfile.url, post=post_data, decode=True) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = 'http://narod.ru' + m.group(1) + self.correctCaptcha() + break + + elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: + self.invalidCaptcha() + + else: + self.error(_("Download link")) + + else: + self.fail(_("No valid captcha code entered")) diff --git a/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py new file mode 100644 index 000000000..9e05b02c5 --- /dev/null +++ b/pyload/plugin/hoster/NetloadIn.py @@ -0,0 +1,297 @@ +# -*- coding: utf-8 -*- + +import re +import time +import urlparse + +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.plugin.Plugin import chunks +from pyload.plugin.captcha.ReCaptcha import ReCaptcha + + +def getInfo(urls): + ## returns list of tupels (name, size (in bytes), status (see database.File), url) + + apiurl = "http://api.netload.in/info.php" + id_regex = re.compile(NetloadIn.__pattern) + urls_per_query = 80 + + for chunk in chunks(urls, urls_per_query): + ids = "" + for url in chunk: + match = id_regex.search(url) + if match: + ids = ids + match.group('ID') + ";" + + api = getURL(apiurl, + get={'auth' : "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", + 'bz' : 1, + 'md5' : 1, + 'file_id': ids}, + decode=True) + + if api is None or len(api) < 10: + self.logDebug("Prefetch failed") + return + + if api.find("unknown_auth") >= 0: + self.logDebug("Outdated auth code") + return + + result = [] + + for i, r in enumerate(api.splitlines()): + try: + tmp = r.split(";") + + try: + size = int(tmp[2]) + except Exception: + size = 0 + + result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] )) + + except Exception: + self.logDebug("Error while processing response: %s" % r) + + yield result + + +class NetloadIn(Hoster): + __name = "NetloadIn" + __type = "hoster" + __version = "0.49" + + __pattern = r'https?://(?:www\.)?netload\.in/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' + + __description = """Netload.in hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org"), + ("RaNaN", "ranan@pyload.org"), + ("Gregy", "gregy@gregy.cz")] + + + RECAPTCHA_KEY = "6LcLJMQSAAAAAJzquPUPKNovIhbK6LpSqCjYrsR1" + + + def setup(self): + self.multiDL = self.resumeDownload = self.premium + + + def process(self, pyfile): + self.url = pyfile.url + + self.prepare() + + pyfile.setStatus("downloading") + + self.proceed(self.url) + + + def prepare(self): + self.api_load() + + if self.api_data and self.api_data['filename']: + self.pyfile.name = self.api_data['filename'] + + if self.premium: + self.logDebug("Use Premium Account") + + settings = self.load("http://www.netload.in/index.php", get={'id': 2, 'lang': "en"}) + + if '<option value="2" selected="selected">Direkter Download' in settings: + self.logDebug("Using direct download") + return True + else: + self.logDebug("Direct downloads not enabled. Parsing html for a download URL") + + if self.download_html(): + return True + else: + self.fail(_("Failed")) + return False + + + def api_load(self, n=0): + url = self.url + id_regex = re.compile(self.__pattern) + match = id_regex.search(url) + + if match: + # normalize url + self.url = 'http://www.netload.in/datei%s.htm' % match.group('ID') + self.logDebug("URL: %s" % self.url) + else: + self.api_data = False + return + + apiurl = "http://api.netload.in/info.php" + html = self.load(apiurl, cookies=False, + get={"file_id": match.group('ID'), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", + "md5": "1"}, decode=True).strip() + if not html and n <= 3: + self.setWait(2) + self.wait() + self.api_load(n + 1) + return + + self.logDebug("APIDATA: " + html) + + self.api_data = {} + + if html and ";" in html and html not in ("unknown file_data", "unknown_server_data", "No input file specified."): + lines = html.split(";") + self.api_data['exists'] = True + self.api_data['fileid'] = lines[0] + self.api_data['filename'] = lines[1] + self.api_data['size'] = lines[2] + self.api_data['status'] = lines[3] + + if self.api_data['status'] == "online": + self.api_data['checksum'] = lines[4].strip() + else: + self.api_data = False #: check manually since api data is useless sometimes + + if lines[0] == lines[1] and lines[2] == "0": #: useless api data + self.api_data = False + else: + self.api_data = False + + + def final_wait(self, page): + wait_time = self.get_wait_time.time(page) + + self.setWait(wait_time) + + self.logDebug("Final wait %d seconds" % wait_time) + + self.wait() + + self.url = self.get_file_url(page) + + + def check_free_wait(self, page): + if ">An access request has been made from IP address <" in page: + self.wantReconnect = True + self.setWait(self.get_wait_time.time(page) or 30) + self.wait() + return True + else: + return False + + + def download_html(self): + page = self.load(self.url, decode=True) + + if "/share/templates/download_hddcrash.tpl" in page: + self.logError(_("Netload HDD Crash")) + self.fail(_("File temporarily not available")) + + if not self.api_data: + self.logDebug("API Data may be useless, get details from html page") + + if "* The file was deleted" in page: + self.offline() + + name = re.search(r'class="dl_first_filename">([^<]+)', page, re.M) + # the found filename is not truncated + if name: + name = name.group(1).strip() + if not name.endswith(".."): + self.pyfile.name = name + + captchawaited = False + + for i in xrange(5): + if not page: + page = self.load(self.url) + t = time.time() + 30 + + if "/share/templates/download_hddcrash.tpl" in page: + self.logError(_("Netload HDD Crash")) + self.fail(_("File temporarily not available")) + + self.logDebug("Try number %d " % i) + + if ">Your download is being prepared.<" in page: + self.logDebug("We will prepare your download") + self.final_wait(page) + return True + + self.logDebug("Trying to find captcha") + + try: + url_captcha_html = re.search(r'(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") + + except Exception, e: + self.logDebug("Exception during Captcha regex: %s" % e.message) + page = None + + else: + url_captcha_html = urlparse.urljoin("http://netload.in/", url_captcha_html) + break + + self.html = self.load(url_captcha_html) + + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + response_page = self.load("http://www.netload.in/index.php?id=10", + post={'captcha_check' : '1', + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response, + 'file_id' : self.api_data['fileid'], + 'Download_Next' : ''}) + if "Orange_Link" in response_page: + break + + if self.check_free_wait(response_page): + self.logDebug("Had to wait for next free slot, trying again") + return self.download_html() + + else: + download_url = self.get_file_url(response_page) + self.logDebug("Download URL after get_file: " + download_url) + if not download_url.startswith("http://"): + self.error(_("Download url: %s") % download_url) + self.wait() + + self.url = download_url + return True + + + def get_file_url(self, page): + try: + file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' + attempt = re.search(file_url_pattern, page) + if attempt: + return attempt.group(1) + else: + self.logDebug("Backup try for final link") + file_url_pattern = r'<a href="(.+)" class="Orange_Link">Click here' + attempt = re.search(file_url_pattern, page) + return "http://netload.in/" + attempt.group(1) + + except Exception, e: + self.logDebug("Getting final link failed", e.message) + return None + + + def get_wait_time.time(self, page): + return int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 + + + def proceed(self, url): + self.download(url, disposition=True) + + check = self.checkDownload({'empty' : re.compile(r'^$'), + 'offline': re.compile("The file was deleted")}) + if check == "empty": + self.logInfo(_("Downloaded File was empty")) + self.retry() + + elif check == "offline": + self.offline() diff --git a/pyload/plugin/hoster/NitroflareCom.py b/pyload/plugin/hoster/NitroflareCom.py new file mode 100644 index 000000000..aed0b404f --- /dev/null +++ b/pyload/plugin/hoster/NitroflareCom.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class NitroflareCom(SimpleHoster): + __name = "NitroflareCom" + __type = "hoster" + __version = "0.09" + + __pattern = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Nitroflare.com hoster plugin""" + __license = "GPLv3" + __authors = [("sahil", "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com"), + ("Stickell", "l.stickell@yahoo.it")] + + # URL_REPLACEMENTS = [("http://", "https://")] + + INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File doesn\'t exist' + + LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + + RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" + + PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' + WAIT_PATTERN = r'You have to wait .+?<' + ERROR_PATTERN = r'downloading is not possible' + + + def checkErrors(self): + if not self.html: + return + + if not self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): + self.fail(_("Link require a premium account to be handled")) + + elif hasattr(self, 'WAIT_PATTERN'): + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) + self.wait(wait_time, wait_time > 300) + return + + elif hasattr(self, 'ERROR_PATTERN'): + m = re.search(self.ERROR_PATTERN, self.html) + if m: + errmsg = self.info['error'] = m.group(1) + self.error(errmsg) + + self.info.pop('error', None) + + + def handle_free(self, pyfile): + # used here to load the cookies which will be required later + self.load(pyfile.url, post={'goToFreePage': ""}) + + self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) + + self.checkErrors() + + try: + js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") + var_time = re.search("var time = (\\d+);", js_file) + wait_time = int(var_time.groups()[0]) + + except Exception: + wait_time = 60 + + self.wait(wait_time) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method' : "fetchDownload", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + if "The captcha wasn't entered correctly" in self.html: + self.logWarning("The captcha wasn't entered correctly") + return + + if "You have to fill the captcha" in self.html: + self.logWarning("Captcha unfilled") + return + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) + else: + self.logError("Unable to detect direct link") diff --git a/pyload/plugin/hoster/NoPremiumPl.py b/pyload/plugin/hoster/NoPremiumPl.py new file mode 100644 index 000000000..4714270b5 --- /dev/null +++ b/pyload/plugin/hoster/NoPremiumPl.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class NoPremiumPl(MultiHoster): + __name = "NoPremiumPl" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://direct\.nopremium\.pl.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """NoPremium.pl multi-hoster plugin""" + __license = "GPLv3" + __authors = [("goddie", "dev@nopremium.pl")] + + + API_URL = "http://crypt.nopremium.pl" + + API_QUERY = {'site' : "nopremium", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(NoPremiumPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handle_free(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("runFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed['errno'] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed['errno']] % self.getClassName()) + else: + # error code isn't yet added to plugin + self.fail( + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] + ) + + if "sdownload" in parsed: + if parsed['sdownload'] == "1": + self.fail( + _("Download from %s is possible only using NoPremium.pl website \ + directly") % parsed['hosting']) + + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/pyload/plugin/hoster/NosuploadCom.py b/pyload/plugin/hoster/NosuploadCom.py new file mode 100644 index 000000000..af79da22b --- /dev/null +++ b/pyload/plugin/hoster/NosuploadCom.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class NosuploadCom(XFSHoster): + __name = "NosuploadCom" + __type = "hoster" + __version = "0.31" + + __pattern = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}' + + __description = """Nosupload.com hoster plugin""" + __license = "GPLv3" + __authors = [("igel", "igelkun@myopera.com")] + + + SIZE_PATTERN = r'<p><strong>Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' + LINK_PATTERN = r'<a class="select" href="(http://.+?)">Download</a>' + + WAIT_PATTERN = r'Please wait.*?>(\d+)</span>' + + + def getDownloadLink(self): + # stage1: press the "Free Download" button + data = self.getPostParameters() + self.html = self.load(self.pyfile.url, post=data, decode=True) + + # stage2: wait some time and press the "Download File" button + data = self.getPostParameters() + wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1) + self.logDebug("Hoster told us to wait %s seconds" % wait_time) + self.wait(wait_time) + self.html = self.load(self.pyfile.url, post=data, decode=True) + + # stage3: get the download link + return re.search(self.LINK_PATTERN, self.html, re.S).group(1) diff --git a/pyload/plugin/hoster/NovafileCom.py b/pyload/plugin/hoster/NovafileCom.py new file mode 100644 index 000000000..f76d77269 --- /dev/null +++ b/pyload/plugin/hoster/NovafileCom.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://novafile.com/vfun4z6o2cit +# http://novafile.com/s6zrr5wemuz4 + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class NovafileCom(XFSHoster): + __name = "NovafileCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?novafile\.com/\w{12}' + + __description = """Novafile.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + ERROR_PATTERN = r'class="alert.+?alert-separate".*?>\s*(?:<p>)?(.*?)\s*</' + WAIT_PATTERN = r'<p>Please wait <span id="count".*?>(\d+)</span> seconds</p>' + + LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' diff --git a/pyload/plugin/hoster/NowDownloadSx.py b/pyload/plugin/hoster/NowDownloadSx.py new file mode 100644 index 000000000..b0c8d60e2 --- /dev/null +++ b/pyload/plugin/hoster/NowDownloadSx.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import fixup + + +class NowDownloadSx(SimpleHoster): + __name = "NowDownloadSx" + __type = "hoster" + __version = "0.09" + + __pattern = r'http://(?:www\.)?(nowdownload\.[a-zA-Z]{2,}/(dl/|download\.php.+?id=|mobile/(#/files/|.+?id=))|likeupload\.org/)\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """NowDownload.sx hoster plugin""" + __license = "GPLv3" + __authors = [("godofdream", "soilfiction@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[\d.,]+) (?P<U>[\w^_]+) </h4>' + OFFLINE_PATTERN = r'>This file does not exist' + + TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' + CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' + WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' + LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' + + NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')] + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 + + + def handle_free(self, pyfile): + tokenlink = re.search(self.TOKEN_PATTERN, self.html) + continuelink = re.search(self.CONTINUE_PATTERN, self.html) + if tokenlink is None or continuelink is None: + self.error() + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait = int(m.group(1)) + else: + wait = 60 + + baseurl = "http://www.nowdownload.at" + self.html = self.load(baseurl + str(tokenlink.group(1))) + self.wait(wait) + + self.html = self.load(baseurl + str(continuelink.group(1))) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Download link not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/NowVideoSx.py b/pyload/plugin/hoster/NowVideoSx.py new file mode 100644 index 000000000..70dc1fdf5 --- /dev/null +++ b/pyload/plugin/hoster/NowVideoSx.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class NowVideoSx(SimpleHoster): + __name = "NowVideoSx" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?nowvideo\.[a-zA-Z]{2,}/(video/|mobile/(#/videos/|.+?id=))(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """NowVideo.sx hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(__pattern + ".*", r'http://www.nowvideo.sx/video/\g<ID>')] + + NAME_PATTERN = r'<h4>(?P<N>.+?)<' + OFFLINE_PATTERN = r'>This file no longer exists' + + LINK_FREE_PATTERN = r'<source src="(.+?)"' + LINK_PREMIUM_PATTERN = r'<div id="content_player" >\s*<a href="(.+?)"' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def handle_free(self, pyfile): + self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/OboomCom.py b/pyload/plugin/hoster/OboomCom.py new file mode 100644 index 000000000..5b9b11485 --- /dev/null +++ b/pyload/plugin/hoster/OboomCom.py @@ -0,0 +1,145 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# https://www.oboom.com/B7CYZIEB/10Mio.dat + +import re + +from pyload.utils import json_loads +from pyload.plugin.Hoster import Hoster +from pyload.plugin.captcha.ReCaptcha import ReCaptcha + + +class OboomCom(Hoster): + __name = "OboomCom" + __type = "hoster" + __version = "0.31" + + __pattern = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' + + __description = """oboom.com hoster plugin""" + __license = "GPLv3" + __authors = [("stanley", "stanley.foerster@gmail.com")] + + + RECAPTCHA_KEY = "6LdqpO0SAAAAAJGHXo63HyalP7H4qlRs_vff0kJX" + + + def setup(self): + self.chunkLimit = 1 + self.multiDL = self.resumeDownload = self.premium + + + def process(self, pyfile): + self.pyfile.url.replace(".com/#id=", ".com/#") + self.pyfile.url.replace(".com/#/", ".com/#") + self.getFileId(self.pyfile.url) + self.getSessionToken() + self.getFileInfo(self.sessionToken, self.fileId) + self.pyfile.name = self.fileName + self.pyfile.size = self.fileSize + if not self.premium: + self.solveCaptcha() + self.getDownloadTicket() + self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0}) + + + def loadUrl(self, url, get=None): + if get is None: + get = dict() + return json_loads(self.load(url, get, decode=True)) + + + def getFileId(self, url): + self.fileId = re.match(OboomCom.__pattern, url).group('ID') + + + def getSessionToken(self): + if self.premium: + accountInfo = self.account.getAccountInfo(self.user, True) + if "session" in accountInfo: + self.sessionToken = accountInfo['session'] + else: + self.fail(_("Could not retrieve premium session")) + else: + apiUrl = "https://www.oboom.com/1.0/guestsession" + result = self.loadUrl(apiUrl) + if result[0] == 200: + self.sessionToken = result[1] + else: + self.fail(_("Could not retrieve token for guest session. Error code: %s") % result[0]) + + + def solveCaptcha(self): + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + apiUrl = "https://www.oboom.com/1.0/download/ticket" + params = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field": response, + "download_id": self.fileId, + "token": self.sessionToken} + result = self.loadUrl(apiUrl, params) + + if result[0] == 200: + self.downloadToken = result[1] + self.downloadAuth = result[2] + self.correctCaptcha() + self.setWait(30) + self.wait() + break + + elif result[0] == 400: + if result[1] == "incorrect-captcha-sol": + self.invalidCaptcha() + elif result[1] == "captcha-timeout": + self.invalidCaptcha() + elif result[1] == "forbidden": + self.retry(5, 15 * 60, _("Service unavailable")) + + elif result[0] == 403: + if result[1] == -1: #: another download is running + self.setWait(15 * 60) + else: + self.setWait(result[1], True) + self.wait() + self.retry(5) + else: + self.invalidCaptcha() + self.fail(_("Received invalid captcha 5 times")) + + + def getFileInfo(self, token, fileId): + apiUrl = "https://api.oboom.com/1.0/info" + params = {"token": token, "items": fileId, "http_errors": 0} + + result = self.loadUrl(apiUrl, params) + if result[0] == 200: + item = result[1][0] + if item['state'] == "online": + self.fileSize = item['size'] + self.fileName = item['name'] + else: + self.offline() + else: + self.fail(_("Could not retrieve file info. Error code %s: %s") % (result[0], result[1])) + + + def getDownloadTicket(self): + apiUrl = "https://api.oboom.com/1/dl" + params = {"item": self.fileId, "http_errors": 0} + if self.premium: + params['token'] = self.sessionToken + else: + params['token'] = self.downloadToken + params['auth'] = self.downloadAuth + + result = self.loadUrl(apiUrl, params) + if result[0] == 200: + self.downloadDomain = result[1] + self.downloadTicket = result[2] + elif result[0] == 421: + self.retry(wait_time=result[2] + 60, reason=_("Connection limit exceeded")) + else: + self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/pyload/plugin/hoster/OneFichierCom.py b/pyload/plugin/hoster/OneFichierCom.py new file mode 100644 index 000000000..1c5c87a99 --- /dev/null +++ b/pyload/plugin/hoster/OneFichierCom.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class OneFichierCom(SimpleHoster): + __name = "OneFichierCom" + __type = "hoster" + __version = "0.84" + + __pattern = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """1fichier.com hoster plugin""" + __license = "GPLv3" + __authors = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("the-razer", "daniel_ AT gmx DOT net"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("imclem", ""), + ("stickell", "l.stickell@yahoo.it"), + ("Elrick69", "elrick69[AT]rocketmail[DOT]com"), + ("Walter Purcaro", "vuolter@gmail.com"), + ("Ludovic Lehmann", "ludo.lehmann@gmail.com")] + + + COOKIES = [("1fichier.com", "LG", "en")] + DISPOSITION = False #: Remove in 0.4.10 + + NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' + SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'File not found !\s*<' + + WAIT_PATTERN = r'>You must wait \d+ minutes' + + + def setup(self): + self.multiDL = self.premium + self.resumeDownload = True + + + def handle_free(self, pyfile): + id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] + url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) + + if not url: + self.fail(_("Download link not found")) + + if "pass" in inputs: + inputs['pass'] = self.getPassword() + + inputs['submit'] = "Download" + + self.download(url, post=inputs) + + + def handle_premium(self, pyfile): + self.download(pyfile.url, post={'dl': "Download", 'did': 0}) diff --git a/pyload/plugin/hoster/OpenloadIo.py b/pyload/plugin/hoster/OpenloadIo.py new file mode 100644 index 000000000..a13015473 --- /dev/null +++ b/pyload/plugin/hoster/OpenloadIo.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class OpenloadIo(SimpleHoster): + __name = "OpenloadIo" + __type = "hoster" + __version = "0.01" + + __pattern = r'https?://(?:www\.)?openload\.io/f/\w{11}' + + __description = """Openload.io hoster plugin""" + __license = "GPLv3" + __authors = [(None, None)] + + + NAME_PATTERN = r'<span id="filename">(?P<N>.+)</' + SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' + OFFLINE_PATTERN = r">(We can't find the file you are looking for)" + + LINK_FREE_PATTERN = r'id="realdownload"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 diff --git a/pyload/plugin/hoster/OronCom.py b/pyload/plugin/hoster/OronCom.py new file mode 100644 index 000000000..29ca267a0 --- /dev/null +++ b/pyload/plugin/hoster/OronCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class OronCom(DeadHoster): + __name = "OronCom" + __type = "hoster" + __version = "0.14" + + __pattern = r'https?://(?:www\.)?oron\.com/\w{12}' + __config = [] + + __description = """Oron.com hoster plugin""" + __license = "GPLv3" + __authors = [("chrox", "chrox@pyload.org"), + ("DHMH", "DHMH@pyload.org")] diff --git a/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py new file mode 100644 index 000000000..0ed1e1d57 --- /dev/null +++ b/pyload/plugin/hoster/OverLoadMe.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import parseFileSize + + +class OverLoadMe(MultiHoster): + __name = "OverLoadMe" + __type = "hoster" + __version = "0.11" + + __pattern = r'https?://.*overload\.me/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Over-Load.me multi-hoster plugin""" + __license = "GPLv3" + __authors = [("marley", "marley@over-load.me")] + + + def setup(self): + self.chunkLimit = 5 + + + def handle_premium(self, pyfile): + https = "https" if self.getConfig('ssl') else "http" + data = self.account.getAccountData(self.user) + page = self.load(https + "://api.over-load.me/getdownload.php", + get={'auth': data['password'], + 'link': pyfile.url}) + + data = json_loads(page) + + self.logDebug(data) + + if data['error'] == 1: + self.logWarning(data['msg']) + self.tempOffline() + else: + if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + + http_repl = ["http://", "https://"] + self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else http_repl[::-1]) diff --git a/pyload/plugin/hoster/PandaplaNet.py b/pyload/plugin/hoster/PandaplaNet.py new file mode 100644 index 000000000..dc23ef6a0 --- /dev/null +++ b/pyload/plugin/hoster/PandaplaNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class PandaplaNet(DeadHoster): + __name = "PandaplaNet" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?pandapla\.net/\w{12}' + __config = [] + + __description = """Pandapla.net hoster plugin""" + __license = "GPLv3" + __authors = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] diff --git a/pyload/plugin/hoster/PornhostCom.py b/pyload/plugin/hoster/PornhostCom.py new file mode 100644 index 000000000..103882166 --- /dev/null +++ b/pyload/plugin/hoster/PornhostCom.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster + + +class PornhostCom(Hoster): + __name = "PornhostCom" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?pornhost\.com/(\d+/\d+\.html|\d+)' + + __description = """Pornhost.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de")] + + + def process(self, pyfile): + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + # Old interface + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html) + if url is None: + url = re.search(r'"(http://dl\d+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html) + if url is None: + url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html) + if url is None: + url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"', + self.html) #: TODO: fix this one since it doesn't match + + return url.group(1).strip() + + + def get_file_name(self): + if not self.html: + self.download_html() + + name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html) + if name is None: + name = re.search(r'id="url" value="http://www\.pornhost\.com/(.*?)/"', self.html) + if name is None: + name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html) + if name is None: + name = re.search(r'"http://file\d+\.pornhost\.com/.*?/(.*?)"', self.html) + + name = name.group(1).strip() + ".flv" + + return name + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + + if re.search(r'gallery not found|You will be redirected to', self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/PornhubCom.py b/pyload/plugin/hoster/PornhubCom.py new file mode 100644 index 000000000..c7bfa339e --- /dev/null +++ b/pyload/plugin/hoster/PornhubCom.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster + + +class PornhubCom(Hoster): + __name = "PornhubCom" + __type = "hoster" + __version = "0.50" + + __pattern = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=\w+' + + __description = """Pornhub.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de")] + + + def process(self, pyfile): + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + url = "http://www.pornhub.com//gateway.php" + video_id = self.pyfile.url.split('=')[-1] + # thanks to jD team for this one v + post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00" + post_data += chr(len(video_id)) + post_data += video_id + post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20" + post_data += "add299463d4410c6d1b1c418868225f7" + + content = self.load(url, post=str(post_data)) + + new_content = "" + for x in content: + if ord(x) < 32 or ord(x) > 176: + new_content += '#' + else: + new_content += x + + content = new_content + + return re.search(r'flv_url.*(http.*?)##post_roll', content).group(1) + + + def get_file_name(self): + if not self.html: + self.download_html() + + m = re.search(r'<title.+?>([^<]+) - ', self.html) + if m: + name = m.group(1) + else: + matches = re.findall('<h1>(.*?)</h1>', self.html) + if len(matches) > 1: + name = matches[1] + else: + name = matches[0] + + return name + '.flv' + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + + if re.search(r'This video is no longer in our database or is in conversion', self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/PotloadCom.py b/pyload/plugin/hoster/PotloadCom.py new file mode 100644 index 000000000..b6b86b689 --- /dev/null +++ b/pyload/plugin/hoster/PotloadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class PotloadCom(DeadHoster): + __name = "PotloadCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?potload\.com/\w{12}' + __config = [] + + __description = """Potload.com hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/PremiumTo.py b/pyload/plugin/hoster/PremiumTo.py new file mode 100644 index 000000000..47169a6a3 --- /dev/null +++ b/pyload/plugin/hoster/PremiumTo.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import os + +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import fs_encode + + +class PremiumTo(MultiHoster): + __name = "PremiumTo" + __type = "hoster" + __version = "0.22" + + __pattern = r'^unmatchable$' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Premium.to multi-hoster plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + CHECK_TRAFFIC = True + + + def handle_premium(self, pyfile): + # raise timeout to 2min + self.download("http://premium.to/api/getfile.php", + get={'username': self.account.username, + 'password': self.account.password, + 'link' : pyfile.url}, + disposition=True) + + + def checkFile(self, rules={}): + if self.checkDownload({'nopremium': "No premium account available"}): + self.retry(60, 5 * 60, "No premium account available") + + err = '' + if self.req.http.code == '420': + # Custom error code send - fail + file = fs_encode(self.lastDownload) + with open(file, "rb") as f: + err = f.read(256).strip() + os.remove(file) + + if err: + self.fail(err) + + return super(PremiumTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/PremiumizeMe.py b/pyload/plugin/hoster/PremiumizeMe.py new file mode 100644 index 000000000..e23ba6b44 --- /dev/null +++ b/pyload/plugin/hoster/PremiumizeMe.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class PremiumizeMe(MultiHoster): + __name = "PremiumizeMe" + __type = "hoster" + __version = "0.16" + + __pattern = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Premiumize.me multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Florian Franzen", "FlorianFranzen@gmail.com")] + + + def handle_premium(self, pyfile): + # In some cases hostsers do not supply us with a filename at download, so we + # are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash + + # Correction for automatic assigned filename: Removing html at end if needed + suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] + temp = pyfile.name.split('.') + if temp.pop() in suffix_to_remove: + pyfile.name = ".".join(temp) + + # Get account data + user, data = self.account.selectAccount() + + # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) + data = json_loads(self.load("https://api.premiumize.me/pm-api/v1.php", + get={'method' : "directdownloadlink", + 'params[login]': user, + 'params[pass]' : data['password'], + 'params[link]' : pyfile.url})) + + # Check status and decide what to do + status = data['status'] + + if status == 200: + self.link = data['result']['location'] + return + + elif status == 400: + self.fail(_("Invalid link")) + + elif status == 404: + self.offline() + + elif status >= 500: + self.tempOffline() + + else: + self.fail(data['statusmessage']) diff --git a/pyload/plugin/hoster/PromptfileCom.py b/pyload/plugin/hoster/PromptfileCom.py new file mode 100644 index 000000000..e3ec899c7 --- /dev/null +++ b/pyload/plugin/hoster/PromptfileCom.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class PromptfileCom(SimpleHoster): + __name = "PromptfileCom" + __type = "hoster" + __version = "0.13" + + __pattern = r'https?://(?:www\.)?promptfile\.com/' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Promptfile.com hoster plugin""" + __license = "GPLv3" + __authors = [("igel", "igelkun@myopera.com")] + + + INFO_PATTERN = r'<span style=".+?" title=".+?">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' + OFFLINE_PATTERN = r'<span style=".+?" title="File Not Found">File Not Found</span>' + + CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />' + LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' + + + def handle_free(self, pyfile): + # STAGE 1: get link to continue + m = re.search(self.CHASH_PATTERN, self.html) + if m is None: + self.error(_("CHASH_PATTERN not found")) + chash = m.group(1) + self.logDebug("Read chash %s" % chash) + # continue to stage2 + self.html = self.load(pyfile.url, decode=True, post={'chash': chash}) + + # STAGE 2: get the direct link + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/PrzeklejPl.py b/pyload/plugin/hoster/PrzeklejPl.py new file mode 100644 index 000000000..f4781abb9 --- /dev/null +++ b/pyload/plugin/hoster/PrzeklejPl.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class PrzeklejPl(DeadHoster): + __name = "PrzeklejPl" + __type = "hoster" + __version = "0.11" + + __pattern = r'http://(?:www\.)?przeklej\.pl/plik/.+' + __config = [] + + __description = """Przeklej.pl hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/PutdriveCom.py b/pyload/plugin/hoster/PutdriveCom.py new file mode 100644 index 000000000..051da9473 --- /dev/null +++ b/pyload/plugin/hoster/PutdriveCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.hoster.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name = "PutdriveCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description = """Multihosters.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py new file mode 100644 index 000000000..f0afd1a95 --- /dev/null +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +import re +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class QuickshareCz(SimpleHoster): + __name = "QuickshareCz" + __type = "hoster" + __version = "0.56" + + __pattern = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Quickshare.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>' + SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</td>' + OFFLINE_PATTERN = r'<script type="text/javascript">location\.href=\'/chyba\';</script>' + + + def process(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + self.getFileInfo() + + # parse js variables + self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html)) + self.logDebug(self.jsvars) + pyfile.name = self.jsvars['ID3'] + + # determine download type - free or premium + if self.premium: + if 'UU_prihlasen' in self.jsvars: + if self.jsvars['UU_prihlasen'] == '0': + self.logWarning(_("User not logged in")) + self.relogin(self.user) + self.retry() + elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): + self.logWarning(_("Not enough credit left")) + self.premium = False + + if self.premium: + self.handle_premium(pyfile) + else: + self.handle_free(pyfile) + + if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): + self.fail(_("File not m or plugin defect")) + + + def handle_free(self, pyfile): + # get download url + download_url = '%s/download.php' % self.jsvars['server'] + data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) + self.logDebug("FREE URL1:" + download_url, data) + + self.load(download_url, post=data, follow_location=False) + self.header = self.req.http.header + + m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) + if m is None: + self.fail(_("File not found")) + + self.link = m.group(1) + self.logDebug("FREE URL2:" + self.link) + + # check errors + m = re.search(r'/chyba/(\d+)', self.link) + if m: + if m.group(1) == '1': + self.retry(60, 2 * 60, "This IP is already downloading") + elif m.group(1) == '2': + self.retry(60, 60, "No free slots available") + else: + self.fail(_("Error %d") % m.group(1)) + + + def handle_premium(self, pyfile): + download_url = '%s/download_premium.php' % self.jsvars['server'] + data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) + self.download(download_url, get=data) diff --git a/pyload/plugin/hoster/RPNetBiz.py b/pyload/plugin/hoster/RPNetBiz.py new file mode 100644 index 000000000..1d15aa3c7 --- /dev/null +++ b/pyload/plugin/hoster/RPNetBiz.py @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import json_loads + + +class RPNetBiz(MultiHoster): + __name = "RPNetBiz" + __type = "hoster" + __version = "0.14" + + __pattern = r'https?://.+rpnet\.biz' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """RPNet.biz multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Dman", "dmanugm@gmail.com")] + + + def setup(self): + self.chunkLimit = -1 + + + def handle_premium(self, pyfile): + user, data = self.account.selectAccount() + + # Get the download link + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action" : "generate", + "links" : pyfile.url}) + + self.logDebug("JSON data: %s" % res) + link_status = json_loads(res)['links'][0] #: get the first link... since we only queried one + + # Check if we only have an id as a HDD link + if 'id' in link_status: + self.logDebug("Need to wait at least 30 seconds before requery") + self.setWait(30) #: wait for 30 seconds + self.wait() + # Lets query the server again asking for the status on the link, + # we need to keep doing this until we reach 100 + max_tries = 30 + my_try = 0 + while (my_try <= max_tries): + self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "downloadInformation", + "id": link_status['id']}) + self.logDebug("JSON data hdd query: %s" % res) + download_status = json_loads(res)['download'] + + if download_status['status'] == '100': + link_status['generated'] = download_status['rpnet_link'] + self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated']) + break + else: + self.logDebug("At %s%% for the file download" % download_status['status']) + + self.setWait(30) + self.wait() + my_try += 1 + + if my_try > max_tries: #: We went over the limit! + self.fail(_("Waited for about 15 minutes for download to finish but failed")) + + if 'generated' in link_status: + self.link = link_status['generated'] + return + elif 'error' in link_status: + self.fail(link_status['error']) + else: + self.fail(_("Something went wrong, not supposed to enter here")) diff --git a/pyload/plugin/hoster/RapideoPl.py b/pyload/plugin/hoster/RapideoPl.py new file mode 100644 index 000000000..8df0a9a4d --- /dev/null +++ b/pyload/plugin/hoster/RapideoPl.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class RapideoPl(MultiHoster): + __name = "RapideoPl" + __type = "hoster" + __version = "0.02" + + __pattern = r'^unmatchable$' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Rapideo.pl multi-hoster plugin""" + __license = "GPLv3" + __authors = [("goddie", "dev@rapideo.pl")] + + + API_URL = "http://enc.rapideo.pl" + + API_QUERY = {'site' : "newrd", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(RapideoPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query['username'] = self.usr + query['password'] = self.pwd + query['url'] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handle_free(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("RunFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("Loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed['errno'] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed['errno']] % self.getClassName()) + else: + # error code isn't yet added to plugin + self.fail( + parsed['errstring'] + or _("Unknown error (code: %s)") % parsed['errno'] + ) + + if "sdownload" in parsed: + if parsed['sdownload'] == "1": + self.fail( + _("Download from %s is possible only using Rapideo.pl website \ + directly") % parsed['hosting']) + + pyfile.name = parsed['filename'] + pyfile.size = parsed['filesize'] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/pyload/plugin/hoster/RapidfileshareNet.py b/pyload/plugin/hoster/RapidfileshareNet.py new file mode 100644 index 000000000..8252b49e7 --- /dev/null +++ b/pyload/plugin/hoster/RapidfileshareNet.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class RapidfileshareNet(XFSHoster): + __name = "RapidfileshareNet" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' + + __description = """Rapidfileshare.net hoster plugin""" + __license = "GPLv3" + __authors = [("guidobelix", "guidobelix@hotmail.it")] + + + NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>.+?)">' + SIZE_PATTERN = r'>http://www.rapidfileshare.net/\w+?</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</font>' + + OFFLINE_PATTERN = r'>No such file with this filename' + TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' diff --git a/pyload/plugin/hoster/RapidgatorNet.py b/pyload/plugin/hoster/RapidgatorNet.py new file mode 100644 index 000000000..f989eadda --- /dev/null +++ b/pyload/plugin/hoster/RapidgatorNet.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re + +from pyload.utils import json_loads +from pyload.network.HTTPRequest import BadHeader +from pyload.plugin.captcha.AdsCaptcha import AdsCaptcha +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.captcha.SolveMedia import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster, secondsToMidnight + + +class RapidgatorNet(SimpleHoster): + __name = "RapidgatorNet" + __type = "hoster" + __version = "0.33" + + __pattern = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Rapidgator.net hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("chrox", ""), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + API_URL = "http://rapidgator.net/api/file" + + COOKIES = [("rapidgator.net", "lang", "en")] + + NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' + SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + OFFLINE_PATTERN = r'>(File not found|Error 404)' + + JSVARS_PATTERN = r'\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*\'?(.*?)\'?;' + + PREMIUM_ONLY_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' + ERROR_PATTERN = r'You have reached your (?:daily|hourly) downloads limit' + WAIT_PATTERN = r'(Delay between downloads must be not less than|Try again in).+' + + LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' + + RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' + ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']+)' + SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"' + + + def setup(self): + if self.account: + self.sid = self.account.getAccountInfo(self.user).get('sid', None) + else: + self.sid = None + + if self.sid: + self.premium = True + + self.resumeDownload = self.multiDL = self.premium + self.chunkLimit = 1 + + + def api_response(self, cmd): + try: + json = self.load('%s/%s' % (self.API_URL, cmd), + get={'sid': self.sid, + 'url': self.pyfile.url}, decode=True) + self.logDebug("API:%s" % cmd, json, "SID: %s" % self.sid) + json = json_loads(json) + status = json['response_status'] + msg = json['response_details'] + + except BadHeader, e: + self.logError("API: %s" % cmd, e, "SID: %s" % self.sid) + status = e.code + msg = e + + if status == 200: + return json['response'] + + elif status == 423: + self.account.empty(self.user) + self.retry() + + else: + self.account.relogin(self.user) + self.retry(wait_time=60) + + + def handle_premium(self, pyfile): + self.api_data = self.api_response('info') + self.api_data['md5'] = self.api_data['hash'] + + pyfile.name = self.api_data['filename'] + pyfile.size = self.api_data['size'] + + self.link = self.api_response('download')['url'] + + + def handle_free(self, pyfile): + jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) + self.logDebug(jsvars) + + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + + url = "http://rapidgator.net%s?fid=%s" % ( + jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) + jsvars.update(self.getJsonResponse(url)) + + self.wait(jsvars.get('secs', 45), False) + + url = "http://rapidgator.net%s?sid=%s" % ( + jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) + jsvars.update(self.getJsonResponse(url)) + + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) + + url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') + self.html = self.load(url) + + for _i in xrange(5): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) + break + else: + captcha = self.handleCaptcha() + + if not captcha: + self.error(_("Captcha pattern not found")) + + response, challenge = captcha.challenge() + + self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", + 'adcopy_challenge' : challenge, + 'adcopy_response' : response}) + + if "The verification code is incorrect" in self.html: + self.invalidCaptcha() + else: + self.correctCaptcha() + else: + self.error(_("Download link")) + + + def handleCaptcha(self): + for klass in (AdsCaptcha, ReCaptcha, SolveMedia): + inst = klass(self) + if inst.detect_key(): + return inst + + + def getJsonResponse(self, url): + res = self.load(url, decode=True) + if not res.startswith('{'): + self.retry() + self.logDebug(url, res) + return json_loads(res) diff --git a/pyload/plugin/hoster/RapiduNet.py b/pyload/plugin/hoster/RapiduNet.py new file mode 100644 index 000000000..35f51e6af --- /dev/null +++ b/pyload/plugin/hoster/RapiduNet.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +import pycurl +import time + +from pyload.utils import json_loads +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class RapiduNet(SimpleHoster): + __name = "RapiduNet" + __type = "hoster" + __version = "0.08" + + __pattern = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Rapidu.net hoster plugin""" + __license = "GPLv3" + __authors = [("prOq", "")] + + + COOKIES = [("rapidu.net", "rapidu_lang", "en")] + + INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' + OFFLINE_PATTERN = r'<h1>404' + + ERROR_PATTERN = r'<div class="error">' + + RECAPTCHA_KEY = r'6Ld12ewSAAAAAHoE6WVP_pSfCdJcBQScVweQh8Io' + + + def setup(self): + self.resumeDownload = True + self.multiDL = self.premium + + + def handle_free(self, pyfile): + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getLoadTimeToDownload"}, + post={'_go': ""}, + decode=True) + + if str(jsvars['timeToDownload']) is "stop": + t = (24 * 60 * 60) - (int(time.time()) % (24 * 60 * 60)) + time.altzone + + self.logInfo("You've reach your daily download transfer") + + self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock + + else: + self.wait(int(jsvars['timeToDownload']) - int(time.time())) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getCheckCaptcha"}, + post={'_go' : "", + 'captcha1': challenge, + 'captcha2': response, + 'fileId' : self.info['pattern']['ID']}, + decode=True) + + if jsvars['message'] == 'success': + self.link = jsvars['url'] + + + def getJsonResponse(self, *args, **kwargs): + res = self.load(*args, **kwargs) + if not res.startswith('{'): + self.retry() + + self.logDebug(res) + + return json_loads(res) diff --git a/pyload/plugin/hoster/RarefileNet.py b/pyload/plugin/hoster/RarefileNet.py new file mode 100644 index 000000000..2c853c6ba --- /dev/null +++ b/pyload/plugin/hoster/RarefileNet.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class RarefileNet(XFSHoster): + __name = "RarefileNet" + __type = "hoster" + __version = "0.09" + + __pattern = r'http://(?:www\.)?rarefile\.net/\w{12}' + + __description = """Rarefile.net hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + LINK_PATTERN = r'<a href="(.+?)">\1</a>' diff --git a/pyload/plugin/hoster/RealdebridCom.py b/pyload/plugin/hoster/RealdebridCom.py new file mode 100644 index 000000000..ece063ccf --- /dev/null +++ b/pyload/plugin/hoster/RealdebridCom.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import time + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.utils import parseFileSize + + +class RealdebridCom(MultiHoster): + __name = "RealdebridCom" + __type = "hoster" + __version = "0.67" + + __pattern = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Real-Debrid.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Devirex Hazzard", "naibaf_11@yahoo.de")] + + + def setup(self): + self.chunkLimit = 3 + + + def handle_premium(self, pyfile): + data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", + get={'lang' : "en", + 'link' : pyfile.url, + 'password': self.getPassword(), + 'time' : int(time.time() * 1000)})) + + self.logDebug("Returned Data: %s" % data) + + if data['error'] != 0: + if data['message'] == "Your file is unavailable on the hoster.": + self.offline() + else: + self.logWarning(data['message']) + self.tempOffline() + else: + if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']: + pyfile.name = data['file_name'] + pyfile.size = parseFileSize(data['file_size']) + self.link = data['generated_links'][0][-1] + + if self.getConfig('ssl'): + self.link = self.link.replace("http://", "https://") + else: + self.link = self.link.replace("https://", "http://") diff --git a/pyload/plugin/hoster/RedtubeCom.py b/pyload/plugin/hoster/RedtubeCom.py new file mode 100644 index 000000000..4b9afbc2b --- /dev/null +++ b/pyload/plugin/hoster/RedtubeCom.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster +from pyload.utils import html_unescape + + +class RedtubeCom(Hoster): + __name = "RedtubeCom" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?redtube\.com/\d+' + + __description = """Redtube.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de")] + + + def process(self, pyfile): + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + file_url = html_unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) + + return file_url + + + def get_file_name(self): + if not self.html: + self.download_html() + + return re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv" + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + + if re.search(r'This video has been removed.', self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/RehostTo.py b/pyload/plugin/hoster/RehostTo.py new file mode 100644 index 000000000..d63ca54b7 --- /dev/null +++ b/pyload/plugin/hoster/RehostTo.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class RehostTo(MultiHoster): + __name = "RehostTo" + __type = "hoster" + __version = "0.21" + + __pattern = r'https?://.*rehost\.to\..+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Rehost.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "RaNaN@pyload.org")] + + + def handle_premium(self, pyfile): + self.download("http://rehost.to/process_download.php", + get={'user': "cookie", + 'pass': self.account.getAccountInfo(self.user)['session'], + 'dl' : pyfile.url}, + disposition=True) diff --git a/pyload/plugin/hoster/RemixshareCom.py b/pyload/plugin/hoster/RemixshareCom.py new file mode 100644 index 000000000..0b331c1c6 --- /dev/null +++ b/pyload/plugin/hoster/RemixshareCom.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://remixshare.com/download/z8uli +# +# Note: +# The remixshare.com website is very very slow, so +# if your download not starts because of pycurl timeouts: +# Adjust timeouts in /usr/share/pyload/pyload/network/HTTPRequest.py + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class RemixshareCom(SimpleHoster): + __name = "RemixshareCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://remixshare\.com/(download|dl)/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Remixshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de" ), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("sraedler" , "simon.raedler@yahoo.de")] + + + INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' + HASHSUM_PATTERN = r'>(?P<T>MD5): (?P<H>\w+)' + OFFLINE_PATTERN = r'<h1>Ooops!' + + LINK_PATTERN = r'var uri = "(.+?)"' + TOKEN_PATTERN = r'var acc = (\d+)' + + WAIT_PATTERN = r'var XYZ = "(\d+)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + b = re.search(self.LINK_PATTERN, self.html) + if not b: + self.error(_("File url")) + + c = re.search(self.TOKEN_PATTERN, self.html) + if not c: + self.error(_("File token")) + + self.link = b.group(1) + "/zzz/" + c.group(1) diff --git a/pyload/plugin/hoster/RgHostNet.py b/pyload/plugin/hoster/RgHostNet.py new file mode 100644 index 000000000..04ecbda8f --- /dev/null +++ b/pyload/plugin/hoster/RgHostNet.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class RgHostNet(SimpleHoster): + __name = "RgHostNet" + __type = "hoster" + __version = "0.04" + + __pattern = r'http://(?:www\.)?rghost\.(net|ru)/[\d-]+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """RgHost.net hoster plugin""" + __license = "GPLv3" + __authors = [("z00nx", "z00nx0@gmail.com")] + + + INFO_PATTERN = r'data-share42-text="(?P<N>.+?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' + HASHSUM_PATTERN = r'<dt>(?P<T>\w+)</dt>\s*<dd>(?P<H>\w+)' + OFFLINE_PATTERN = r'>(File is deleted|page not found)' + + LINK_FREE_PATTERN = r'<a href="(.+?)" class="btn large' diff --git a/pyload/plugin/hoster/SafesharingEu.py b/pyload/plugin/hoster/SafesharingEu.py new file mode 100644 index 000000000..0676015a2 --- /dev/null +++ b/pyload/plugin/hoster/SafesharingEu.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class SafesharingEu(XFSHoster): + __name = "SafesharingEu" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?safesharing\.eu/\w{12}' + + __description = """Safesharing.eu hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)' diff --git a/pyload/plugin/hoster/SecureUploadEu.py b/pyload/plugin/hoster/SecureUploadEu.py new file mode 100644 index 000000000..8cd310c2c --- /dev/null +++ b/pyload/plugin/hoster/SecureUploadEu.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class SecureUploadEu(XFSHoster): + __name = "SecureUploadEu" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?secureupload\.eu/\w{12}' + + __description = """SecureUpload.eu hoster plugin""" + __license = "GPLv3" + __authors = [("z00nx", "z00nx0@gmail.com")] + + + INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' diff --git a/pyload/plugin/hoster/SendspaceCom.py b/pyload/plugin/hoster/SendspaceCom.py new file mode 100644 index 000000000..39951f55b --- /dev/null +++ b/pyload/plugin/hoster/SendspaceCom.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class SendspaceCom(SimpleHoster): + __name = "SendspaceCom" + __type = "hoster" + __version = "0.17" + + __pattern = r'https?://(?:www\.)?sendspace\.com/file/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Sendspace.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</' + SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>' + OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>' + + LINK_FREE_PATTERN = r'<a id="download_button" href="(.+?)"' + + CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=(.+?))"></td>' + USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=(.+?))"></td>' + + + def handle_free(self, pyfile): + params = {} + for _i in xrange(3): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + if 'captcha_hash' in params: + self.correctCaptcha() + self.link = m.group(1) + break + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + if 'captcha_hash' in params: + self.invalidCaptcha() + captcha_url1 = "http://www.sendspace.com/" + m.group(1) + m = re.search(self.USER_CAPTCHA_PATTERN, self.html) + captcha_url2 = "http://www.sendspace.com/" + m.group(1) + params = {'captcha_hash': m.group(2), + 'captcha_submit': 'Verify', + 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)} + else: + params = {'download': "Regular Download"} + + self.logDebug(params) + self.html = self.load(pyfile.url, post=params) + else: + self.fail(_("Download link not found")) diff --git a/pyload/plugin/hoster/Share4WebCom.py b/pyload/plugin/hoster/Share4WebCom.py new file mode 100644 index 000000000..72e3e4a02 --- /dev/null +++ b/pyload/plugin/hoster/Share4WebCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.hoster.UnibytesCom import UnibytesCom + + +class Share4WebCom(UnibytesCom): + __name = "Share4WebCom" + __type = "hoster" + __version = "0.11" + + __pattern = r'https?://(?:www\.)?share4web\.com/get/\w+' + + __description = """Share4web.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + HOSTER_DOMAIN = "share4web.com" diff --git a/pyload/plugin/hoster/Share76Com.py b/pyload/plugin/hoster/Share76Com.py new file mode 100644 index 000000000..fda983401 --- /dev/null +++ b/pyload/plugin/hoster/Share76Com.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class Share76Com(DeadHoster): + __name = "Share76Com" + __type = "hoster" + __version = "0.04" + + __pattern = r'http://(?:www\.)?share76\.com/\w{12}' + __config = [] + + __description = """Share76.com hoster plugin""" + __license = "GPLv3" + __authors = [] diff --git a/pyload/plugin/hoster/ShareFilesCo.py b/pyload/plugin/hoster/ShareFilesCo.py new file mode 100644 index 000000000..37e386034 --- /dev/null +++ b/pyload/plugin/hoster/ShareFilesCo.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class ShareFilesCo(DeadHoster): + __name = "ShareFilesCo" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?sharefiles\.co/\w{12}' + __config = [] + + __description = """Sharefiles.co hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/SharebeesCom.py b/pyload/plugin/hoster/SharebeesCom.py new file mode 100644 index 000000000..5b5017fc2 --- /dev/null +++ b/pyload/plugin/hoster/SharebeesCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class SharebeesCom(DeadHoster): + __name = "SharebeesCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?sharebees\.com/\w{12}' + __config = [] + + __description = """ShareBees hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/ShareonlineBiz.py b/pyload/plugin/hoster/ShareonlineBiz.py new file mode 100644 index 000000000..ad56b83f4 --- /dev/null +++ b/pyload/plugin/hoster/ShareonlineBiz.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- + +import re +import time +import urllib +import urlparse + +from pyload.network.RequestFactory import getURL +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class ShareonlineBiz(SimpleHoster): + __name = "ShareonlineBiz" + __type = "hoster" + __version = "0.49" + + __pattern = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Shareonline.biz hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(__pattern + ".*", "http://www.share-online.biz/dl/\g<ID>")] + + CHECK_TRAFFIC = True + + RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" + + ERROR_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' + + + @classmethod + def getInfo(cls, url="", html=""): + info = {'name': urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} + + if url: + info['pattern'] = re.match(cls.__pattern, url).groupdict() + + field = getURL("http://api.share-online.biz/linkcheck.php", + get={'md5': "1"}, + post={'links': info['pattern']['ID']}, + decode=True).split(";") + + if field[1] == "OK": + info['fileid'] = field[0] + info['status'] = 2 + info['name'] = field[2] + info['size'] = field[3] #: in bytes + info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 + + elif field[1] in ("DELETED", "NOT FOUND"): + info['status'] = 1 + + return info + + + def setup(self): + self.resumeDownload = self.premium + self.multiDL = False + + + def handleCaptcha(self): + recaptcha = ReCaptcha(self) + + for _i in xrange(5): + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + m = re.search(r'var wait=(\d+);', self.html) + self.setWait(int(m.group(1)) if m else 30) + + res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)), + post={'dl_free' : "1", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + if not res == '0': + self.correctCaptcha() + return res + else: + self.invalidCaptcha() + else: + self.invalidCaptcha() + self.fail(_("No valid captcha solution received")) + + + def handle_free(self, pyfile): + self.wait(3) + + self.html = self.load("%s/free/" % pyfile.url, + post={'dl_free': "1", 'choice': "free"}, + decode=True) + + self.checkErrors() + + res = self.handleCaptcha() + self.link = res.decode('base64') + + if not self.link.startswith("http://"): + self.error(_("Wrong download url")) + + self.wait() + + + def checkFile(self, rules={}): + check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), + 'fail' : re.compile(r"<title>Share-Online")}) + + if check == "cookie": + self.invalidCaptcha() + self.retry(5, 60, _("Cookie failure")) + + elif check == "fail": + self.invalidCaptcha() + self.retry(5, 5 * 60, _("Download failed")) + + return super(ShareonlineBiz, self).checkFile(rules) + + + def handle_premium(self, pyfile): #: should be working better loading (account) api internally + html = self.load("http://api.share-online.biz/account.php", + get={'username': self.user, + 'password': self.account.getAccountData(self.user)['password'], + 'act' : "download", + 'lid' : self.info['fileid']}) + + self.api_data = dlinfo = {} + + for line in html.splitlines(): + key, value = line.split(": ") + dlinfo[key.lower()] = value + + self.logDebug(dlinfo) + + if not dlinfo['status'] == "online": + self.offline() + else: + pyfile.name = dlinfo['name'] + pyfile.size = int(dlinfo['size']) + + self.link = dlinfo['url'] + + if self.link == "server_under_maintenance": + self.tempOffline() + else: + self.multiDL = True + + + def checkErrors(self): + m = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL) + if m is None: + self.info.pop('error', None) + return + + errmsg = m.group(1).lower() + + try: + self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) + except Exception: + self.logError("Unknown error occurred", errmsg) + + if errmsg is "invalid": + self.fail(_("File not available")) + + elif errmsg in ("freelimit", "size", "proxy"): + self.fail(_("Premium account needed")) + + elif errmsg in ("expired", "server"): + self.retry(wait_time=600, reason=errmsg) + + elif 'slot' in errmsg: + self.wantReconnect = True + self.retry(24, 3600, errmsg) + + else: + self.wantReconnect = True + self.retry(wait_time=60, reason=errmsg) diff --git a/pyload/plugin/hoster/ShareplaceCom.py b/pyload/plugin/hoster/ShareplaceCom.py new file mode 100644 index 000000000..b1361e859 --- /dev/null +++ b/pyload/plugin/hoster/ShareplaceCom.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.plugin.Hoster import Hoster + + +class ShareplaceCom(Hoster): + __name = "ShareplaceCom" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' + + __description = """Shareplace.com hoster plugin""" + __license = "GPLv3" + __authors = [("ACCakut", "")] + + + def process(self, pyfile): + self.pyfile = pyfile + self.prepare() + self.download(self.get_file_url()) + + + def prepare(self): + if not self.file_exists(): + self.offline() + + self.pyfile.name = self.get_file_name() + + wait_time = self.get_waiting_time() + self.setWait(wait_time) + self.wait() + + + def get_waiting_time(self): + if not self.html: + self.download_html() + + # var zzipitime = 15; + m = re.search(r'var zzipitime = (\d+);', self.html) + if m: + sec = int(m.group(1)) + else: + sec = 0 + + return sec + + + def download_html(self): + url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url) + self.html = self.load(url, decode=True) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + url = re.search(r"var beer = '(.*?)';", self.html) + if url: + url = url.group(1) + url = urllib.unquote( + url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace( + "teletubbies", "")) + self.logDebug("URL: %s" % url) + return url + else: + self.error(_("Absolute filepath not found")) + + + def get_file_name(self): + if not self.html: + self.download_html() + + return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1) + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + + if re.search(r"HTTP Status 404", self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/SharingmatrixCom.py b/pyload/plugin/hoster/SharingmatrixCom.py new file mode 100644 index 000000000..c4938f9bc --- /dev/null +++ b/pyload/plugin/hoster/SharingmatrixCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class SharingmatrixCom(DeadHoster): + __name = "SharingmatrixCom" + __type = "hoster" + __version = "0.01" + + __pattern = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' + __config = [] + + __description = """Sharingmatrix.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("paulking", "")] diff --git a/pyload/plugin/hoster/ShragleCom.py b/pyload/plugin/hoster/ShragleCom.py new file mode 100644 index 000000000..c435d01a7 --- /dev/null +++ b/pyload/plugin/hoster/ShragleCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class ShragleCom(DeadHoster): + __name = "ShragleCom" + __type = "hoster" + __version = "0.22" + + __pattern = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' + __config = [] + + __description = """Cloudnator.com (Shragle.com) hoster plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/SimplyPremiumCom.py b/pyload/plugin/hoster/SimplyPremiumCom.py new file mode 100644 index 000000000..f4f7a3006 --- /dev/null +++ b/pyload/plugin/hoster/SimplyPremiumCom.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.MultiHoster import MultiHoster +from pyload.plugin.internal.SimpleHoster import secondsToMidnight + + +class SimplyPremiumCom(MultiHoster): + __name = "SimplyPremiumCom" + __type = "hoster" + __version = "0.08" + + __pattern = r'https?://.+simply-premium\.com' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Simply-Premium.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("EvolutionClip", "evolutionclip@live.de")] + + + def setup(self): + self.chunkLimit = 16 + + + def checkErrors(self): + if '<valid>0</valid>' in self.html or ( + "You are not allowed to download from this host" in self.html and self.premium): + self.account.relogin(self.user) + self.retry() + + elif "NOTFOUND" in self.html: + self.offline() + + elif "downloadlimit" in self.html: + self.logWarning(_("Reached maximum connctions")) + self.retry(5, 60, _("Reached maximum connctions")) + + elif "trafficlimit" in self.html: + self.logWarning(_("Reached daily limit for this host")) + self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") + + elif "hostererror" in self.html: + self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) + self.retry(5, 60, _("Hoster is temporarily unavailable")) + + + def handle_premium(self, pyfile): + for _i in xrange(5): + self.html = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) + + if self.html: + self.logDebug("JSON data: " + self.html) + break + else: + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) + self.retry(5, 60, _("Unable to get API data")) + + self.checkErrors() + + try: + self.pyfile.name = re.search(r'<name>([^<]+)</name>', self.html).group(1) + + except AttributeError: + self.pyfile.name = "" + + try: + self.pyfile.size = re.search(r'<size>(\d+)</size>', self.html).group(1) + + except AttributeError: + self.pyfile.size = 0 + + try: + self.link = re.search(r'<download>([^<]+)</download>', self.html).group(1) + + except AttributeError: + self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url diff --git a/pyload/plugin/hoster/SimplydebridCom.py b/pyload/plugin/hoster/SimplydebridCom.py new file mode 100644 index 000000000..a053e0b76 --- /dev/null +++ b/pyload/plugin/hoster/SimplydebridCom.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.MultiHoster import MultiHoster, replace_patterns + + +class SimplydebridCom(MultiHoster): + __name = "SimplydebridCom" + __type = "hoster" + __version = "0.17" + + __pattern = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Simply-debrid.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("Kagenoshin", "kagenoshin@gmx.ch")] + + + def handle_premium(self, pyfile): + # fix the links for simply-debrid.com! + self.link = replace_patterns(pyfile.url, [("clz.to", "cloudzer.net/file") + ("http://share-online", "http://www.share-online") + ("ul.to", "uploaded.net/file") + ("uploaded.com", "uploaded.net") + ("filerio.com", "filerio.in") + ("lumfile.com", "lumfile.se")]) + + if 'fileparadox' in self.link: + self.link = self.link.replace("http://", "https://") + + self.html = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) + if 'tiger Link' in self.html or 'Invalid Link' in self.html or ('API' in self.html and 'ERROR' in self.html): + self.error(_("Unable to unrestrict link")) + + self.link = self.html + + self.wait(5) + + + def checkFile(self, rules={}): + if self.checkDownload({"error": "No address associated with hostname"}): + self.retry(24, 3 * 60, _("Bad file downloaded")) + + return super(SimplydebridCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/SizedriveCom.py b/pyload/plugin/hoster/SizedriveCom.py new file mode 100644 index 000000000..ece548921 --- /dev/null +++ b/pyload/plugin/hoster/SizedriveCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class SizedriveCom(SimpleHoster): + __name = "SizedriveCom" + __type = "hoster" + __version = "0.01" + + __pattern = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' + + __description = """Sizedrive.com hoster plugin""" + __license = "GPLv3" + __authors = [("GammaC0de", None)] + + + NAME_PATTERN = r'>Nome:</b> (?P<N>.+?)<' + SIZE_PATTERN = r'>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'ARQUIVO DELATADO POR' + + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + self.wait(5) + self.html = self.load("http://www.sizedrive.com/getdownload.php", + post={'id': self.info['pattern']['ID']}) + + m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html) + if m: + self.link = m.group(1) diff --git a/pyload/plugin/hoster/SmoozedCom.py b/pyload/plugin/hoster/SmoozedCom.py new file mode 100644 index 000000000..83995b4cd --- /dev/null +++ b/pyload/plugin/hoster/SmoozedCom.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +from pyload.utils import json_loads +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class SmoozedCom(MultiHoster): + __name = "SmoozedCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Smoozed.com hoster plugin""" + __license = "GPLv3" + __authors = [("", "")] + + + def handle_free(self, pyfile): + # In some cases hostsers do not supply us with a filename at download, so we + # are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash + + # Correction for automatic assigned filename: Removing html at end if needed + suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] + temp = pyfile.name.split('.') + + if temp.pop() in suffix_to_remove: + pyfile.name = ".".join(temp) + + # Check the link + get_data = {'session_key': self.account.getAccountInfo(self.user)['session'], + 'url' : pyfile.url} + + data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + + if data['state'] != "ok": + self.fail(data['message']) + + if data['data'].get("state", "ok") != "ok": + if data['data'] == "Offline": + self.offline() + else: + self.fail(data['data']['message']) + + pyfile.name = data['data']['name'] + pyfile.size = int(data['data']['size']) + + # Start the download + header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) + + if not "location" in header: + self.fail(_("Unable to initialize download")) + else: + self.link = header['location'][-1] if isinstance(header['location'], list) else header['location'] + + + def checkFile(self, rules={}): + if self.checkDownload({'error': '{"state":"error"}', + 'retry': '{"state":"retry"}'}): + self.fail(_("Error response received")) + + return super(SmoozedCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/SockshareCom.py b/pyload/plugin/hoster/SockshareCom.py new file mode 100644 index 000000000..f6cff5858 --- /dev/null +++ b/pyload/plugin/hoster/SockshareCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class SockshareCom(DeadHoster): + __name = "SockshareCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config = [] + + __description = """Sockshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugin/hoster/SolidfilesCom.py b/pyload/plugin/hoster/SolidfilesCom.py new file mode 100644 index 000000000..9998f26ad --- /dev/null +++ b/pyload/plugin/hoster/SolidfilesCom.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.solidfiles.com/d/609cdb4b1b + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class SolidfilesCom(SimpleHoster): + __name = "SolidfilesCom" + __type = "hoster" + __version = "0.02" + + __pattern = r'http://(?:www\.)?solidfiles\.com\/d/\w+' + + __description = """Solidfiles.com hoster plugin""" + __license = "GPLv3" + __authors = [("sraedler", "simon.raedler@yahoo.de")] + + + NAME_PATTERN = r'<h1 title="(?P<N>.+?)"' + SIZE_PATTERN = r'<p class="meta">(?P<S>[\d.,]+) (?P<U>[\w_^]+)' + OFFLINE_PATTERN = r'<h1>404' + + LINK_FREE_PATTERN = r'id="ddl-text" href="(.+?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 diff --git a/pyload/plugin/hoster/SoundcloudCom.py b/pyload/plugin/hoster/SoundcloudCom.py new file mode 100644 index 000000000..15d2b9f17 --- /dev/null +++ b/pyload/plugin/hoster/SoundcloudCom.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import json_loads + + +class SoundcloudCom(SimpleHoster): + __name = "SoundcloudCom" + __type = "hoster" + __version = "0.11" + + __pattern = r'https?://(?:www\.)?soundcloud\.com/[\w-]+/[\w-]+' + __config = [("use_premium", "bool" , "Use premium account if available", True ), + ("quality" , "Lower;Higher", "Quality" , "Higher")] + + __description = """SoundCloud.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'title" content="(?P<N>.+?)"' + OFFLINE_PATTERN = r'<title>"SoundCloud - Hear the world’s sounds"</title>' + + + def handle_free(self, pyfile): + try: + song_id = re.search(r'sounds:(\d+)"', self.html).group(1) + + except Exception: + self.error(_("Could not find song id")) + + try: + client_id = re.search(r'"clientID":"(.+?)"', self.html).group(1) + + except Exception: + client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" + + # url to retrieve the actual song url + streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, + get={'client_id': client_id})) + + regex = re.compile(r'[^\d]') + http_streams = sorted([(key, value) for key, value in streams.iteritems() if key.startswith('http_')], + key=lambda t: regex.sub(t[0], ''), + reverse=True) + + self.logDebug("Streams found: %s" % (http_streams or "None")) + + if http_streams: + stream_name, self.link = http_streams[0 if self.getConfig('quality') == "Higher" else -1] + pyfile.name += '.' + stream_name.split('_')[1].lower() diff --git a/pyload/plugin/hoster/SpeedLoadOrg.py b/pyload/plugin/hoster/SpeedLoadOrg.py new file mode 100644 index 000000000..383d60817 --- /dev/null +++ b/pyload/plugin/hoster/SpeedLoadOrg.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class SpeedLoadOrg(DeadHoster): + __name = "SpeedLoadOrg" + __type = "hoster" + __version = "1.02" + + __pattern = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' + __config = [] + + __description = """Speedload.org hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/SpeedfileCz.py b/pyload/plugin/hoster/SpeedfileCz.py new file mode 100644 index 000000000..bb1b2c527 --- /dev/null +++ b/pyload/plugin/hoster/SpeedfileCz.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class SpeedfileCz(DeadHoster): + __name = "SpeedFileCz" + __type = "hoster" + __version = "0.32" + + __pattern = r'http://(?:www\.)?speedfile\.cz/.+' + __config = [] + + __description = """Speedfile.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/SpeedyshareCom.py b/pyload/plugin/hoster/SpeedyshareCom.py new file mode 100644 index 000000000..5ad141bc1 --- /dev/null +++ b/pyload/plugin/hoster/SpeedyshareCom.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://speedy.sh/ep2qY/Zapp-Brannigan.jpg + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class SpeedyshareCom(SimpleHoster): + __name = "SpeedyshareCom" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Speedyshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'class=downloadfilename>(?P<N>.*)</span></td>' + SIZE_PATTERN = r'class=sizetagtext>(?P<S>.*) (?P<U>[kKmM]?[iI]?[bB]?)</div>' + + OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' + + LINK_FREE_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.link = m.group(1) diff --git a/pyload/plugin/hoster/StorageTo.py b/pyload/plugin/hoster/StorageTo.py new file mode 100644 index 000000000..8c0cc046e --- /dev/null +++ b/pyload/plugin/hoster/StorageTo.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class StorageTo(DeadHoster): + __name = "StorageTo" + __type = "hoster" + __version = "0.01" + + __pattern = r'http://(?:www\.)?storage\.to/get/.+' + __config = [] + + __description = """Storage.to hoster plugin""" + __license = "GPLv3" + __authors = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugin/hoster/StreamCz.py b/pyload/plugin/hoster/StreamCz.py new file mode 100644 index 000000000..0500574ca --- /dev/null +++ b/pyload/plugin/hoster/StreamCz.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster + + +def getInfo(urls): + result = [] + + for url in urls: + + html = getURL(url) + if re.search(StreamCz.OFFLINE_PATTERN, html): + # File offline + result.append((url, 0, 1, url)) + else: + result.append((url, 0, 2, url)) + yield result + + +class StreamCz(Hoster): + __name = "StreamCz" + __type = "hoster" + __version = "0.20" + + __pattern = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+' + + __description = """Stream.cz hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-(.+?)" />' + OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>' + + CDN_PATTERN = r'<param name="flashvars" value=".+?&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def process(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + + if re.search(self.OFFLINE_PATTERN, self.html): + self.offline() + + m = re.search(self.CDN_PATTERN, self.html) + if m is None: + self.error(_("CDN_PATTERN not found")) + cdn = m.groupdict() + self.logDebug(cdn) + for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): + if cdnkey in cdn and cdn[cdnkey] > '': + cdnid = cdn[cdnkey] + break + else: + self.fail(_("Stream URL not found")) + + m = re.search(self.NAME_PATTERN, self.html) + if m is None: + self.error(_("NAME_PATTERN not found")) + pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) + + download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid + self.logInfo(_("STREAM: %s") % cdnkey[-2:], download_url) + self.download(download_url) diff --git a/pyload/plugin/hoster/StreamcloudEu.py b/pyload/plugin/hoster/StreamcloudEu.py new file mode 100644 index 000000000..da759ae3b --- /dev/null +++ b/pyload/plugin/hoster/StreamcloudEu.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class StreamcloudEu(XFSHoster): + __name = "StreamcloudEu" + __type = "hoster" + __version = "0.10" + + __pattern = r'http://(?:www\.)?streamcloud\.eu/\w{12}' + + __description = """Streamcloud.eu hoster plugin""" + __license = "GPLv3" + __authors = [("seoester", "seoester@googlemail.com")] + + + WAIT_PATTERN = r'var count = (\d+)' + + LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud\.eu:?\d*/.*/video\.(mp4|flv))",' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium diff --git a/pyload/plugin/hoster/TurbobitNet.py b/pyload/plugin/hoster/TurbobitNet.py new file mode 100644 index 000000000..8138e2e23 --- /dev/null +++ b/pyload/plugin/hoster/TurbobitNet.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- + +import binascii +import pycurl +import random +import re +import time +import urllib + +import Crypto + +from pyload.network.RequestFactory import getURL +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, timestamp + + +class TurbobitNet(SimpleHoster): + __name = "TurbobitNet" + __type = "hoster" + __version = "0.19" + + __pattern = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Turbobit.net hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("prOq", "")] + + + URL_REPLACEMENTS = [(__pattern + ".*", "http://turbobit.net/\g<ID>.html")] + + COOKIES = [("turbobit.net", "user_lang", "en")] + + NAME_PATTERN = r'id="file-title">(?P<N>.+?)<' + SIZE_PATTERN = r'class="file-size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'(/download/redirect/[^"\']+)' + + LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' + + + def handle_free(self, pyfile): + self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID'], + decode=True) + + rtUpdate = self.getRtUpdate() + + self.solveCaptcha() + + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + + self.html = self.load(self.getDownloadUrl(rtUpdate)) + + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) + + + def solveCaptcha(self): + for _i in xrange(5): + m = re.search(self.LIMIT_WAIT_PATTERN, self.html) + if m: + wait_time = int(m.group(1)) + self.wait(wait_time, wait_time > 60) + self.retry() + + action, inputs = self.parseHtmlForm("action='#'") + if not inputs: + self.error(_("Captcha form not found")) + self.logDebug(inputs) + + if inputs['captcha_type'] == 'recaptcha': + recaptcha = ReCaptcha(self) + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + else: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("captcha")) + captcha_url = m.group(1) + inputs['captcha_response'] = self.decryptCaptcha(captcha_url) + + self.logDebug(inputs) + self.html = self.load(self.url, post=inputs) + + if '<div class="captcha-error">Incorrect, try again!<' in self.html: + self.invalidCaptcha() + else: + self.correctCaptcha() + break + else: + self.fail(_("Invalid captcha")) + + + def getRtUpdate(self): + rtUpdate = self.getStorage("rtUpdate") + if not rtUpdate: + if self.getStorage("version") != self.__version \ + or int(self.getStorage("timestamp", 0)) + 86400000 < timestamp(): + # that's right, we are even using jdownloader updates + rtUpdate = getURL("http://update0.jdownloader.org/pluginstuff/tbupdate.js") + rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) + # but we still need to fix the syntax to work with other engines than rhino + rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{', + r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) + rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) + + self.setStorage("rtUpdate", rtUpdate) + self.setStorage("timestamp", timestamp()) + self.setStorage("version", self.__version) + else: + self.logError(_("Unable to download, wait for update...")) + self.tempOffline() + + return rtUpdate + + + def getDownloadUrl(self, rtUpdate): + self.req.http.lastURL = self.url + + m = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html) + if m: + url = "http://turbobit.net%s%s" % m.groups() + else: + url = "http://turbobit.net/files/timeout.js?ver=%s" % "".join(random.choice('0123456789ABCDEF') for _i in xrange(32)) + + fun = self.load(url) + + self.setWait(65, False) + + for b in [1, 3]: + self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( + self.info['pattern']['ID'], b, urllib.quote(fun), rtUpdate) + + try: + out = self.js.eval(self.jscode) + self.logDebug("URL", self.js.engine, out) + if out.startswith('/download/'): + return "http://turbobit.net%s" % out.strip() + + except Exception, e: + self.logError(e) + else: + if self.retries >= 2: + # retry with updated js + self.delStorage("rtUpdate") + else: + self.retry() + + self.wait() + + + def decrypt(self, data): + cipher = Crypto.Cipher.ARC4.new(binascii.hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) + return binascii.unhexlify(cipher.encrypt(binascii.unhexlify(data))) + + + def getLocalTimeString(self): + lt = time.localtime() + tz = time.altzone if lt.tm_isdst else time.timezone + return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) diff --git a/pyload/plugin/hoster/TurbouploadCom.py b/pyload/plugin/hoster/TurbouploadCom.py new file mode 100644 index 000000000..1452f05be --- /dev/null +++ b/pyload/plugin/hoster/TurbouploadCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class TurbouploadCom(DeadHoster): + __name = "TurbouploadCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?turboupload\.com/(\w+)' + __config = [] + + __description = """Turboupload.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/TusfilesNet.py b/pyload/plugin/hoster/TusfilesNet.py new file mode 100644 index 000000000..068b8df58 --- /dev/null +++ b/pyload/plugin/hoster/TusfilesNet.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +from pyload.network.HTTPRequest import BadHeader +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class TusfilesNet(XFSHoster): + __name = "TusfilesNet" + __type = "hoster" + __version = "0.10" + + __pattern = r'https?://(?:www\.)?tusfiles\.net/\w{12}' + + __description = """Tusfiles.net hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com"), + ("guidobelix", "guidobelix@hotmail.it")] + + + INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' + OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!|The file you are trying to download is no longer available' + + + def setup(self): + self.chunkLimit = -1 + self.multiDL = True + self.resumeDownload = True + + + def downloadLink(self, link, disposition=True): + try: + return super(TusfilesNet, self).downloadLink(link, disposition) + + except BadHeader, e: + if e.code is 503: + self.multiDL = False + raise Retry("503") diff --git a/pyload/plugin/hoster/TwoSharedCom.py b/pyload/plugin/hoster/TwoSharedCom.py new file mode 100644 index 000000000..988c50620 --- /dev/null +++ b/pyload/plugin/hoster/TwoSharedCom.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class TwoSharedCom(SimpleHoster): + __name = "TwoSharedCom" + __type = "hoster" + __version = "0.13" + + __pattern = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """2Shared.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' + SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' + + LINK_FREE_PATTERN = r'window.location =\'(.+?)\';' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True diff --git a/pyload/plugin/hoster/UlozTo.py b/pyload/plugin/hoster/UlozTo.py new file mode 100644 index 000000000..83e2af953 --- /dev/null +++ b/pyload/plugin/hoster/UlozTo.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +def convertDecimalPrefix(m): + # decimal prefixes used in filesize and traffic + return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '') + + +class UlozTo(SimpleHoster): + __name = "UlozTo" + __type = "hoster" + __version = "1.09" + + __pattern = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Uloz.to hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' + NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' + SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' + OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' + + URL_REPLACEMENTS = [(r'(?<=http://)([^/]+)', "www.ulozto.net")] + SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] + + CHECK_TRAFFIC = True + DISPOSITION = False #: Remove in 0.4.10 + + ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">' + PASSWD_PATTERN = r'<div class="passwordProtectedFile">' + VIPLINK_PATTERN = r'<a href=".+?\?disclaimer=1" class="linkVip">' + TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"' + + + def setup(self): + self.chunkLimit = 16 if self.premium else 1 + self.multiDL = True + self.resumeDownload = True + + + def handle_free(self, pyfile): + action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') + if not action or not inputs: + self.error(_("Free download form not found")) + + self.logDebug("inputs.keys = " + str(inputs.keys())) + # get and decrypt captcha + if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): + # Old version - last seen 9.12.2013 + self.logDebug('Using "old" version') + + captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) + self.logDebug("CAPTCHA ID: " + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) + + inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) + + elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")): + # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 + self.logDebug('Using "new" version') + + xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) + self.logDebug("xapca = " + str(xapca)) + + data = json_loads(xapca) + captcha_value = self.decryptCaptcha(str(data['image'])) + self.logDebug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value) + + inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) + + else: + self.error(_("CAPTCHA form changed")) + + self.download("http://www.ulozto.net" + action, post=inputs) + + + def handle_premium(self, pyfile): + self.download(pyfile.url, get={'do': "directDownload"}) + + + def checkErrors(self): + if re.search(self.ADULT_PATTERN, self.html): + self.logInfo(_("Adult content confirmation needed")) + + m = re.search(self.TOKEN_PATTERN, self.html) + if m is None: + self.error(_("TOKEN_PATTERN not found")) + + self.html = self.load(pyfile.url, + get={'do': "askAgeForm-submit"}, + post={"agree": "Confirm", "_token_": m.group(1)}) + + if self.PASSWD_PATTERN in self.html: + password = self.getPassword() + + if password: + self.logInfo(_("Password protected link, trying ") + password) + self.html = self.load(pyfile.url, + get={'do': "passwordProtectedForm-submit"}, + post={"password": password, "password_send": 'Send'}) + + if self.PASSWD_PATTERN in self.html: + self.fail(_("Incorrect password")) + else: + self.fail(_("No password found")) + + if re.search(self.VIPLINK_PATTERN, self.html): + self.html = self.load(pyfile.url, get={'disclaimer': "1"}) + + return super(UlozTo, self).checkErrors() + + + def checkFile(self, rules={}): + check = self.checkDownload({ + "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), + "offline" : re.compile(self.OFFLINE_PATTERN), + "passwd" : self.PASSWD_PATTERN, + "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: paralell dl, server overload etc. + "not_found" : "<title>Ulož.to</title>" + }) + + if check == "wrong_captcha": + self.invalidCaptcha() + self.retry(reason=_("Wrong captcha code")) + + elif check == "offline": + self.offline() + + elif check == "passwd": + self.fail(_("Wrong password")) + + elif check == "server_error": + self.logError(_("Server error, try downloading later")) + self.multiDL = False + self.wait(1 * 60 * 60, True) + self.retry() + + elif check == "not_found": + self.fail(_("Server error, file not downloadable")) + + return super(UlozTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UloziskoSk.py b/pyload/plugin/hoster/UloziskoSk.py new file mode 100644 index 000000000..1fde11a78 --- /dev/null +++ b/pyload/plugin/hoster/UloziskoSk.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UloziskoSk(SimpleHoster): + __name = "UloziskoSk" + __type = "hoster" + __version = "0.25" + + __pattern = r'http://(?:www\.)?ulozisko\.sk/.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Ulozisko.sk hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>' + SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong><br />' + OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>' + + LINK_FREE_PATTERN = r'<form name = "formular" action = "(.+?)" method = "post">' + ID_PATTERN = r'<input type = "hidden" name = "id" value = "(.+?)" />' + CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=.+?)" alt="" />' + IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "(.+?)">' + + + def process(self, pyfile): + self.html = self.load(pyfile.url, decode=True) + self.getFileInfo() + + m = re.search(self.IMG_PATTERN, self.html) + if m: + self.link = "http://ulozisko.sk" + m.group(1) + else: + self.handle_free(pyfile) + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + parsed_url = 'http://www.ulozisko.sk' + m.group(1) + + m = re.search(self.ID_PATTERN, self.html) + if m is None: + self.error(_("ID_PATTERN not found")) + id = m.group(1) + + self.logDebug("URL:" + parsed_url + ' ID:' + id) + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("CAPTCHA_PATTERN not found")) + captcha_url = 'http://www.ulozisko.sk' + m.group(1) + + captcha = self.decryptCaptcha(captcha_url, cookies=True) + + self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) + + self.download(parsed_url, + post={"antispam": captcha, + "id" : id, + "name" : pyfile.name, + "but" : "++++STIAHNI+S%DABOR++++"}) diff --git a/pyload/plugin/hoster/UnibytesCom.py b/pyload/plugin/hoster/UnibytesCom.py new file mode 100644 index 000000000..52f376dcd --- /dev/null +++ b/pyload/plugin/hoster/UnibytesCom.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UnibytesCom(SimpleHoster): + __name = "UnibytesCom" + __type = "hoster" + __version = "0.12" + + __pattern = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """UniBytes.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + HOSTER_DOMAIN = "unibytes.com" + + INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' + + WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' + LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>' + + + def handle_free(self, pyfile): + domain = "http://www.%s/" % self.HOSTER_DOMAIN + action, post_data = self.parseHtmlForm('id="startForm"') + + + for _i in xrange(8): + self.logDebug(action, post_data) + self.html = self.load(urlparse.urljoin(domain, action), post=post_data, follow_location=False) + + m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) + if m: + self.link = m.group(1) + break + + if '>Somebody else is already downloading using your IP-address<' in self.html: + self.wait(10 * 60, True) + self.retry() + + if post_data['step'] == 'last': + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) + self.correctCaptcha() + break + else: + self.invalidCaptcha() + + last_step = post_data['step'] + action, post_data = self.parseHtmlForm('id="stepForm"') + + if last_step == 'timer': + m = re.search(self.WAIT_PATTERN, self.html) + self.wait(m.group(1) if m else 60, False) + + elif last_step in ("captcha", "last"): + post_data['captcha'] = self.decryptCaptcha(urlparse.urljoin(domain, "/captcha.jpg")) + + else: + self.fail(_("No valid captcha code entered")) diff --git a/pyload/plugin/hoster/UnrestrictLi.py b/pyload/plugin/hoster/UnrestrictLi.py new file mode 100644 index 000000000..3735de6df --- /dev/null +++ b/pyload/plugin/hoster/UnrestrictLi.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class UnrestrictLi(DeadHoster): + __name = "UnrestrictLi" + __type = "hoster" + __version = "0.23" + + __pattern = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' + + __description = """Unrestrict.li multi-hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it")] diff --git a/pyload/plugin/hoster/UpleaCom.py b/pyload/plugin/hoster/UpleaCom.py new file mode 100644 index 000000000..4e4db81a7 --- /dev/null +++ b/pyload/plugin/hoster/UpleaCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +import re +import urlparse + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class UpleaCom(XFSHoster): + __name = "UpleaCom" + __type = "hoster" + __version = "0.10" + + __pattern = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' + + __description = """Uplea.com hoster plugin""" + __license = "GPLv3" + __authors = [("Redleon", None), + ("GammaC0de", None)] + + + DISPOSITION = False #@TODO: Remove in 0.4.10 + + HOSTER_DOMAIN = "uplea.com" + + SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')] + + NAME_PATTERN = r'<span class="gold-text">(?P<N>.+?)</span>' + SIZE_PATTERN = r'<span class="label label-info agmd">(?P<S>[\d.,]+) (?P<U>[\w^_]+?)</span>' + OFFLINE_PATTERN = r'>You followed an invalid or expired link' + + LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' + + PREMIUM_ONLY_PATTERN = r'You need to have a Premium subscription to download this file' + WAIT_PATTERN = r'timeText: ?([\d.]+),' + STEP_PATTERN = r'<a href="(/step/.+)">' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + self.resumeDownload = True + + + def handle_free(self, pyfile): + m = re.search(self.STEP_PATTERN, self.html) + if m is None: + self.error(_("STEP_PATTERN not found")) + + self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1))) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logDebug(_("Waiting %s seconds") % m.group(1)) + self.wait(m.group(1), True) + self.retry() + + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.error(_("LINK_PATTERN not found")) + + self.link = m.group(1) + self.wait(15) diff --git a/pyload/plugin/hoster/UploadStationCom.py b/pyload/plugin/hoster/UploadStationCom.py new file mode 100644 index 000000000..ab55c71d4 --- /dev/null +++ b/pyload/plugin/hoster/UploadStationCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class UploadStationCom(DeadHoster): + __name = "UploadStationCom" + __type = "hoster" + __version = "0.52" + + __pattern = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' + __config = [] + + __description = """UploadStation.com hoster plugin""" + __license = "GPLv3" + __authors = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/UploadableCh.py b/pyload/plugin/hoster/UploadableCh.py new file mode 100644 index 000000000..b5b8ee8a9 --- /dev/null +++ b/pyload/plugin/hoster/UploadableCh.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UploadableCh(SimpleHoster): + __name = "UploadableCh" + __type = "hoster" + __version = "0.09" + + __pattern = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Uploadable.ch hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [(__pattern + ".*", r'http://www.uploadable.ch/file/\g<ID>')] + + INFO_PATTERN = r'div id=\"file_name\" title=.*>(?P<N>.+)<span class=\"filename_normal\">\((?P<S>[\d.]+) (?P<U>\w+)\)</span><' + + OFFLINE_PATTERN = r'>(File not available|This file is no longer available)' + TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' + + WAIT_PATTERN = r'>Please wait.+?<' + + RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" + + + def handle_free(self, pyfile): + # Click the "free user" button and wait + a = self.load(pyfile.url, post={'downloadLink': "wait"}, decode=True) + self.logDebug(a) + + self.wait(30) + + # Make the recaptcha appear and show it the pyload interface + b = self.load(pyfile.url, post={'checkDownload': "check"}, decode=True) + self.logDebug(b) #: Expected output: {"success":"showCaptcha"} + + recaptcha = ReCaptcha(self) + + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + # Submit the captcha solution + self.load("http://www.uploadable.ch/checkReCaptcha.php", + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, + 'recaptcha_shortencode_field': self.info['pattern']['ID']}, + decode=True) + + self.wait(3) + + # Get ready for downloading + self.load(pyfile.url, post={'downloadLink': "show"}, decode=True) + + self.wait(3) + + # Download the file + self.download(pyfile.url, post={'download': "normal"}, disposition=True) + + + def checkFile(self, rules={}): + if self.checkDownload({'wait': re.compile("Please wait for")}): + self.logInfo("Downloadlimit reached, please wait or reconnect") + self.wait(60 * 60, True) + self.retry() + + return super(UploadableCh, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UploadboxCom.py b/pyload/plugin/hoster/UploadboxCom.py new file mode 100644 index 000000000..eb769919e --- /dev/null +++ b/pyload/plugin/hoster/UploadboxCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class UploadboxCom(DeadHoster): + __name = "Uploadbox" + __type = "hoster" + __version = "0.05" + + __pattern = r'http://(?:www\.)?uploadbox\.com/files/.+' + __config = [] + + __description = """UploadBox.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py new file mode 100644 index 000000000..f5877c1a9 --- /dev/null +++ b/pyload/plugin/hoster/UploadedTo.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from pyload.network.RequestFactory import getURL +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UploadedTo(SimpleHoster): + __name = "UploadedTo" + __type = "hoster" + __version = "0.87" + + __pattern = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Uploaded.net hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + DISPOSITION = False + + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" + + URL_REPLACEMENTS = [(__pattern + ".*", r'http://uploaded.net/file/\g<ID>')] + + TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' + + LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' + + WAIT_PATTERN = r'Current waiting period: <span>(\d+)' + DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' + + + @classmethod + def apiInfo(cls, url="", get={}, post={}): + info = super(UploadedTo, cls).apiInfo(url) + + for _i in xrange(5): + html = getURL("http://uploaded.net/api/filemultiple", + get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern, url).group('ID')}, + decode=True) + + if html != "can't find request": + api = html.split(",", 4) + if api[0] == "online": + info.update({'name': api[4].strip(), 'size': api[2], 'status': 2}) + else: + info['status'] = 1 + break + else: + time.sleep(3) + + return info + + + def setup(self): + self.multiDL = self.resumeDownload = self.premium + self.chunkLimit = 1 #: critical problems with more chunks + + + def checkErrors(self): + if 'var free_enabled = false;' in self.html: + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) + + elif "limit-size" in self.html: + self.fail(_("File too big for free download")) + + elif "limit-slot" in self.html: #: Temporary restriction so just wait a bit + self.wait(30 * 60, True) + self.retry() + + elif "limit-parallel" in self.html: + self.fail(_("Cannot download in parallel")) + + elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: #: limit-dl + self.wait(3 * 60 * 60, True) + self.retry() + + elif '"err":"captcha"' in self.html: + self.invalidCaptcha() + + else: + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1)) + + + def handle_free(self, pyfile): + self.load("http://uploaded.net/language/en", just_header=True) + + self.html = self.load("http://uploaded.net/js/download.js", decode=True) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + if "type:'download'" in self.html: + self.correctCaptcha() + try: + self.link = re.search("url:'(.+?)'", self.html).group(1) + + except Exception: + pass + + self.checkErrors() + + + def checkFile(self, rules={}): + if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): + self.wait(3 * 60 * 60, True) + self.retry() + + return super(UploadedTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UploadhereCom.py b/pyload/plugin/hoster/UploadhereCom.py new file mode 100644 index 000000000..789f5e9f7 --- /dev/null +++ b/pyload/plugin/hoster/UploadhereCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class UploadhereCom(DeadHoster): + __name = "UploadhereCom" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?uploadhere\.com/\w{10}' + __config = [] + + __description = """Uploadhere.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/UploadheroCom.py b/pyload/plugin/hoster/UploadheroCom.py new file mode 100644 index 000000000..f112d9c56 --- /dev/null +++ b/pyload/plugin/hoster/UploadheroCom.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://uploadhero.co/dl/wQBRAVSM + +import re +import urlparse + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UploadheroCom(SimpleHoster): + __name = "UploadheroCom" + __type = "hoster" + __version = "0.18" + + __pattern = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """UploadHero.co plugin""" + __license = "GPLv3" + __authors = [("mcmyst", "mcmyst@hotmail.fr"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.+?)<' + SIZE_PATTERN = r'>Filesize: </span><strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<p class="titre_dl_2">' + + COOKIES = [("uploadhero.co", "lang", "en")] + + IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download\.php\?min=.+?)"' + IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' + + CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"' + + LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(.+?)"|"(http://storage\d+\.uploadhero\.co.+?)"' + LINK_PREMIUM_PATTERN = r'<a href="(.+?)" id="downloadnow"' + + + def handle_free(self, pyfile): + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error(_("Captcha not found")) + + captcha = self.decryptCaptcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) + + self.html = self.load(pyfile.url, + get={"code": captcha}) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) or m.group(2) + self.wait(50) + + + def checkErrors(self): + m = re.search(self.IP_BLOCKED_PATTERN, self.html) + if m: + self.html = self.load(urlparse.urljoin("http://uploadhero.co", m.group(1))) + + m = re.search(self.IP_WAIT_PATTERN, self.html) + wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60 + self.wait(wait_time, True) + self.retry() + + return super(UploadheroCom, self).checkErrors() diff --git a/pyload/plugin/hoster/UploadingCom.py b/pyload/plugin/hoster/UploadingCom.py new file mode 100644 index 000000000..6bf3988cb --- /dev/null +++ b/pyload/plugin/hoster/UploadingCom.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re + +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster, timestamp + + +class UploadingCom(SimpleHoster): + __name = "UploadingCom" + __type = "hoster" + __version = "0.40" + + __pattern = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' + + __description = """Uploading.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'id="file_title">(?P<N>.+)</' + SIZE_PATTERN = r'size tip_container">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<' + OFFLINE_PATTERN = r'(Page|file) not found' + + COOKIES = [("uploading.com", "lang", "1"), + (".uploading.com", "language", "1"), + (".uploading.com", "setlang", "en"), + (".uploading.com", "_lang", "en")] + + + def process(self, pyfile): + if not "/get/" in pyfile.url: + pyfile.url = pyfile.url.replace("/files", "/files/get") + + self.html = self.load(pyfile.url, decode=True) + self.getFileInfo() + + if self.premium: + self.handle_premium(pyfile) + else: + self.handle_free(pyfile) + + + def handle_premium(self, pyfile): + postData = {'action': 'get_link', + 'code' : self.info['pattern']['ID'], + 'pass' : 'undefined'} + + self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) + url = re.search(r'"link"\s*:\s*"(.*?)"', self.html) + if url: + self.link = url.group(1).replace("\\/", "/") + + raise Exception("Plugin defect") + + + def handle_free(self, pyfile): + m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) + if m: + pyfile.error = m.group(1) + self.logWarning(pyfile.error) + self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) + + ajax_url = "http://uploading.com/files/get/?ajax" + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.lastURL = pyfile.url + + res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) + + if 'answer' in res and 'wait_time' in res['answer']: + wait_time = int(res['answer']['wait_time']) + self.logInfo(_("Waiting %d seconds") % wait_time) + self.wait(wait_time) + else: + self.error(_("No AJAX/WAIT")) + + res = json_loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['pattern']['ID'], 'pass': 'false'})) + + if 'answer' in res and 'link' in res['answer']: + url = res['answer']['link'] + else: + self.error(_("No AJAX/URL")) + + self.html = self.load(url) + m = re.search(r'<form id="file_form" action="(.*?)"', self.html) + if m: + url = m.group(1) + else: + self.error(_("No URL")) + + self.link = url diff --git a/pyload/plugin/hoster/UploadkingCom.py b/pyload/plugin/hoster/UploadkingCom.py new file mode 100644 index 000000000..31d8874d8 --- /dev/null +++ b/pyload/plugin/hoster/UploadkingCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class UploadkingCom(DeadHoster): + __name = "UploadkingCom" + __type = "hoster" + __version = "0.14" + + __pattern = r'http://(?:www\.)?uploadking\.com/\w{10}' + __config = [] + + __description = """UploadKing.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/pyload/plugin/hoster/UpstoreNet.py b/pyload/plugin/hoster/UpstoreNet.py new file mode 100644 index 000000000..7d21d16ac --- /dev/null +++ b/pyload/plugin/hoster/UpstoreNet.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class UpstoreNet(SimpleHoster): + __name = "UpstoreNet" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://(?:www\.)?upstore\.net/' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Upstore.Net File Download Hoster""" + __license = "GPLv3" + __authors = [("igel", "igelkun@myopera.com")] + + + INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'<span class="error">File not found</span>' + + WAIT_PATTERN = r'var sec = (\d+)' + CHASH_PATTERN = r'<input type="hidden" name="hash" value="(.+?)">' + LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' + + + def handle_free(self, pyfile): + # STAGE 1: get link to continue + m = re.search(self.CHASH_PATTERN, self.html) + if m is None: + self.error(_("CHASH_PATTERN not found")) + chash = m.group(1) + self.logDebug("Read hash " + chash) + # continue to stage2 + post_data = {'hash': chash, 'free': 'Slow download'} + self.html = self.load(pyfile.url, post=post_data, decode=True) + + # STAGE 2: solv captcha and wait + # first get the infos we need: recaptcha key and wait time + recaptcha = ReCaptcha(self) + + # try the captcha 5 times + for _i in xrange(5): + m = re.search(self.WAIT_PATTERN, self.html) + if m is None: + self.error(_("Wait pattern not found")) + wait_time = int(m.group(1)) + + # then, do the waiting + self.wait(wait_time) + + # then, handle the captcha + response, challenge = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + self.html = self.load(pyfile.url, post=post_data, decode=True) + + # STAGE 3: get direct link + m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) + if m: + break + + if m is None: + self.error(_("Download link not found")) + + self.link = m.group(1) diff --git a/pyload/plugin/hoster/UptoboxCom.py b/pyload/plugin/hoster/UptoboxCom.py new file mode 100644 index 000000000..a2d1e8fcc --- /dev/null +++ b/pyload/plugin/hoster/UptoboxCom.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class UptoboxCom(XFSHoster): + __name = "UptoboxCom" + __type = "hoster" + __version = "0.18" + + __pattern = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' + + __description = """Uptobox.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' + OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' + TEMP_OFFLINE_PATTERN = r'>Service Unavailable' + + LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' + + ERROR_PATTERN = r'>(You have to wait.+till next download.)<' #@TODO: Check XFSHoster ERROR_PATTERN + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = True diff --git a/pyload/plugin/hoster/VeehdCom.py b/pyload/plugin/hoster/VeehdCom.py new file mode 100644 index 000000000..6e28164de --- /dev/null +++ b/pyload/plugin/hoster/VeehdCom.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster + + +class VeehdCom(Hoster): + __name = "VeehdCom" + __type = "hoster" + __version = "0.23" + + __pattern = r'http://veehd\.com/video/\d+_\S+' + __config = [("filename_spaces", "bool", "Allow spaces in filename", False), + ("replacement_char", "str", "Filename replacement character", "_")] + + __description = """Veehd.com hoster plugin""" + __license = "GPLv3" + __authors = [("cat", "cat@pyload")] + + + def setup(self): + self.multiDL = True + self.req.canContinue = True + + + def process(self, pyfile): + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + def download_html(self): + url = self.pyfile.url + self.logDebug("Requesting page: %s" % url) + self.html = self.load(url) + + + def file_exists(self): + if not self.html: + self.download_html() + + if '<title>Veehd</title>' in self.html: + return False + return True + + + def get_file_name(self): + if not self.html: + self.download_html() + + m = re.search(r'<title.*?>([^<]+) on Veehd</title>', self.html) + if m is None: + self.error(_("Video title not found")) + + name = m.group(1) + + # replace unwanted characters in filename + if self.getConfig('filename_spaces'): + pattern = '[^\w ]+' + else: + pattern = '[^\w.]+' + + return re.sub(pattern, self.getConfig('replacement_char'), name) + '.avi' + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/.+?)"', + self.html) + if m is None: + self.error(_("Embedded video url not found")) + + return m.group(1) diff --git a/pyload/plugin/hoster/VeohCom.py b/pyload/plugin/hoster/VeohCom.py new file mode 100644 index 000000000..4461b547a --- /dev/null +++ b/pyload/plugin/hoster/VeohCom.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class VeohCom(SimpleHoster): + __name = "VeohCom" + __type = "hoster" + __version = "0.22" + + __pattern = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' + __config = [("use_premium", "bool" , "Use premium account if available", True ), + ("quality" , "Low;High;Auto", "Quality" , "Auto")] + + __description = """Veoh.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<meta name="title" content="(?P<N>.*?)"' + OFFLINE_PATTERN = r'>Sorry, we couldn\'t find the video you were looking for' + + URL_REPLACEMENTS = [(__pattern + ".*", r'http://www.veoh.com/watch/\g<ID>')] + + COOKIES = [("veoh.com", "lassieLocale", "en")] + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 + + + def handle_free(self, pyfile): + quality = self.getConfig('quality') + if quality == "Auto": + quality = ("High", "Low") + + for q in quality: + pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q + m = re.search(pattern, self.html) + if m: + pyfile.name += ".mp4" + self.link = m.group(1).replace("\\", "") + return + else: + self.logInfo(_("No %s quality video found") % q.upper()) + else: + self.fail(_("No video found!")) diff --git a/pyload/plugin/hoster/VidPlayNet.py b/pyload/plugin/hoster/VidPlayNet.py new file mode 100644 index 000000000..5d98d2fb3 --- /dev/null +++ b/pyload/plugin/hoster/VidPlayNet.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://vidplay.net/38lkev0h3jv0 + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class VidPlayNet(XFSHoster): + __name = "VidPlayNet" + __type = "hoster" + __version = "0.04" + + __pattern = r'https?://(?:www\.)?vidplay\.net/\w{12}' + + __description = """VidPlay.net hoster plugin""" + __license = "GPLv3" + __authors = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] + + + NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' diff --git a/pyload/plugin/hoster/VimeoCom.py b/pyload/plugin/hoster/VimeoCom.py new file mode 100644 index 000000000..86abf362e --- /dev/null +++ b/pyload/plugin/hoster/VimeoCom.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class VimeoCom(SimpleHoster): + __name = "VimeoCom" + __type = "hoster" + __version = "0.04" + + __pattern = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' + __config = [("use_premium", "bool" , "Use premium account if available" , True ), + ("quality" , "Lowest;Mobile;SD;HD;Highest", "Quality" , "Highest"), + ("original" , "bool" , "Try to download the original file", True )] + + __description = """Vimeo.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + NAME_PATTERN = r'<title>(?P<N>.+) on Vimeo<' + OFFLINE_PATTERN = r'class="exception_header"' + TEMP_OFFLINE_PATTERN = r'Please try again in a few minutes.<' + + URL_REPLACEMENTS = [(__pattern + ".*", r'https://www.vimeo.com/\g<ID>')] + + COOKIES = [("vimeo.com", "language", "en")] + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = -1 + + + def handle_free(self, pyfile): + password = self.getPassword() + + if self.js and 'class="btn iconify_down_b"' in self.html: + html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password}, decode=True)) + pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) ' + else: + html = self.load("https://player.vimeo.com/video/" + self.info['pattern']['ID'], get={'password': password}) + pattern = r'"(?P<QL>\w+)":{"profile".*?"(?P<URL>http://pdl\.vimeocdn\.com.+?)"' + + link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) + + if self.getConfig('original'): + if "original" in link: + self.link = link[q] + return + else: + self.logInfo(_("Original file not downloadable")) + + quality = self.getConfig('quality') + if quality == "Highest": + qlevel = ("hd", "sd", "mobile") + elif quality == "Lowest": + qlevel = ("mobile", "sd", "hd") + else: + qlevel = quality.lower() + + for q in qlevel: + if q in link: + self.link = link[q] + return + else: + self.logInfo(_("No %s quality video found") % q.upper()) + else: + self.fail(_("No video found!")) diff --git a/pyload/plugin/hoster/Vipleech4UCom.py b/pyload/plugin/hoster/Vipleech4UCom.py new file mode 100644 index 000000000..cd68410f0 --- /dev/null +++ b/pyload/plugin/hoster/Vipleech4UCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class Vipleech4UCom(DeadHoster): + __name = "Vipleech4UCom" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?vipleech4u\.com/manager\.php' + __config = [] + + __description = """Vipleech4u.com hoster plugin""" + __license = "GPLv3" + __authors = [("Kagenoshin", "kagenoshin@gmx.ch")] diff --git a/pyload/plugin/hoster/WarserverCz.py b/pyload/plugin/hoster/WarserverCz.py new file mode 100644 index 000000000..2556a1393 --- /dev/null +++ b/pyload/plugin/hoster/WarserverCz.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class WarserverCz(DeadHoster): + __name = "WarserverCz" + __type = "hoster" + __version = "0.13" + + __pattern = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' + __config = [] + + __description = """Warserver.cz hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/pyload/plugin/hoster/WebshareCz.py b/pyload/plugin/hoster/WebshareCz.py new file mode 100644 index 000000000..5608cd272 --- /dev/null +++ b/pyload/plugin/hoster/WebshareCz.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class WebshareCz(SimpleHoster): + __name = "WebshareCz" + __type = "hoster" + __version = "0.16" + + __pattern = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """WebShare.cz hoster plugin""" + __license = "GPLv3" + __authors = [("stickell", "l.stickell@yahoo.it"), + ("rush", "radek.senfeld@gmail.com")] + + + @classmethod + def getInfo(cls, url="", html=""): + info = super(WebshareCz, cls).getInfo(url, html) + + if url: + info['pattern'] = re.match(cls.__pattern, url).groupdict() + + api_data = getURL("https://webshare.cz/api/file_info/", + post={'ident': info['pattern']['ID']}, + decode=True) + + if 'File not found' in api_data: + info['status'] = 1 + else: + info['status'] = 2 + info['name'] = re.search('<name>(.+)</name>', api_data).group(1) or info['name'] + info['size'] = re.search('<size>(.+)</size>', api_data).group(1) or info['size'] + + return info + + + def handle_free(self, pyfile): + wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" + + api_data = getURL('https://webshare.cz/api/file_link/', + post={'ident': self.info['pattern']['ID'], 'wst': wst}, + decode=True) + + self.logDebug("API data: " + api_data) + + m = re.search('<link>(.+)</link>', api_data) + if m is None: + self.error(_("Unable to detect direct link")) + + self.link = m.group(1) + + + def handle_premium(self, pyfile): + return self.handle_free(pyfile) diff --git a/pyload/plugin/hoster/WrzucTo.py b/pyload/plugin/hoster/WrzucTo.py new file mode 100644 index 000000000..00af10b23 --- /dev/null +++ b/pyload/plugin/hoster/WrzucTo.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +import pycurl +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class WrzucTo(SimpleHoster): + __name = "WrzucTo" + __type = "hoster" + __version = "0.03" + + __pattern = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Wrzuc.to hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>' + SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>' + + COOKIES = [("wrzuc.to", "language", "en")] + + + def setup(self): + self.multiDL = True + + + def handle_free(self, pyfile): + data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) + if len(data) != 2: + self.error(_("No file ID")) + + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.lastURL = pyfile.url + self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) + + self.req.http.lastURL = pyfile.url + self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) + + data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) + if len(data) != 4: + self.error(_("No download URL")) + + self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) diff --git a/pyload/plugin/hoster/WuploadCom.py b/pyload/plugin/hoster/WuploadCom.py new file mode 100644 index 000000000..2af68ced7 --- /dev/null +++ b/pyload/plugin/hoster/WuploadCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class WuploadCom(DeadHoster): + __name = "WuploadCom" + __type = "hoster" + __version = "0.23" + + __pattern = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' + __config = [] + + __description = """Wupload.com hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("Paul King", "")] diff --git a/pyload/plugin/hoster/X7To.py b/pyload/plugin/hoster/X7To.py new file mode 100644 index 000000000..865fc4b45 --- /dev/null +++ b/pyload/plugin/hoster/X7To.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class X7To(DeadHoster): + __name = "X7To" + __type = "hoster" + __version = "0.41" + + __pattern = r'http://(?:www\.)?x7\.to/' + __config = [] + + __description = """X7.to hoster plugin""" + __license = "GPLv3" + __authors = [("ernieb", "ernieb")] diff --git a/pyload/plugin/hoster/XFileSharingPro.py b/pyload/plugin/hoster/XFileSharingPro.py new file mode 100644 index 000000000..140a69a72 --- /dev/null +++ b/pyload/plugin/hoster/XFileSharingPro.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.XFSHoster import XFSHoster + + +class XFileSharingPro(XFSHoster): + __name = "XFileSharingPro" + __type = "hoster" + __version = "0.45" + + __pattern = r'^unmatchable$' + + __description = """XFileSharingPro dummy hoster plugin for hook""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com")] + + + URL_REPLACEMENTS = [("/embed-", "/")] + + + def _log(self, type, args): + msg = " | ".join(str(a).strip() for a in args if a) + logger = getattr(self.log, type) + logger("%s: %s: %s" % (self.getClassName(), self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) + + + def init(self): + super(XFileSharingPro, self).init() + + self.__pattern = self.core.pluginManager.hosterPlugins[self.getClassName()]['pattern'] + + self.HOSTER_DOMAIN = re.match(self.__pattern, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') + + account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) + + if account and account.canUse(): + self.account = account + + elif self.account: + self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + + else: + return + + self.user, data = self.account.selectAccount() + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) + + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = self.premium + self.multiDL = True diff --git a/pyload/plugin/hoster/XHamsterCom.py b/pyload/plugin/hoster/XHamsterCom.py new file mode 100644 index 000000000..4be06833b --- /dev/null +++ b/pyload/plugin/hoster/XHamsterCom.py @@ -0,0 +1,128 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.utils import json_loads +from pyload.plugin.Hoster import Hoster + + +def clean_json(json_expr): + json_expr = re.sub('[\n\r]', '', json_expr) + json_expr = re.sub(' +', '', json_expr) + json_expr = re.sub('\'', '"', json_expr) + + return json_expr + + +class XHamsterCom(Hoster): + __name = "XHamsterCom" + __type = "hoster" + __version = "0.12" + + __pattern = r'http://(?:www\.)?xhamster\.com/movies/.+' + __config = [("type", ".mp4;.flv", "Preferred type", ".mp4")] + + __description = """XHamster.com hoster plugin""" + __license = "GPLv3" + __authors = [] + + + def process(self, pyfile): + self.pyfile = pyfile + + if not self.file_exists(): + self.offline() + + if self.getConfig('type'): + self.desired_fmt = self.getConfig('type') + + pyfile.name = self.get_file_name() + self.desired_fmt + self.download(self.get_file_url()) + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + flashvar_pattern = re.compile('flashvars = ({.*?});', re.S) + json_flashvar = flashvar_pattern.search(self.html) + + if not json_flashvar: + self.error(_("flashvar not found")) + + j = clean_json(json_flashvar.group(1)) + flashvars = json_loads(j) + + if flashvars['srv']: + srv_url = flashvars['srv'] + '/' + else: + self.error(_("srv_url not found")) + + if flashvars['url_mode']: + url_mode = flashvars['url_mode'] + + + else: + self.error(_("url_mode not found")) + + if self.desired_fmt == ".mp4": + file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html) + if file_url is None: + self.error(_("file_url not found")) + file_url = file_url.group(1) + long_url = srv_url + file_url + self.logDebug("long_url = " + long_url) + else: + if flashvars['file']: + file_url = urllib.unquote(flashvars['file']) + else: + self.error(_("file_url not found")) + + if url_mode == '3': + long_url = file_url + self.logDebug("long_url = " + long_url) + else: + long_url = srv_url + "key=" + file_url + self.logDebug("long_url = " + long_url) + + return long_url + + + def get_file_name(self): + if not self.html: + self.download_html() + + pattern = r'<title>(.*?) - xHamster\.com</title>' + name = re.search(pattern, self.html) + if name is None: + pattern = r'<h1 >(.*)</h1>' + name = re.search(pattern, self.html) + if name is None: + pattern = r'http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?' + name = re.match(file_name_pattern, self.pyfile.url) + if name is None: + pattern = r'<div id="element_str_id" style="display:none;">(.*)</div>' + name = re.search(pattern, self.html) + if name is None: + return "Unknown" + + return name.group(1) + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + if re.search(r"(.*Video not found.*)", self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/XVideosCom.py b/pyload/plugin/hoster/XVideosCom.py new file mode 100644 index 000000000..be168fbb9 --- /dev/null +++ b/pyload/plugin/hoster/XVideosCom.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.plugin.Hoster import Hoster + + +class XVideosCom(Hoster): + __name = "XVideos.com" + __type = "hoster" + __version = "0.10" + + __pattern = r'http://(?:www\.)?xvideos\.com/video(\d+)' + + __description = """XVideos.com hoster plugin""" + __license = "GPLv3" + __authors = [] + + + def process(self, pyfile): + site = self.load(pyfile.url) + pyfile.name = "%s (%s).flv" % ( + re.search(r"<h2>([^<]+)<span", site).group(1), + re.match(self.__pattern, pyfile.url).group(1), + ) + self.download(urllib.unquote(re.search(r"flv_url=([^&]+)&", site).group(1))) diff --git a/pyload/plugin/hoster/XdadevelopersCom.py b/pyload/plugin/hoster/XdadevelopersCom.py new file mode 100644 index 000000000..040057cd5 --- /dev/null +++ b/pyload/plugin/hoster/XdadevelopersCom.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -* +# +# Test links: +# http://forum.xda-developers.com/devdb/project/dl/?id=10885 + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class XdadevelopersCom(SimpleHoster): + __name = "XdadevelopersCom" + __type = "hoster" + __version = "0.03" + + __pattern = r'https?://(?:www\.)?forum\.xda-developers\.com/devdb/project/dl/\?id=\d+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Xda-developers.com hoster plugin""" + __license = "GPLv3" + __authors = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<label>Filename:</label>\s*<div>\s*(?P<N>.*?)\n' + SIZE_PATTERN = r'<label>Size:</label>\s*<div>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'</i> Device Filter</h3>' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + self.download(pyfile.url, + get={'task': "get"}) diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py new file mode 100644 index 000000000..85f416aba --- /dev/null +++ b/pyload/plugin/hoster/Xdcc.py @@ -0,0 +1,207 @@ +# -*- coding: utf-8 -*- + +import re +import select +import socket +import struct +import sys +import time + +from pyload.plugin.Hoster import Hoster +from pyload.utils import fs_join + + +class Xdcc(Hoster): + __name = "Xdcc" + __type = "hoster" + __version = "0.32" + + __config = [("nick", "str", "Nickname", "pyload"), + ("ident", "str", "Ident", "pyloadident"), + ("realname", "str", "Realname", "pyloadreal")] + + __description = """Download from IRC XDCC bot""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.com")] + + + def setup(self): + self.debug = 0 #: 0,1,2 + self.timeout = 30 + self.multiDL = False + + + def process(self, pyfile): + # change request type + self.req = pyfile.m.core.requestFactory.getRequest(self.getClassName(), type="XDCC") + + self.pyfile = pyfile + for _i in xrange(0, 3): + try: + nmn = self.doDownload(pyfile.url) + self.logDebug("Download of %s finished." % nmn) + return + except socket.error, e: + if hasattr(e, "errno"): + errno = e.errno + else: + errno = e.args[0] + + if errno == 10054: + self.logDebug("Server blocked our ip, retry in 5 min") + self.setWait(300) + self.wait() + continue + + self.fail(_("Failed due to socket errors. Code: %d") % errno) + + self.fail(_("Server blocked our ip, retry again later manually")) + + + def doDownload(self, url): + self.pyfile.setStatus("waiting") #: real link + + m = re.match(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url) + server = m.group(1) + chan = m.group(2) + bot = m.group(3) + pack = m.group(4) + nick = self.getConfig('nick') + ident = self.getConfig('ident') + real = self.getConfig('realname') + + temp = server.split(':') + ln = len(temp) + if ln == 2: + host, port = temp + elif ln == 1: + host, port = temp[0], 6667 + else: + self.fail(_("Invalid hostname for IRC Server: %s") % server) + + ####################### + # CONNECT TO IRC AND IDLE FOR REAL LINK + dl_time = time.time() + + sock = socket.socket() + sock.connect((host, int(port))) + if nick == "pyload": + nick = "pyload-%d" % (time.time() % 1000) #: last 3 digits + sock.send("NICK %s\r\n" % nick) + sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) + + self.setWait(3) + self.wait() + + sock.send("JOIN #%s\r\n" % chan) + sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) + + # IRC recv loop + readbuffer = "" + done = False + retry = None + m = None + while True: + + # done is set if we got our real link + if done: + break + + if retry: + if time.time() > retry: + retry = None + dl_time = time.time() + sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) + + else: + if (dl_time + self.timeout) < time.time(): #@TODO: add in config + sock.send("QUIT :byebye\r\n") + sock.close() + self.fail(_("XDCC Bot did not answer")) + + fdset = select.select([sock], [], [], 0) + if sock not in fdset[0]: + continue + + readbuffer += sock.recv(1024) + temp = readbuffer.split("\n") + readbuffer = temp.pop() + + for line in temp: + if self.debug is 2: + print "*> " + unicode(line, errors='ignore') + line = line.rstrip() + first = line.split() + + if first[0] == "PING": + sock.send("PONG %s\r\n" % first[1]) + + if first[0] == "ERROR": + self.fail(_("IRC-Error: %s") % line) + + msg = line.split(None, 3) + if len(msg) != 4: + continue + + msg = { + "origin": msg[0][1:], + "action": msg[1], + "target": msg[2], + "text": msg[3][1:] + } + + if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: + if msg['text'] == "\x01VERSION\x01": + self.logDebug("Sending CTCP VERSION") + sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) + elif msg['text'] == "\x01TIME\x01": + self.logDebug("Sending CTCP TIME") + sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) + elif msg['text'] == "\x01LAG\x01": + pass #: don't know how to answer + + if not (bot == msg['origin'][0:len(bot)] + and nick == msg['target'][0:len(nick)] + and msg['action'] in ("PRIVMSG", "NOTICE")): + continue + + if self.debug is 1: + print "%s: %s" % (msg['origin'], msg['text']) + + if "You already requested that pack" in msg['text']: + retry = time.time() + 300 + + if "you must be on a known channel to request a pack" in msg['text']: + self.fail(_("Wrong channel")) + + m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text']) + if m: + done = True + + # get connection data + ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2))))) + port = int(m.group(3)) + packname = m.group(1) + + if len(m.groups()) > 3: + self.req.filesize = int(m.group(4)) + + self.pyfile.name = packname + + download_folder = self.config.get("general", "download_folder") + filename = fs_join(download_folder, packname) + + self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) + + self.pyfile.setStatus("downloading") + newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress) + if newname and newname != filename: + self.logInfo(_("%(name)s saved as %(newname)s") % {"name": self.pyfile.name, "newname": newname}) + filename = newname + + # kill IRC socket + # sock.send("QUIT :byebye\r\n") + sock.close() + + self.lastDownload = filename + return self.lastDownload diff --git a/pyload/plugin/hoster/YadiSk.py b/pyload/plugin/hoster/YadiSk.py new file mode 100644 index 000000000..96ca04cff --- /dev/null +++ b/pyload/plugin/hoster/YadiSk.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +import random +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster +from pyload.utils import json_loads + + +class YadiSk(SimpleHoster): + __name = "YadiSk" + __type = "hoster" + __version = "0.05" + + __pattern = r'https?://yadi\.sk/d/[\w-]+' + + __description = """Yadi.sk hoster plugin""" + __license = "GPLv3" + __authors = [("GammaC0de", None)] + + + OFFLINE_PATTERN = r'Nothing found' + + + @classmethod + def getInfo(cls, url="", html=""): + info = super(YadiSk, cls).getInfo(url, html) + + if html: + if 'idclient' not in info: + info['idclient'] = "" + for _i in xrange(32): + info ['idclient'] += random.choice('0123456abcdef') + + m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html) + if m: + api_data = json_loads(m.group(1)) + try: + for sect in api_data: + if 'model' in sect: + if sect['model'] == "config": + info['version'] = sect['data']['version'] + info['sk'] = sect['data']['sk'] + + elif sect['model'] == "resource": + info['id'] = sect['data']['id'] + info['size'] = sect['data']['meta']['size'] + info['name'] = sect['data']['name'] + + except Exception, e: + info['status'] = 8 + info['error'] = _("Unexpected server response: %s") % e.message + + else: + info['status'] = 8 + info['error'] = _("could not find required json data") + + return info + + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def handle_free(self, pyfile): + if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info): + self.error(_("Missing JSON data")) + + + try: + self.html = self.load("https://yadi.sk/models/", + get={'_m': "do-get-resource-url"}, + post={'idClient': self.info['idclient'], + 'version' : self.info['version'], + '_model.0': "do-get-resource-url", + 'sk' : self.info['sk'], + 'id.0' : self.info['id']}) + + self.link = json_loads(self.html)['models'][0]['data']['file'] + + except Exception: + pass diff --git a/pyload/plugin/hoster/YibaishiwuCom.py b/pyload/plugin/hoster/YibaishiwuCom.py new file mode 100644 index 000000000..a6256bf6b --- /dev/null +++ b/pyload/plugin/hoster/YibaishiwuCom.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class YibaishiwuCom(SimpleHoster): + __name = "YibaishiwuCom" + __type = "hoster" + __version = "0.14" + + __pattern = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """115.com hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz")] + + + NAME_PATTERN = r'file_name: \'(?P<N>.+?)\'' + SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\'' + OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>' + + LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + + + def handle_free(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("LINK_FREE_PATTERN not found")) + + url = m.group(1) + + self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) + + res = json_loads(self.load("http://115.com" + url, decode=False)) + if "urls" in res: + mirrors = res['urls'] + + elif "data" in res: + mirrors = res['data'] + + else: + mirrors = None + + for mr in mirrors: + try: + self.link = mr['url'].replace("\\", "") + self.logDebug("Trying URL: " + self.link) + break + except Exception: + continue + else: + self.fail(_("No working link found")) diff --git a/pyload/plugin/hoster/YoupornCom.py b/pyload/plugin/hoster/YoupornCom.py new file mode 100644 index 000000000..980211864 --- /dev/null +++ b/pyload/plugin/hoster/YoupornCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Hoster import Hoster + + +class YoupornCom(Hoster): + __name = "YoupornCom" + __type = "hoster" + __version = "0.20" + + __pattern = r'http://(?:www\.)?youporn\.com/watch/.+' + + __description = """Youporn.com hoster plugin""" + __license = "GPLv3" + __authors = [("willnix", "willnix@pyload.org")] + + + def process(self, pyfile): + self.pyfile = pyfile + + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + if not self.html: + self.download_html() + + return re.search(r'(http://download\.youporn\.com/download/\d+\?save=1)">', self.html).group(1) + + + def get_file_name(self): + if not self.html: + self.download_html() + + file_name_pattern = r'<title>(.+) - ' + return re.search(file_name_pattern, self.html).group(1).replace("&", "&").replace("/", "") + '.flv' + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + if re.search(r"(.*invalid video_id.*)", self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/YourfilesTo.py b/pyload/plugin/hoster/YourfilesTo.py new file mode 100644 index 000000000..62b66d668 --- /dev/null +++ b/pyload/plugin/hoster/YourfilesTo.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +from pyload.plugin.Hoster import Hoster + + +class YourfilesTo(Hoster): + __name = "YourfilesTo" + __type = "hoster" + __version = "0.22" + + __pattern = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' + + __description = """Youfiles.to hoster plugin""" + __license = "GPLv3" + __authors = [("jeix", "jeix@hasnomail.de"), + ("skydancer", "skydancer@hasnomail.de")] + + + def process(self, pyfile): + self.pyfile = pyfile + self.prepare() + self.download(self.get_file_url()) + + + def prepare(self): + if not self.file_exists(): + self.offline() + + self.pyfile.name = self.get_file_name() + + wait_time = self.get_waiting_time() + self.setWait(wait_time) + self.wait() + + + def get_waiting_time(self): + if not self.html: + self.download_html() + + # var zzipitime = 15; + m = re.search(r'var zzipitime = (\d+);', self.html) + if m: + sec = int(m.group(1)) + else: + sec = 0 + + return sec + + + def download_html(self): + url = self.pyfile.url + self.html = self.load(url) + + + def get_file_url(self): + """ returns the absolute downloadable filepath + """ + url = re.search(r"var bla = '(.*?)';", self.html) + if url: + url = url.group(1) + url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) + return url + else: + self.error(_("Absolute filepath not found")) + + + def get_file_name(self): + if not self.html: + self.download_html() + + return re.search("<title>(.*)</title>", self.html).group(1) + + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + + if re.search(r"HTTP Status 404", self.html): + return False + else: + return True diff --git a/pyload/plugin/hoster/YoutubeCom.py b/pyload/plugin/hoster/YoutubeCom.py new file mode 100644 index 000000000..4998efbec --- /dev/null +++ b/pyload/plugin/hoster/YoutubeCom.py @@ -0,0 +1,192 @@ +# -*- coding: utf-8 -*- + +import os +import re +import subprocess +import urllib + +from pyload.plugin.Hoster import Hoster +from pyload.plugin.internal.SimpleHoster import replace_patterns +from pyload.utils import html_unescape + + +def which(program): + """Works exactly like the unix command which + Courtesy of http://stackoverflow.com/a/377028/675646""" + + isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) + + fpath, fname = os.path.split(program) + + if fpath: + if isExe(program): + return program + else: + for path in os.environ['PATH'].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if isExe(exe_file): + return exe_file + + +class YoutubeCom(Hoster): + __name = "YoutubeCom" + __type = "hoster" + __version = "0.41" + + __pattern = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __config = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), + ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), + (".mp4" , "bool" , "Allow .mp4" , True ), + (".flv" , "bool" , "Allow .flv" , True ), + (".webm" , "bool" , "Allow .webm" , False), + (".3gp" , "bool" , "Allow .3gp" , False), + ("3d" , "bool" , "Prefer 3D" , False)] + + __description = """Youtube.com hoster plugin""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz")] + + + URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')] + + # Invalid characters that must be removed from the file name + invalidChars = u'\u2605:?><"|\\' + + # name, width, height, quality ranking, 3D + formats = {5 : (".flv" , 400 , 240 , 1 , False), + 6 : (".flv" , 640 , 400 , 4 , False), + 17 : (".3gp" , 176 , 144 , 0 , False), + 18 : (".mp4" , 480 , 360 , 2 , False), + 22 : (".mp4" , 1280, 720 , 8 , False), + 43 : (".webm", 640 , 360 , 3 , False), + 34 : (".flv" , 640 , 360 , 4 , False), + 35 : (".flv" , 854 , 480 , 6 , False), + 36 : (".3gp" , 400 , 240 , 1 , False), + 37 : (".mp4" , 1920, 1080, 9 , False), + 38 : (".mp4" , 4096, 3072, 10, False), + 44 : (".webm", 854 , 480 , 5 , False), + 45 : (".webm", 1280, 720 , 7 , False), + 46 : (".webm", 1920, 1080, 9 , False), + 82 : (".mp4" , 640 , 360 , 3 , True ), + 83 : (".mp4" , 400 , 240 , 1 , True ), + 84 : (".mp4" , 1280, 720 , 8 , True ), + 85 : (".mp4" , 1920, 1080, 9 , True ), + 100: (".webm", 640 , 360 , 3 , True ), + 101: (".webm", 640 , 360 , 4 , True ), + 102: (".webm", 1280, 720 , 8 , True )} + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + + + def process(self, pyfile): + pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) + html = self.load(pyfile.url, decode=True) + + if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html): + self.offline() + + if "We have been receiving a large volume of requests from your network." in html: + self.tempOffline() + + # get config + use3d = self.getConfig('3d') + + if use3d: + quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, + "480p": 82, "720p": 84, "1080p": 85, "3072p": 85} + else: + quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, + "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} + + desired_fmt = self.getConfig('fmt') + + if not desired_fmt: + desired_fmt = quality.get(self.getConfig('quality'), 18) + + elif desired_fmt not in self.formats: + self.logWarning(_("FMT %d unknown, using default") % desired_fmt) + desired_fmt = 0 + + # parse available streams + streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) + streams = [x.split('\u0026') for x in streams.split(',')] + streams = [dict((y.split('=', 1)) for y in x) for x in streams] + streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams] + + # self.logDebug("Found links: %s" % streams) + + self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) + + # build dictionary of supported itags (3D/2D) + allowed = lambda x: self.getConfig(self.formats[x][0]) + streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] + + if not streams: + self.fail(_("No available stream meets your preferences")) + + fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams) + + self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % + (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt], + "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT ")) + + # return fmt nearest to quality index + if desired_fmt in fmt_dict and allowed(desired_fmt): + fmt = desired_fmt + else: + sel = lambda x: self.formats[x][3] #: select quality index + comp = lambda x, y: abs(sel(x) - sel(y)) + + self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) + + fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and + sel(x) > sel(y) else y, fmt_dict.keys()) + + self.logDebug("Chosen fmt: %s" % fmt) + + url = fmt_dict[fmt] + + self.logDebug("URL: %s" % url) + + # set file name + file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv" + file_name_pattern = '<meta name="title" content="(.+?)">' + name = re.search(file_name_pattern, html).group(1).replace("/", "") + + # Cleaning invalid characters from the file name + name = name.encode('ascii', 'replace') + for c in self.invalidChars: + name = name.replace(c, '_') + + pyfile.name = html_unescape(name) + + time = re.search(r"t=((\d+)m)?(\d+)s", pyfile.url) + ffmpeg = which("ffmpeg") + if ffmpeg and time: + m, s = time.groups()[1:] + if m is None: + m = "0" + + pyfile.name += " (starting at %s:%s)" % (m, s) + + pyfile.name += file_suffix + filename = self.download(url) + + if ffmpeg and time: + inputfile = filename + "_" + os.rename(filename, inputfile) + + subprocess.call([ + ffmpeg, + "-ss", "00:%s:%s" % (m, s), + "-i", inputfile, + "-vcodec", "copy", + "-acodec", "copy", + filename]) + + os.remove(inputfile) diff --git a/pyload/plugin/hoster/ZDF.py b/pyload/plugin/hoster/ZDF.py new file mode 100644 index 000000000..8272cfd93 --- /dev/null +++ b/pyload/plugin/hoster/ZDF.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +import re +import xml + +from pyload.plugin.Hoster import Hoster + + +# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/) +class ZDF(Hoster): + __name = "ZDF Mediathek" + __type = "hoster" + __version = "0.80" + + __pattern = r'http://(?:www\.)?zdf\.de/ZDFmediathek/\D*(\d+)\D*' + + __description = """ZDF.de hoster plugin""" + __license = "GPLv3" + __authors = [] + + XML_API = "http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?id=%i" + + + @staticmethod + def video_key(video): + return ( + int(video.findtext("videoBitrate", "0")), + any(f.text == "progressive" for f in video.iter("facet")), + ) + + + @staticmethod + def video_valid(video): + return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4") and \ + video.findtext("facets/facet").startswith("progressive") + + + @staticmethod + def get_id(url): + return int(re.search(r"\D*(\d{4,})\D*", url).group(1)) + + + def process(self, pyfile): + xml = xml.etree.ElementTree.fromstring(self.load(self.XML_API % self.get_id(pyfile.url))) + + status = xml.findtext("./status/statuscode") + if status != "ok": + self.fail(_("Error retrieving manifest")) + + video = xml.find("video") + title = video.findtext("information/title") + + pyfile.name = title + + target_url = sorted((v for v in video.iter("formitaet") if self.video_valid(v)), + key=self.video_key)[-1].findtext("url") + + self.download(target_url) diff --git a/pyload/plugin/hoster/ZShareNet.py b/pyload/plugin/hoster/ZShareNet.py new file mode 100644 index 000000000..a2461fb6a --- /dev/null +++ b/pyload/plugin/hoster/ZShareNet.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.DeadHoster import DeadHoster + + +class ZShareNet(DeadHoster): + __name = "ZShareNet" + __type = "hoster" + __version = "0.21" + + __pattern = r'https?://(?:ww[2w]\.)?zshares?\.net/.+' + __config = [] + + __description = """ZShare.net hoster plugin""" + __license = "GPLv3" + __authors = [("espes", ""), + ("Cptn Sandwich", "")] diff --git a/pyload/plugin/hoster/ZeveraCom.py b/pyload/plugin/hoster/ZeveraCom.py new file mode 100644 index 000000000..29e4da223 --- /dev/null +++ b/pyload/plugin/hoster/ZeveraCom.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +from pyload.plugin.internal.MultiHoster import MultiHoster + + +class ZeveraCom(MultiHoster): + __name = "ZeveraCom" + __type = "hoster" + __version = "0.29" + + __pattern = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Zevera.com multi-hoster plugin""" + __license = "GPLv3" + __authors = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + def handle_premium(self, pyfile): + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) + + + def checkFile(self, rules={}): + if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): + self.fail(_("Error response received")) + + return super(ZeveraCom, self).checkFile(rules) diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py new file mode 100644 index 000000000..df9af062b --- /dev/null +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- + +import re +import urllib + +import BeautifulSoup + +from pyload.plugin.captcha.ReCaptcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class ZippyshareCom(SimpleHoster): + __name = "ZippyshareCom" + __type = "hoster" + __version = "0.78" + + __pattern = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' + __config = [("use_premium", "bool", "Use premium account if available", True)] + + __description = """Zippyshare.com hoster plugin""" + __license = "GPLv3" + __authors = [("Walter Purcaro", "vuolter@gmail.com"), + ("sebdelsol", "seb.morin@gmail.com")] + + + COOKIES = [("zippyshare.com", "ziplocale", "en")] + + NAME_PATTERN = r'(<title>Zippyshare.com - |"/)(?P<N>[^/]+)(</title>|";)' + SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' + + LINK_PREMIUM_PATTERN = r"document.location = '(.+?)'" + + + def setup(self): + self.chunkLimit = -1 + self.multiDL = True + self.resumeDownload = True + + + def handle_free(self, pyfile): + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + + if captcha_key: + try: + self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + recaptcha.challenge() + + except Exception, e: + self.error(e) + + else: + self.link = self.get_link() + + if self.link and pyfile.name == 'file.html': + pyfile.name = urllib.unquote(self.link.split('/')[-1]) + + + def get_link(self): + # get all the scripts inside the html body + soup = BeautifulSoup.BeautifulSoup(self.html) + scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript')) + + # meant to be populated with the initialization of all the DOM elements found in the scripts + initScripts = set() + + + def replElementById(element): + id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) + attr = element.group(4) #: attr might be None + + varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) + + realid = id.strip('"\'') + if id != realid: #: id is not a variable, so look for realid.attr in the html + initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) + initValue = '"%s"' % initValues[-1] if initValues else 'null' + initScripts.add('%s = %s;' % (varName, initValue)) + + return varName + + # handle all getElementById + reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?' + scripts = [re.sub(reVar, replElementById, script) for script in scripts if script] + + # add try/catch in JS to handle deliberate errors + scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts] + + # get the file's url by evaluating all the scripts + scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR['dlbutton_href']'] + return self.js.eval('\n'.join(scripts)) diff --git a/pyload/plugin/hoster/__init__.py b/pyload/plugin/hoster/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/pyload/plugin/hoster/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- |