diff options
Diffstat (limited to 'module/plugins/hoster')
206 files changed, 2164 insertions, 2216 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 1fcb4d784..2ed09f58c 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -13,27 +11,16 @@ from module.utils import parseFileSize class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.44" + __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 getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - - if name.endswith("..."): # incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - - return name - - def setup(self): self.chunkLimit = 16 @@ -58,24 +45,10 @@ class AlldebridCom(MultiHoster): pyfile.size = parseFileSize(data['filesize']) self.link = data['link'] - if self.getConfig("ssl"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error": - self.retry(wait_time=60, reason=_("An error occured while generating link")) - - return super(AlldebridCom, self).checkFile() - getInfo = create_getInfo(AlldebridCom) diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py new file mode 100644 index 000000000..08005de0f --- /dev/null +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://www.androidfilehost.com/?fid=95916177934518197 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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) + + +getInfo = create_getInfo(AndroidfilehostCom) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 6d3132e65..2228516aa 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote -from urlparse import urljoin, urlparse +import urllib +import urlparse from module.network.HTTPRequest import BadHeader -from module.plugins.internal.SimpleHoster import create_getInfo +from module.plugins.internal.SimpleHoster import create_getInfo, getFileURL from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.43" __pattern__ = r'^unmatchable$' @@ -25,17 +24,19 @@ class BasePlugin(Hoster): @classmethod def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - url = unquote(url) - return {'name' : (urlparse(url).path.split('/')[-1] - or urlparse(url).query.split('=', 1)[::-1][0].split('&', 1)[0] - or _("Unknown")), + url = urllib.unquote(url) + url_p = urlparse.urlparse(url) + return {'name' : (url_p.path.split('/')[-1] + or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] + or url_p.netloc.split('.', 1)[0]), 'size' : 0, 'status': 3 if url else 8, 'url' : url} def setup(self): - self.chunkLimit = -1 + self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True @@ -49,7 +50,12 @@ class BasePlugin(Hoster): for _i in xrange(5): try: - self.downloadFile(pyfile) + link = getFileURL(self, urllib.unquote(pyfile.url)) + + if link: + self.download(link, ref=False, disposition=True) + else: + self.fail(_("File not found")) except BadHeader, e: if e.code is 404: @@ -60,7 +66,7 @@ class BasePlugin(Hoster): account = self.core.accountManager.getAccountPlugin('Http') servers = [x['login'] for x in account.getAllAccounts()] - server = urlparse(pyfile.url).netloc + server = urlparse.urlparse(pyfile.url).netloc if server in servers: self.logDebug("Logging on to %s" % server) @@ -78,40 +84,20 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - check = self.checkDownload({'empty file': re.compile(r'\A\Z'), - 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')}) - if check: - self.fail(check.capitalize()) - - - def downloadFile(self, pyfile): - url = pyfile.url - - for i in xrange(1, 7): #@TODO: retrieve the pycurl.MAXREDIRS value set by req - header = self.load(url, ref=True, cookies=True, just_header=True, decode=True) + errmsg = self.checkDownload({'Empty file' : re.compile(r'\A\s*\Z'), + 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), + 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'Request error': re.compile(r'([Aa]n error occured while processing your request)')}) + if not errmsg: + return - if 'location' not in header or not header['location']: - if 'code' in header and header['code'] not in (200, 201, 203, 206): - self.logDebug("Received HTTP status code: %d" % header['code']) - self.fail(_("File not found")) - else: - break - - location = header['location'] - - self.logDebug("Redirect #%d to: %s" % (i, location)) - - if urlparse(location).scheme: - url = location - else: - p = urlparse(url) - base = "%s://%s" % (p.scheme, p.netloc) - url = urljoin(base, location) - else: - self.fail(_("Too many redirects")) + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass - self.download(unquote(url), disposition=True) + self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) getInfo = create_getInfo(BasePlugin) diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py new file mode 100644 index 000000000..89e4d39f9 --- /dev/null +++ b/module/plugins/hoster/BasketbuildCom.py @@ -0,0 +1,62 @@ +# -*- 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 module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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")) + + +getInfo = create_getInfo(BasketbuildCom) diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 0929ece01..cccd4acc7 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -9,6 +9,7 @@ class BayfilesCom(DeadHoster): __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Bayfiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 8d56f1ff6..b47c2902d 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """BezvaData.cz hoster plugin""" __license__ = "GPLv3" @@ -75,7 +76,7 @@ class BezvadataCz(SimpleHoster): wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) - self.download(url) + self.link = url def checkErrors(self): @@ -83,12 +84,12 @@ class BezvadataCz(SimpleHoster): self.longWait(5 * 60, 24) #: parallel dl limit elif '<div class="infobox' in self.html: self.tempOffline() - - self.info.pop('error', None) + else: + return super(BezvadataCz, self).checkErrors() def loadcaptcha(self, data, *args, **kwargs): - return data.decode("base64") + return data.decode('base64') getInfo = create_getInfo(BezvadataCz) diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index b20ace0f1..d0fbd7a8b 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -1,24 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class BillionuploadsCom(XFSHoster): +class BillionuploadsCom(DeadHoster): __name__ = "BillionuploadsCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Billionuploads.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "billionuploads.com" - - NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' - SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - getInfo = create_getInfo(BillionuploadsCom) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index f7b4d2709..5c709e4f7 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -4,16 +4,17 @@ from __future__ import with_statement import re -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.54" __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" @@ -71,7 +72,7 @@ class BitshareCom(SimpleHoster): self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page - self.download(self.getDownloadUrl()) + self.link = self.getDownloadUrl() if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") @@ -80,7 +81,7 @@ class BitshareCom(SimpleHoster): def getDownloadUrl(self): # Return location if direct download is active if self.premium: - header = self.load(self.pyfile.url, cookies=True, just_header=True) + header = self.load(self.pyfile.url, just_header=True) if 'location' in header: return header['location'] @@ -114,7 +115,7 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py index 924545a29..db813ba2e 100644 --- a/module/plugins/hoster/BoltsharingCom.py +++ b/module/plugins/hoster/BoltsharingCom.py @@ -9,6 +9,7 @@ class BoltsharingCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?boltsharing\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Boltsharing.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index f2ddd64a0..c966dbe1a 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -3,15 +3,16 @@ import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.15" __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" @@ -23,11 +24,13 @@ class CatShareNet(SimpleHoster): TEXT_ENCODING = True INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' - OFFLINE_PATTERN = ur'Podany plik zostaÅ usuniÄty\s*</div>' + OFFLINE_PATTERN = r'<div class="alert alert-error"' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykryÅ ÅŒe Twój adres IP nie pochodzi z Polski.<' - SECONDS_PATTERN = 'var\scount\s=\s(\d+);' - LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' + 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): @@ -35,33 +38,17 @@ class CatShareNet(SimpleHoster): self.resumeDownload = True - def getFileInfo(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).getFileInfo() - - def handleFree(self, pyfile): - m = re.search(self.SECONDS_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) - self.wait(wait_time, True) - recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() + 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 is None: - self.invalidCaptcha() - self.retry(reason=_("Wrong captcha entered")) - - dl_link = m.group(1) - self.download(dl_link, disposition=True) + if m: + self.link = m.group(1) getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py index c5440391f..af40b8d5f 100644 --- a/module/plugins/hoster/CloudzerNet.py +++ b/module/plugins/hoster/CloudzerNet.py @@ -9,6 +9,7 @@ class CloudzerNet(DeadHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Cloudzer.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 58b1ac0dd..09453137d 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __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" @@ -24,12 +25,17 @@ class CloudzillaTo(SimpleHoster): 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): + pw = self.getPassword() + if pw: + self.html = self.load(self.pyfile.url, get={'key': pw}) + else: + self.fail(_("Missing password")) if re.search(self.PASSWORD_PATTERN, self.html): self.retry(reason="Wrong password") + else: + return super(CloudzillaTo, self).checkErrors() def handleFree(self, pyfile): @@ -47,7 +53,7 @@ class CloudzillaTo(SimpleHoster): self.fail(ticket['error']) if 'wait' in ticket: - self.wait(int(ticket['wait']), int(ticket['wait']) > 5) + 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'], diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index f444718bc..44dac958d 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -15,8 +15,6 @@ class CramitIn(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "cramit.in" - 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/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 31d0eec95..098ba5fab 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -1,33 +1,35 @@ # -*- coding: utf-8 -*- import re +import urlparse -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.20" __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>' + 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 = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") + 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="?([^" ]+)"?[^>]*>' + FORM_PATTERN = r'<form method="post" action="(.+?)">(.*?)</form>' + FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?.*?>' - NAME_REPLACEMENTS = [(r'<[^>]*>', '')] + NAME_REPLACEMENTS = [(r'<.*?>', '')] def handleFree(self, pyfile): @@ -37,8 +39,8 @@ class CrockoCom(SimpleHoster): 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) + url = urlparse.urljoin("http://crocko.com", m.group(1)) + self.wait(m.group(2)) self.html = self.load(url) else: break @@ -52,7 +54,7 @@ class CrockoCom(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py index b26909096..9d748bf85 100644 --- a/module/plugins/hoster/CyberlockerCh.py +++ b/module/plugins/hoster/CyberlockerCh.py @@ -9,6 +9,7 @@ class CyberlockerCh(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?cyberlocker\.ch/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Cyberlocker.ch hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index fb9e7f457..8f72f2148 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,16 +12,17 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.97" + __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>' + 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">' @@ -30,10 +31,10 @@ class CzshareCom(SimpleHoster): CHECK_TRAFFIC = True - FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' + 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="([^"]+)"[^>]*/>' + 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 -->' @@ -43,7 +44,7 @@ class CzshareCom(SimpleHoster): 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, cookies=True, decode=True) + self.html = self.load(self.pyfile.url, decode=True) m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: return False @@ -74,7 +75,6 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) - self.checkDownloadedFile() def handleFree(self, pyfile): @@ -88,7 +88,7 @@ class CzshareCom(SimpleHoster): self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html - self.html = self.load(parsed_url, cookies=True, decode=True) + self.html = self.load(parsed_url, decode=True) if re.search(self.MULTIDL_PATTERN, self.html): self.longWait(5 * 60, 12) @@ -105,7 +105,7 @@ class CzshareCom(SimpleHoster): captcha_url = 'http://sdilej.cz/captcha.php' for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) - self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) + 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() @@ -129,14 +129,12 @@ class CzshareCom(SimpleHoster): if m is None: self.error(_("Download URL not found")) - url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) + self.link = "http://%s/download.php?%s" % (m.group(1), m.group(2)) self.wait() - self.download(url) - self.checkDownloadedFile() - def checkDownloadedFile(self): + def checkFile(self, rules={}): # check download check = self.checkDownload({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), @@ -158,5 +156,7 @@ class CzshareCom(SimpleHoster): self.invalidCaptcha() self.retry() + return super(CzshareCom, self).checkFile(rules) + getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index dc42d1f60..c6939e5e5 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -16,8 +16,8 @@ def getInfo(urls): for url in urls: id = regex.match(url).group('ID') - page = getURL(apiurl % id, get=request) - info = json_loads(page) + html = getURL(apiurl % id, get=request) + info = json_loads(html) name = info['title'] + ".mp4" if "title" in info else url @@ -72,7 +72,7 @@ class DailymotionCom(Hoster): def getQuality(self): - q = self.getConfig("quality") + q = self.getConfig('quality') if q == "Lowest": quality = 0 @@ -86,7 +86,7 @@ class DailymotionCom(Hoster): def getLink(self, streams, quality): if quality > 0: - for x, s in reversed([item for item in enumerate(streams)]): + for x, s in [item for item in enumerate(streams)][::-1]: qf = s[0][1] if qf <= quality: idx = x diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index f4b0692a8..955c94437 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -14,6 +14,7 @@ class DataHu(SimpleHoster): __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" @@ -23,7 +24,7 @@ class DataHu(SimpleHoster): 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="([^"]+)">' + LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="(.+?)">' def setup(self): diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 266199616..ad514f5eb 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -9,6 +9,7 @@ class DataportCz(SimpleHoster): __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" @@ -37,7 +38,7 @@ class DataportCz(SimpleHoster): else: self.error(_("captcha")) - self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) + 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'}) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 99b86e000..92a96b9ec 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -2,16 +2,17 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.09" __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" @@ -23,7 +24,7 @@ class DateiTo(SimpleHoster): 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<' + DOWNLOAD_PATTERN = r'>Du lÀdst bereits eine Datei herunter' DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' @@ -52,23 +53,11 @@ class DateiTo(SimpleHoster): data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() else: self.fail(_("Too bad...")) - self.download(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) + self.link = self.html def doWait(self): diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index a45ef27e9..976d9ccf9 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -9,6 +9,7 @@ class DdlstorageCom(DeadHoster): __version__ = "1.02" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """DDLStorage.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 8cda56c0c..4f64215fa 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -11,6 +11,7 @@ class DebridItaliaCom(MultiHoster): __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" diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 9d060e75d..18f23f552 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- import re +import urllib -from urllib import unquote - -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.56" __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" @@ -27,37 +27,23 @@ class DepositfilesCom(SimpleHoster): 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>")] + (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 handleFree(self, pyfile): - if re.search(r'File is checked, please try again in a minute.', self.html) is not None: - self.logInfo(_("The file is being checked. Waiting 1 minute")) - self.retry(wait_time=60) - - wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html) - if wait: - wait_time = int(wait.group(1)) - self.logInfo(_("Traffic used up. Waiting %d seconds") % wait_time) - self.wait(wait_time, True) - self.retry() + self.html = self.load(pyfile.url, post={'gateway_result': "1"}) - wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) - if wait: - wait_time = int(wait.group(1)) - self.logInfo(_("All free slots occupied. Waiting %d minutes") % wait_time) - self.setWait(wait_time * 60, False) - - wait = re.search(r'Please wait (\d+) sec', self.html) - if wait: - self.setWait(int(wait.group(1))) + self.checkErrors() m = re.search(r"var fid = '(\w+)';", self.html) if m is None: @@ -65,57 +51,42 @@ class DepositfilesCom(SimpleHoster): params = {'fid': m.group(1)} self.logDebug("FID: %s" % params['fid']) - self.wait() + self.checkErrors() + recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.error(_("ReCaptcha key not found")) + return - for _i in xrange(5): - self.html = self.load("https://dfiles.eu/get_file.php", get=params) + self.html = self.load("https://dfiles.eu/get_file.php", get=params) - if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: - if 'response' in params: - self.invalidCaptcha() - params['challenge'], params['response'] = recaptcha.challenge(captcha_key) - self.logDebug(params) - continue - - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - if 'response' in params: - self.correctCaptcha() - link = unquote(m.group(1)) - self.logDebug("LINK: %s" % link) - break - else: - self.error(_("Download link")) - else: - self.fail(_("No valid captcha response received")) + 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) - try: - self.download(link, disposition=True) - except: - self.retry(wait_time=60) + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = urllib.unquote(m.group(1)) def handlePremium(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) + link = re.search(self.LINK_PREMIUM_PATTERN, self.html) mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) + if link: - dlink = link.group(1) + self.link = link.group(1) + elif mirror: - dlink = mirror.group(1) - else: - self.error(_("No direct download link or mirror found")) - self.download(dlink, disposition=True) + self.link = mirror.group(1) getInfo = create_getInfo(DepositfilesCom) diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 2a8734655..e7a23f6b1 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Test links: -# http://d-h.st/mM8 +# http://d-h.st/mM8 import re @@ -11,24 +11,26 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.04" + __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'>Filename:</span> <div title="(?P<N>.+?)"' - SIZE_PATTERN = r'>Size:</span> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + 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'id="downloadfile" href="(.+?)"' + OFFLINE_PATTERN = r'>File Not Found' + LINK_FREE_PATTERN = r'var product_download_url= \'(.+?)\'' def setup(self): - self.multiDL = True + self.multiDL = True self.chunkLimit = 1 diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index ec40b64ce..ff5ee7b92 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -5,7 +5,6 @@ import re from module.network.Browser import Browser from module.network.CookieJar import CookieJar -from module.plugins.internal.CaptchaService import AdYouLike from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns @@ -36,19 +35,20 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.30" __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")] + ("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' + 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é' @@ -81,31 +81,31 @@ class DlFreeFr(SimpleHoster): self.handleFree(pyfile) else: # Direct access to requested file for users using free.fr as Internet Service Provider. - self.download(valid_url, disposition=True) + self.link = valid_url + + self.download(self.link, disposition=True) + elif headers.get('code') == 404: self.offline() + else: self.fail(_("Invalid return code: ") + str(headers.get('code'))) def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('action="getfile.pl"') - - adyoulike = AdYouLike(self) - inputs.update(adyoulike.challenge()) - 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")) + 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")) - location = headers.get("location") + + self.link = headers.get("location") self.req.setCookieJar(cj) - self.download(location, disposition=True) else: self.fail(_("Invalid response")) diff --git a/module/plugins/hoster/DodanePl.py b/module/plugins/hoster/DodanePl.py index 65d8452fa..46f748cc4 100644 --- a/module/plugins/hoster/DodanePl.py +++ b/module/plugins/hoster/DodanePl.py @@ -9,6 +9,7 @@ class DodanePl(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?dodane\.pl/file/\d+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Dodane.pl hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index a8ef5b4bc..eec968f5a 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -11,6 +11,7 @@ class DropboxCom(SimpleHoster): __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dropbox.com hoster plugin""" __license__ = "GPLv3" @@ -26,8 +27,8 @@ class DropboxCom(SimpleHoster): def setup(self): - self.multiDL = True - self.chunkLimit = 1 + self.multiDL = True + self.chunkLimit = 1 self.resumeDownload = True diff --git a/module/plugins/hoster/DuploadOrg.py b/module/plugins/hoster/DuploadOrg.py index 73702eb67..076171544 100644 --- a/module/plugins/hoster/DuploadOrg.py +++ b/module/plugins/hoster/DuploadOrg.py @@ -9,6 +9,7 @@ class DuploadOrg(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?dupload\.org/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Dupload.grg hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index cd54bdc70..693910c1b 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -16,8 +16,6 @@ class EasybytezCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "easybytez.com" - 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/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index f8ccc972e..b8485001e 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -11,13 +11,14 @@ class EdiskCz(SimpleHoster): __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>' + 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)' @@ -50,7 +51,7 @@ class EdiskCz(SimpleHoster): if not re.match(self.LINK_FREE_PATTERN, url): self.fail(_("Unexpected server response")) - self.download(url) + self.link = url getInfo = create_getInfo(EdiskCz) diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 9a2f50ed4..78108962f 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -9,6 +9,7 @@ class EgoFilesCom(DeadHoster): __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?egofiles\.com/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Egofiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py index bbd613f57..8ef994e1e 100644 --- a/module/plugins/hoster/EnteruploadCom.py +++ b/module/plugins/hoster/EnteruploadCom.py @@ -9,6 +9,7 @@ class EnteruploadCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?enterupload\.com/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """EnterUpload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/EpicShareNet.py b/module/plugins/hoster/EpicShareNet.py index 8ac8cdaf2..7e3c8ba0e 100644 --- a/module/plugins/hoster/EpicShareNet.py +++ b/module/plugins/hoster/EpicShareNet.py @@ -9,6 +9,7 @@ class EpicShareNet(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?epicshare\.net/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """EpicShare.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 08d8a2e3e..842e0cb87 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.27" + __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" @@ -33,7 +34,7 @@ class EuroshareEu(SimpleHoster): self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(pyfile.url.rstrip('/') + "/download/") + 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":"(.*?)"')}) @@ -47,22 +48,21 @@ class EuroshareEu(SimpleHoster): def handleFree(self, pyfile): - if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: + 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")) - parsed_url = "http://euroshare.eu%s" % m.group(1) - self.logDebug("URL", parsed_url) - self.download(parsed_url, disposition=True) + self.link = "http://euroshare.eu%s" % m.group(1) - def checkFile(): + + 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() + return super(EuroshareEu, self).checkFile(rules) getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py new file mode 100644 index 000000000..d70ca6d3a --- /dev/null +++ b/module/plugins/hoster/ExashareCom.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +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^_]+)' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium + + + def handleFree(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) + + +getInfo = create_getInfo(ExashareCom) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 5c2976a29..ead2e1e53 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -4,23 +4,24 @@ import re from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.64" + __version__ = "0.66" __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>[^"]+)">' + 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)<' @@ -50,7 +51,7 @@ class ExtabitCom(SimpleHoster): for _i in xrange(5): get_data = {"type": "recaptcha"} - get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) + 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() @@ -71,8 +72,7 @@ class ExtabitCom(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - url = m.group(1) - self.download(url) + self.link = m.group(1) getInfo = create_getInfo(ExtabitCom) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 9a38f5a72..cc50f4229 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -12,25 +10,16 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.09" + __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 getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - if name.endswith("..."): # incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - return name - - def setup(self): self.chunkLimit = 3 @@ -39,30 +28,17 @@ class FastixRu(MultiHoster): api_key = self.account.getAccountData(self.user) api_key = api_key['api'] - page = self.load("http://fastix.ru/api_v2/", + self.html = self.load("http://fastix.ru/api_v2/", get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) - data = json_loads(page) + + data = json_loads(self.html) self.logDebug("Json data", data) - if "error\":true" in page: + if "error\":true" in self.html: self.offline() else: self.link = data['downloadlink'] - if self.link != pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}): - self.retry(wait_time=60, reason=_("An error occurred while generating link")) - - return super(FastixRu, self).checkFile() - getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 6fe871ad4..330a6e3b9 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -10,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.27" + __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" @@ -22,11 +22,12 @@ class FastshareCz(SimpleHoster): COOKIES = [("fastshare.cz", "lang", "en")] - INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>[\w^_]+),' + 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'action=(/free/.*?)>\s*<img src="([^"]*)"><br' - LINK_PREMIUM_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+&)' + 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 " @@ -53,11 +54,11 @@ class FastshareCz(SimpleHoster): self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" - captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src)) - self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18}) + 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): + 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'), @@ -73,7 +74,7 @@ class FastshareCz(SimpleHoster): elif check == "credit": self.resetAccount() - return super(FastshareCz, self).checkFile() + return super(FastshareCz, self).checkFile(rules) getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileApeCom.py b/module/plugins/hoster/FileApeCom.py index db843586b..79157539b 100644 --- a/module/plugins/hoster/FileApeCom.py +++ b/module/plugins/hoster/FileApeCom.py @@ -9,6 +9,7 @@ class FileApeCom(DeadHoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """FileApe.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index d686be480..5be339896 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -10,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}' + __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" @@ -20,25 +20,25 @@ class FileSharkPl(SimpleHoster): ("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 = '(P|p)lik zosta. (usuni.ty|przeniesiony)' + 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 href="(.*?)" class="btn-upload-free">' - LINK_PREMIUM_PATTERN = r'<a href="(.*?)" class="btn-upload-premium">' + 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 = '<img src="data:image/jpeg;base64,(.*?)" title="captcha"' + 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 @@ -53,7 +53,7 @@ class FileSharkPl(SimpleHoster): errmsg = self.info['error'] = _("Another download already run") self.retry(15, int(m.group(1)), errmsg) - m = re.search(self.ERROR_PATTERN, self.html): + m = re.search(self.ERROR_PATTERN, self.html) if m: alert = m.group(1) @@ -72,19 +72,14 @@ class FileSharkPl(SimpleHoster): self.info.pop('error', None) - #@NOTE: handlePremium method was never been tested - def handlePremium(self, pyfile): - super(FilerNet, self).handlePremium(pyfile) - if self.link: - self.link = urljoin("http://fileshark.pl/", self.link) - - def handleFree(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) - link = urljoin("http://fileshark.pl", m.group(1)) + link = urlparse.urljoin("http://fileshark.pl", m.group(1)) + + self.html = self.load(link) m = re.search(self.WAIT_PATTERN, self.html) if m: @@ -112,29 +107,11 @@ class FileSharkPl(SimpleHoster): self.load = tmp_load - self.download(link, post=inputs, cookies=True, disposition=True) - - - def checkFile(self): - check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'), - 'wait_pattern' : re.compile(self.SECONDS_PATTERN), - 'DL-found' : re.compile('<a href="(.*)">')}) - - if check == "DL-found": - self.correctCaptcha() - - elif check == "wrong_captcha": - self.invalidCaptcha() - self.retry(10, 1, _("Wrong captcha solution")) - - elif check == "wait_pattern": - self.retry() - - return super(FileSharkPl, self).checkFile() + self.download(link, post=inputs, disposition=True) def _decode64(self, data, *args, **kwargs): - return data.decode("base64") + return data.decode('base64') getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index 7b93c03f1..3262b73ad 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.02" + __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" @@ -18,8 +19,9 @@ class FileStoreTo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - INFO_PATTERN = r'File: <span[^>]*>(?P<N>.+)</span><br />Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + 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): @@ -29,9 +31,8 @@ class FileStoreTo(SimpleHoster): def handleFree(self, pyfile): self.wait(10) - ldc = re.search(r'wert="(\w+)"', self.html).group(1) - link = self.load("http://filestore.to/ajax/download.php", get={"LDC": ldc}) - self.download(link) + self.link = self.load("http://filestore.to/ajax/download.php", + get={'D': re.search(r'"D=(\w+)', self.html).group(1)}) getInfo = create_getInfo(FileStoreTo) diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index 885010a2c..244131dc7 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -9,6 +9,7 @@ class FilebeerInfo(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Filebeer.info plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py new file mode 100644 index 000000000..9cdeebe3d --- /dev/null +++ b/module/plugins/hoster/FileboomMe.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- + +import re + +from urlparse import urljoin + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FileboomMe(SimpleHoster): + __name__ = "FileboomMe" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://f(?:ile)?boom\.me/file/(?P<ID>\w+)' + + __description__ = """Fileboom.me hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'<i class="icon-download"></i>\s*(?P<N>.+?)\s*<' + SIZE_PATTERN = r'File size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>This file is no longer available' + + WAIT_PATTERN = r'<div class="tik-tak">([\d:]+)' + LINK_PATTERN = r'/file/url\.html\?file=\w+' + + CAPTCHA_PATTERN = r'<img .* src="(/file/captcha.html\?v=\w+)"' + + + def setup(self): + self.resumeDownload = True + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + post_url = urljoin(pyfile.url, "/file/" + self.info['pattern']['ID']) + + m = re.search(r'data-slow-id="(\w+)"', self.html) + if m: + self.html = self.load(post_url, + post={'slow_id': m.group(1)}) + + m = re.search(self.LINK_PATTERN, self.html) + if m: + self.link = urljoin(pyfile.url, m.group(0)) + + else: + for _i in xrange(5): + m = re.search(r'<input type="hidden" name="uniqueId" value="(\w+)">', self.html) + if m: + uniqueId = m.group(1) + + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha = self.decryptCaptcha(urljoin(pyfile.url, m.group(1))) + + self.html = self.load(post_url, + post={'CaptchaForm[code]' : captcha, + 'free' : 1, + 'freeDownloadRequest': 1, + 'uniqueId' : uniqueId}) + + if 'The verification code is incorrect' in self.html: + self.invalidCaptcha() + + else: + self.checkErrors() + + self.html = self.load(post_url, + post={'free' : 1, + 'uniqueId': uniqueId}) + + m = re.search(self.LINK_PATTERN, self.html) + if m: + self.link = urljoin(pyfile.url, m.group(0)) + + else: + self.invalidCaptcha() + + break + + else: + self.fail(_("Captcha not found")) + + else: + m = re.search(r'>\s*Please wait ([\d:]+)', self.html) + if m: + wait_time = 0 + for v in re.findall(r'(\d+)', m.group(1), re.I): + wait_time = 60 * wait_time + int(v) + self.wait(wait_time) + self.retry() + break + + else: + self.fail(_("Invalid captcha")) + + +getInfo = create_getInfo(FileboomMe) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index bc328ddbd..346e9c444 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -3,16 +3,17 @@ import re from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.09" __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" @@ -59,7 +60,7 @@ class FilecloudIo(SimpleHoster): if captcha_key is None: self.error(_("ReCaptcha key not found")) - challenge, response = recaptcha.challenge(captcha_key) + response, challenge = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field" : response} self.account.relogin(self.user) @@ -78,7 +79,7 @@ class FilecloudIo(SimpleHoster): data['ctype'] = "recaptcha" for _i in xrange(5): - data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) + 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) @@ -103,8 +104,7 @@ class FilecloudIo(SimpleHoster): if "size" in self.info and self.info['size']: self.check_data = {"size": int(self.info['size'])} - download_url = m.group(1) - self.download(download_url) + self.link = m.group(1) else: self.fail(_("Unexpected server response")) @@ -118,7 +118,7 @@ class FilecloudIo(SimpleHoster): self.logDebug("FetchDownloadUrl: " + rep) rep = json_loads(rep) if rep['status'] == 'ok': - self.download(rep['download_url'], disposition=True) + self.link = rep['download_url'] else: self.fail(rep['message']) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 2c8ec58f4..ea1a38b7a 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -21,9 +20,10 @@ def getInfo(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.53" + __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" @@ -32,7 +32,7 @@ class FilefactoryCom(SimpleHoster): 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' + 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.+?)"' @@ -52,14 +52,14 @@ class FilefactoryCom(SimpleHoster): if m is None: self.error(_("Free download link not found")) - dl_link = m.group(1) + self.link = m.group(1) m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) - self.download(dl_link, disposition=True) + def checkFile(self, rules={}): check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) @@ -70,6 +70,8 @@ class FilefactoryCom(SimpleHoster): elif check == "error": self.error(_("Unknown error")) + return super(FilefactoryCom, self).checkFile(rules) + def handlePremium(self, pyfile): self.link = self.directLink(self.load(pyfile.url, just_header=True)) diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 8a8aee9e2..236603c6e 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -19,7 +19,7 @@ class FilejungleCom(FileserveCom): 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">(?:<[^>]*>| )*([^<]*)' + 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>' diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 2b6fd34db..306953b84 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -18,8 +18,6 @@ class FileomCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "fileom.com" - NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 4dd36c6e4..1f3de6717 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -1,27 +1,27 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.34" __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"/>' + 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' @@ -41,7 +41,7 @@ class FilepostCom(SimpleHoster): captcha_key = m.group(1) # Get wait time - get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} + 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')) @@ -57,7 +57,7 @@ class FilepostCom(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + file_pass) - get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass self.link = self.getJsonResponse(get_dict, post_dict, 'link') @@ -72,27 +72,18 @@ class FilepostCom(SimpleHoster): recaptcha = ReCaptcha(self) for i in xrange(5): - get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' + get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml' if i: - post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( + 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'])) - download_url = self.getJsonResponse(get_dict, post_dict, 'link') - if download_url: - if i: - self.correctCaptcha() - break - elif i: - self.invalidCaptcha() + self.link = self.getJsonResponse(get_dict, post_dict, 'link') else: self.fail(_("Invalid captcha")) - # Download - self.download(download_url) - def getJsonResponse(self, get_dict, post_dict, field): res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) @@ -112,9 +103,9 @@ class FilepostCom(SimpleHoster): 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']): + 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']: diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index a53773f81..874fde3c8 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -15,6 +15,7 @@ class FilepupNet(SimpleHoster): __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" diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 159aab964..3b876ed48 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -6,19 +6,19 @@ import pycurl import re +import urlparse -from urlparse import urljoin - -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.20" __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" @@ -29,17 +29,9 @@ class FilerNet(SimpleHoster): 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' - LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' - + WAIT_PATTERN = r'musst du <span id="time">(\d+)' - def checkErrors(self): - # Wait between downloads - m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html) - if m: - errmsg = self.info['error'] = _("Wait between free downloads") - self.retry(wait_time=int(m.group(1)), reason=errmsg) - - self.info.pop('error', None) + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'href="([^"]+)">Get download</a>' def handleFree(self, pyfile): @@ -53,30 +45,22 @@ class FilerNet(SimpleHoster): if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(self) - - for _i in xrange(5): - challenge, response = recaptcha.challenge() - - #@NOTE: Work-around for v0.4.9 just_header issue - #@TODO: Check for v0.4.10 - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) - self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response, - 'hash' : inputs['hash']}) - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) - - 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() - break - else: - self.invalidCaptcha() - - - def downloadLink(self, link): - if link and isinstance(link, basestring): - self.download(urljoin("http://filer.net/", link), disposition=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + #@NOTE: Work-around for v0.4.9 just_header issue + #@TODO: Check for v0.4.10 + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) + self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response, + 'hash' : inputs['hash']}) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + + 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() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index db81f5b16..c6ebbd444 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -15,8 +15,6 @@ class FilerioCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "filerio.in" - URL_REPLACEMENTS = [(r'filekeen\.com', "filerio.in")] OFFLINE_PATTERN = r'>"File Not Found|File has been removed' diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 18fca7176..7bd099282 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -21,7 +21,7 @@ def getInfo(urls): 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: + except Exception: pass # status 1=OFFLINE, 2=OK, 3=UNKNOWN diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 515ec9029..f8cf652b9 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -6,7 +6,7 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.Plugin import chunks -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import secondsToMidnight from module.utils import parseFileSize @@ -33,7 +33,7 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.55" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' @@ -48,7 +48,7 @@ class FileserveCom(Hoster): 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>(?:<[^>]*>| )*([^<]*)' + 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>' @@ -161,7 +161,7 @@ class FileserveCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) + response, challenge = recaptcha.challenge(captcha_key) res = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index 08e10dccb..aa1785f19 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -9,6 +9,7 @@ class FileshareInUa(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Fileshare.in.ua hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 8bfa0fa2e..5254a6f9b 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -9,6 +9,7 @@ class FilesonicCom(DeadHoster): __version__ = "0.35" __pattern__ = r'http://(?:www\.)?filesonic\.com/file/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Filesonic.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py index 4197a2858..9f442c846 100644 --- a/module/plugins/hoster/FilezyNet.py +++ b/module/plugins/hoster/FilezyNet.py @@ -9,6 +9,7 @@ class FilezyNet(DeadHoster): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?filezy\.net/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Filezy.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FiredriveCom.py b/module/plugins/hoster/FiredriveCom.py index 0e3a4e847..8faee5b52 100644 --- a/module/plugins/hoster/FiredriveCom.py +++ b/module/plugins/hoster/FiredriveCom.py @@ -9,6 +9,7 @@ class FiredriveCom(DeadHoster): __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Firedrive.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 49705958d..689eb3c66 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster @@ -14,6 +13,7 @@ class FlyFilesNet(SimpleHoster): __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" @@ -25,14 +25,14 @@ class FlyFilesNet(SimpleHoster): def process(self, pyfile): name = re.search(self.NAME_PATTERN, pyfile.url).group(1) - pyfile.name = unquote_plus(name) + 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}, cookies=True) + parsed_url = getURL(url, post={"getDownLink": session}) self.logDebug("Parsed URL: %s" % parsed_url) if parsed_url == '#downlink|' or parsed_url == "#downlink|#": @@ -40,6 +40,4 @@ class FlyFilesNet(SimpleHoster): self.wait(10 * 60, True) self.retry() - download_url = parsed_url.replace('#downlink|', '') - - self.download(download_url) + self.link = parsed_url.replace('#downlink|', '') diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 78aeece44..79eb1fb83 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -11,6 +11,7 @@ class FourSharedCom(SimpleHoster): __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" @@ -53,7 +54,7 @@ class FourSharedCom(SimpleHoster): 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: + except Exception: pass self.wait(20) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 9a11f933d..d005443d9 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -3,14 +3,14 @@ import re from module.plugins.Hoster import Hoster -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import secondsToMidnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -107,12 +107,14 @@ class FreakshareCom(Hoster): def get_file_name(self): if not self.html: self.download_html() + if not self.wantReconnect: - file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) - if file_name is not None: - file_name = file_name.group(1) + 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 @@ -122,12 +124,12 @@ class FreakshareCom(Hoster): size = 0 if not self.html: self.download_html() + if not self.wantReconnect: - file_size_check = re.search( - r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) - if file_size_check is not None: - units = float(file_size_check.group(1).replace(",", "")) - pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)] + 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 * 1024 ** pow) return size @@ -153,7 +155,7 @@ class FreakshareCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"This file does not exist!", self.html) is not None: + if re.search(r"This file does not exist!", self.html): return False else: return True diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index ffc8115d3..1cca24c3b 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,9 +6,10 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.15" + __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" @@ -24,13 +25,30 @@ class FreeWayMe(MultiHoster): def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.download("https://www.free-way.me/load.php", - get={'multiget': 7, - 'url' : pyfile.url, - 'user' : user, - 'pw' : self.account.getAccountData(user)['password'], - 'json' : ""}, - disposition=True) + 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 getInfo = create_getInfo(FreeWayMe) diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index e56d1a299..49f02a28b 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -9,6 +9,7 @@ class FreevideoCz(DeadHoster): __version__ = "0.30" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Freevideo.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 872511afc..50128db10 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime, gmtime -from urlparse import urljoin +import time +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -25,9 +24,10 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.19" + __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" @@ -58,7 +58,7 @@ class FshareVn(SimpleHoster): self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = urljoin(pyfile.url, action) + url = urlparse.urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -69,7 +69,7 @@ class FshareVn(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) if 'name="link_file_pwd_dl"' in self.html: self.fail(_("Incorrect password")) @@ -77,7 +77,7 @@ class FshareVn(SimpleHoster): self.fail(_("No password found")) else: - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) self.checkErrors() @@ -87,11 +87,9 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.url = m.group(1) - self.logDebug("FREE DL URL: %s" % self.url) + self.link = m.group(1) self.wait() - self.download(self.url) def checkErrors(self): @@ -101,8 +99,8 @@ class FshareVn(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: self.logInfo(_("Wait until %s ICT") % m.group(1)) - wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) - self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) + 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" diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 8562778c4..295955cbe 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -2,9 +2,8 @@ import pycurl import re - -from urllib import quote, unquote -from urlparse import urlparse +import urllib +import urlparse from module.plugins.Hoster import Hoster @@ -12,7 +11,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.52" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -29,13 +28,13 @@ class Ftp(Hoster): def process(self, pyfile): - parsed_url = urlparse(pyfile.url) + parsed_url = urlparse.urlparse(pyfile.url) netloc = parsed_url.netloc pyfile.name = parsed_url.path.rpartition('/')[2] try: - pyfile.name = unquote(str(pyfile.name)).decode('utf8') - except: + pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') + except Exception: pass if not "@" in netloc: @@ -67,11 +66,11 @@ class Ftp(Hoster): #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(pyfile.url).path.rpartition('/')[2]) + 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 + quote(x) for x in res.splitlines()] + links = [pyfile.url + urllib.quote(x) for x in res.splitlines()] self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 9d3ace3b2..c2feeb6f8 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -1,37 +1,39 @@ # -*- coding: utf-8 -*- +import pycurl +import random import re -from pycurl import FOLLOWLOCATION -from random import randint - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __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>' + 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">' + DOWNLOAD_PATTERN = r'"All threads for IP' + COOKIES = [("gigapeta.com", "lang", "us")] def handleFree(self, pyfile): - captcha_key = str(randint(1, 100000000)) + captcha_key = str(random.randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(5): self.checkErrors() @@ -44,24 +46,14 @@ class GigapetaCom(SimpleHoster): m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.download(download_url) - - - 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) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) getInfo = create_getInfo(GigapetaCom) diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 2cb012e50..4b27e6cc8 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -14,6 +14,7 @@ class GooIm(SimpleHoster): __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" @@ -31,7 +32,7 @@ class GooIm(SimpleHoster): def handleFree(self, pyfile): self.wait(10) - self.download(pyfile.url, cookies=True) + self.link = pyfile.url getInfo = create_getInfo(GooIm) diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py new file mode 100644 index 000000000..1c33a1e4e --- /dev/null +++ b/module/plugins/hoster/GoogledriveCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 + +import re +import urlparse + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape + + +class GoogledriveCom(SimpleHoster): + __name__ = "GoogledriveCom" + __type__ = "hoster" + __version__ = "0.12" + + __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc\?.*id=)' + __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'(?:<title>|class="uc-name-size".*>)(?P<N>.+?)(?: - Google Drive</title>|</a> \()' + OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' + + LINK_FREE_PATTERN = r'"([^"]+uc\?.*?)"' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + for _i in xrange(2): + m = re.search(self.LINK_FREE_PATTERN, self.html) + + if m is None: + self.error(_("Free download link not found")) + + else: + link = html_unescape(m.group(1).decode('unicode-escape')) + if not urlparse.urlparse(link).scheme: + link = urlparse.urljoin("https://docs.google.com/", link) + + direct_link = self.directLink(link, False) + if not direct_link: + self.html = self.load(link, decode=True) + else: + self.link = direct_link + break + + +getInfo = create_getInfo(GoogledriveCom) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 47b981dd7..ac0043b37 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.84" + __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" @@ -32,10 +33,4 @@ class HellshareCz(SimpleHoster): self.chunkLimit = 1 - def downloadLink(self, link): - if link and isinstance(link, basestring): - self.correctCaptcha() - self.download(urljoin("http://www.hellshare.com/", link), disposition=True) - - getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 2b9b76b8a..9b10760bd 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -9,6 +9,7 @@ class HellspyCz(DeadHoster): __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """HellSpy.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py new file mode 100644 index 000000000..ec91e50b9 --- /dev/null +++ b/module/plugins/hoster/HostujeNet.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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) + + +getInfo = create_getInfo(HostujeNet) diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index f7724faf2..082415c6b 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -9,6 +9,7 @@ class HotfileCom(DeadHoster): __version__ = "0.37" __pattern__ = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Hotfile.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index f7221f8c5..3fdcca1ba 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -17,9 +17,7 @@ class HugefilesNet(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "hugefiles.net" - - SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' + SIZE_PATTERN = r'File Size:</span>\s*<span.*?>(?P<S>[^<]+)</span></div>' FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 4fc96a2b1..2a35a008f 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class HundredEightyUploadCom(XFSHoster): __name__ = "HundredEightyUploadCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?180upload\.com/\w{12}' @@ -15,7 +15,7 @@ class HundredEightyUploadCom(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "180upload.com" + OFFLINE_PATTERN = r'>File Not Found' getInfo = create_getInfo(HundredEightyUploadCom) diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py index b4f225c4b..ff263d43a 100644 --- a/module/plugins/hoster/IFileWs.py +++ b/module/plugins/hoster/IFileWs.py @@ -9,6 +9,7 @@ class IFileWs(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?ifile\.ws/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Ifile.ws hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 921b64207..f81381c66 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -9,6 +9,7 @@ class IcyFilesCom(DeadHoster): __version__ = "0.06" __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """IcyFiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 056b05a65..ef267b505 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -9,6 +9,7 @@ class IfileIt(DeadHoster): __version__ = "0.29" __pattern__ = r'^unmatchable$' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Ifile.it""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 249c2feb1..0f09731e4 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -10,7 +10,8 @@ class IfolderRu(SimpleHoster): __type__ = "hoster" __version__ = "0.39" - __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+)' + __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" @@ -21,13 +22,13 @@ class IfolderRu(SimpleHoster): 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>' + OFFLINE_PATTERN = ur'<p>Ѐайл ÐœÐŸÐŒÐµÑ <b>.*?</b> (Ме МайЎеМ|ÑЎалеМ) !!!</p>' - SESSION_ID_PATTERN = r'<a href=(http://ints\.(?:rusfolder\.com|ifolder\.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' - INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "([^"]+)";\}' + 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 id="download_file_href" href="([^"]+)"' + LINK_FREE_PATTERN = r'<a href="(.+?)" class="downloadbutton_files"' WRONG_CAPTCHA_PATTERN = ur'<font color=Red>МевеÑÐœÑй кПЎ,<br>ввеЎОÑе еÑе Ñаз</font><br>' @@ -38,31 +39,20 @@ class IfolderRu(SimpleHoster): def handleFree(self, pyfile): - self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], cookies=True, decode=True) + 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() - url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1) - self.html = self.load(url, cookies=True, decode=True) - - url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() - self.html = self.load(url, cookies=True, decode=True) - - url = "http://ints.rusfolder.com/ints/frame/?session=%s" % session_id - self.html = self.load(url, cookies=True) - - self.wait(31, False) + 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): - self.html = self.load(url, cookies=True) - action, inputs = self.parseHtmlForm('ID="Form1"') - inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1) - inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1' + 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, cookies=True, post=inputs) + self.html = self.load(url, decode=True, post=inputs) if self.WRONG_CAPTCHA_PATTERN in self.html: self.invalidCaptcha() else: @@ -70,7 +60,8 @@ class IfolderRu(SimpleHoster): else: self.fail(_("Invalid captcha")) - self.link = re.search(self.LINK_PATTERN, self.html).group(1) + self.link = re.search(self.LINK_FREE_PATTERN, self.html).group(1) getInfo = create_getInfo(IfolderRu) + diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index 7adc1a029..a9bf14c6d 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -11,6 +11,7 @@ class JumbofilesCom(SimpleHoster): __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" diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 56d6588fa..415d5e2d0 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -15,8 +15,6 @@ class JunocloudMe(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "junocloud.me" - URL_REPLACEMENTS = [(r'//(www\.)?junocloud', "//dl3.junocloud")] OFFLINE_PATTERN = r'>No such file with this filename<' diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 16bda27e0..19a8f2ba6 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- import re +import urlparse -from urlparse import urljoin, urlparse - -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import _isDirectLink, SimpleHoster, create_getInfo +from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.23" __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" @@ -21,15 +21,16 @@ class Keep2ShareCc(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", "http://k2s.cc/file/\g<ID>")] + URL_REPLACEMENTS = [(__pattern__ + ".*", "http://keep2s.cc/file/\g<ID>")] - NAME_PATTERN = r'File: <span>(?P<N>.+)</span>' + 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 = LINK_PREMIUM_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_FREE_PATTERN = r'"(.+?url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' @@ -56,7 +57,7 @@ class Keep2ShareCc(SimpleHoster): # 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(':')))]) + 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") @@ -64,67 +65,54 @@ class Keep2ShareCc(SimpleHoster): self.info.pop('error', None) - def handleFree(self): - self.fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) - self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + def handleFree(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(30) - - self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - self.checkErrors() + self.wait(31) + self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_FREE_PATTERN not found")) + self.error(_("Free download link not found")) self.link = m.group(1) def handleCaptcha(self): - recaptcha = ReCaptcha(self) - - for _i in xrange(5): - post_data = {'free' : 1, - 'freeDownloadRequest': 1, - 'uniqueId' : self.fid, - 'yt0' : ''} - - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - captcha_url = urljoin("http://k2s.cc/", m.group(1)) - post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) - else: - challenge, response = recaptcha.challenge() - post_data.update({'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response}) - - self.html = self.load(self.pyfile.url, post=post_data) - - if 'recaptcha' not in self.html: - self.correctCaptcha() - break - else: - self.invalidCaptcha() - else: - self.fail(_("All captcha attempts failed")) + 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) - def downloadLink(self, link): - if not link or not isinstance(link, basestring): - return + 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}) - link = _isDirectLink(self, link, self.premium) + self.html = self.load(self.pyfile.url, post=post_data) - if link: - self.download(urljoin("http://k2s.cc/", link), disposition=True) + if 'verification code is incorrect' not in self.html: + self.correctCaptcha() + else: + self.invalidCaptcha() getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py index 1c39db46c..7690c85c8 100644 --- a/module/plugins/hoster/KickloadCom.py +++ b/module/plugins/hoster/KickloadCom.py @@ -9,6 +9,7 @@ class KickloadCom(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?kickload\.com/get/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Kickload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index a75ef5f3e..42547d658 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -2,16 +2,17 @@ import re -from module.plugins.internal.CaptchaService import SolveMedia +from module.plugins.internal.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.08" __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" @@ -43,10 +44,10 @@ class KingfilesNet(SimpleHoster): 'referer' : "", 'method_free': "+"} - self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() + response, challenge = solvemedia.challenge() # Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.html) @@ -66,13 +67,13 @@ class KingfilesNet(SimpleHoster): 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) + 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.download(m.group(1), cookies=True, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LemUploadsCom.py b/module/plugins/hoster/LemUploadsCom.py index 22fbd60dd..098867c8b 100644 --- a/module/plugins/hoster/LemUploadsCom.py +++ b/module/plugins/hoster/LemUploadsCom.py @@ -9,6 +9,7 @@ class LemUploadsCom(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?lemuploads\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """LemUploads.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 6d5641778..62afb6c7c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -7,12 +7,11 @@ # http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html import re - -from urlparse import urljoin +import urlparse from module.common.json_layer import json_loads, json_dumps from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight @@ -36,9 +35,10 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.31" __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" @@ -56,16 +56,6 @@ class LetitbitNet(SimpleHoster): self.resumeDownload = True - def getFileInfo(self): - api_rep = api_response(self.pyfile.url) - if api_rep['status'] == 'OK': - self.api_data = api_rep['data'][0] - self.pyfile.name = self.api_data['name'] - self.pyfile.size = self.api_data['size'] - else: - self.offline() - - def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: @@ -75,7 +65,7 @@ class LetitbitNet(SimpleHoster): self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs, cookies=True) + 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 @@ -89,14 +79,14 @@ class LetitbitNet(SimpleHoster): self.wait(seconds) - res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) + 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) - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, @@ -104,7 +94,7 @@ class LetitbitNet(SimpleHoster): self.logDebug("Post data to send", post_data) - res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) self.logDebug(res) @@ -128,16 +118,7 @@ class LetitbitNet(SimpleHoster): else: self.error(_("Unknown response - captcha check")) - self.correctCaptcha() - - for download_url in urls: - try: - self.download(download_url) - break - except Exception, e: - self.logError(e) - else: - self.fail(_("Download did not finish correctly")) + self.link = urls[0] def handlePremium(self, pyfile): @@ -152,4 +133,4 @@ class LetitbitNet(SimpleHoster): if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) - self.download(api_rep['data'][0][0], disposition=True) + self.link = api_rep['data'][0][0] diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index aa3466036..9c3af4ae3 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urlsplit +import urlparse from module.common.json_layer import json_loads, json_dumps from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -11,50 +10,48 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" - __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' + __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') + SINGLE_CHUNK_HOSTERS = ["easybytez.com"] def handlePremium(self, pyfile): - host = self._get_host(pyfile.url) - json_params = json_dumps({'link': pyfile.url, - 'type': host, + 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', + + 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']: - msg = _("Error converting the link") - self.logError(msg, j['error']) - self.fail(msg) + self.error(_("Error converting the link")) pyfile.name = j['filename'] - self.link = j['generated'] + self.link = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup() - if self.link != pyfile.url: - self.logDebug("New URL: " + self.link) - @staticmethod def _get_host(url): - host = urlsplit(url).netloc + host = urlparse.urlsplit(url).netloc return re.search(r'[\w-]+\.\w+$', host).group(0) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index b21a69b5f..11c96de60 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -6,16 +6,17 @@ import re -from module.plugins.internal.CaptchaService import SolveMedia +from module.plugins.internal.SolveMedia import SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.24" __pattern__ = r'http://(?:www\.)?load\.to/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """ Load.to hoster plugin """ __license__ = "GPLv3" @@ -23,7 +24,7 @@ class LoadTo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - NAME_PATTERN = r'<h1>(?P<N>.+)</h1>' + NAME_PATTERN = r'<h1>(?P<N>.+?)</h1>' SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' @@ -44,22 +45,23 @@ class LoadTo(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - download_url = m.group(1) + self.link = m.group(1) # Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) # Load.to is using solvemedia captchas since ~july 2014: - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() - if captcha_key is None: - self.download(download_url) - else: - challenge, response = solvemedia.challenge(captcha_key) - self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response}) + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.download(self.link, + post={'adcopy_challenge': challenge, + 'adcopy_response' : response, + 'returnUrl' : pyfile.url}) getInfo = create_getInfo(LoadTo) diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py new file mode 100644 index 000000000..61df5f0bb --- /dev/null +++ b/module/plugins/hoster/LolabitsEs.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -* + +import HTMLParser +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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)) + + +getInfo = create_getInfo(LolabitsEs) diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 475cdacaa..ef05cd1ea 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -9,6 +9,7 @@ class LomafileCom(DeadHoster): __version__ = "0.52" __pattern__ = r'http://lomafile\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Lomafile.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 09300a41a..f4932d93d 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -4,16 +4,17 @@ import re from bottle import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" __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" @@ -47,12 +48,12 @@ class LuckyShareNet(SimpleHoster): self.logDebug("JSON: " + rep) json = self.parseJson(rep) - self.wait(int(json['time'])) + self.wait(json['time']) recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + 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) @@ -68,7 +69,7 @@ class LuckyShareNet(SimpleHoster): if not json['link']: self.fail(_("No Download url retrieved/all captcha attempts failed")) - self.download(json['link']) + self.link = json['link'] getInfo = create_getInfo(LuckyShareNet) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 81bd36f73..09eb4705d 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -1,128 +1,78 @@ # -*- coding: utf-8 -*- -import re - -from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL - - -def replace_eval(js_expr): - return js_expr.replace(r'eval("', '').replace(r"\'", r"'").replace(r'\"', r'"') - - -def checkHTMLHeader(url): - try: - for _i in xrange(3): - header = getURL(url, just_header=True) - - for line in header.splitlines(): - line = line.lower() - - if 'location' in line: - url = line.split(':', 1)[1].strip() - if 'error.php?errno=320' in url: - return url, 1 - - if not url.startswith('http://'): - url = 'http://www.mediafire.com' + url - - break - - elif 'content-disposition' in line: - return url, 2 - else: - break - except: - return url, 3 - else: - return url, 0 - - -def getInfo(urls): - for url in urls: - location, status = checkHTMLHeader(url) - - if status: - file_info = (url, 0, status, url) - else: - file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True)) - - yield file_info +from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.89" - __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' + __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\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")] + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' - INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<H>[^\']*)\'\)' - OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' + 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.multiDL = False + self.resumeDownload = True + self.multiDL = True - def process(self, pyfile): - pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) + def handleCaptcha(self): + solvemedia = SolveMedia(self) + captcha_key = solvemedia.detect_key() - self.link, result = checkHTMLHeader(pyfile.url) - self.logDebug("Location (%d): %s" % (result, self.link)) + if captcha_key: + response, challenge = solvemedia.challenge(captcha_key) + self.html = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], + post={'adcopy_challenge': challenge, + 'adcopy_response' : response}, + decode=True) + return - if result == 0: - self.html = self.load(self.link, decode=True) - self.checkCaptcha() - self.multiDL = True - self.check_data = self.getFileInfo() + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() - if self.account: - self.handlePremium(pyfile) - else: - self.handleFree(pyfile) - elif result == 1: - self.offline() - else: - self.multiDL = True - self.download(self.link, disposition=True) + if captcha_key: + response, challenge = recaptcha.challenge(captcha_key) + self.html = self.load(self.pyfile.url, + post={'g-recaptcha-response': response}, + decode=True) def handleFree(self, pyfile): + self.handleCaptcha() + if self.PASSWORD_PATTERN in self.html: password = self.getPassword() - if password: - self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(self.link, post={"downloadp": password}) + 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")) - else: - self.fail(_("No password found")) - - m = re.search(r'kNO = r"(http://.*?)";', self.html) - if m is None: - self.error(_("No download URL")) - download_url = m.group(1) - self.download(download_url) + return super(MediafireCom, self).handleFree(pyfile) - def checkCaptcha(self): - solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - self.html = self.load(self.link, - post={'adcopy_challenge': challenge, - 'adcopy_response' : response}, - decode=True) +getInfo = create_getInfo(MediafireCom) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index fbd34c563..5280b42ec 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- +import array import os +# import pycurl import random import re -from array import array from base64 import standard_b64decode from Crypto.Cipher import AES from Crypto.Util import Counter -# from pycurl import SSL_CIPHER_LIST from module.common.json_layer import json_loads, json_dumps from module.plugins.Hoster import Hoster @@ -48,9 +48,9 @@ from module.utils import decode, fs_decode, fs_encode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.29" - __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' + __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" @@ -69,10 +69,10 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - a = array("I", self.b64_decode(key)) + a = array.array("I", self.b64_decode(key)) - k = array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) - iv = a[4:6] + array("I", (0, 0)) + 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 @@ -124,7 +124,7 @@ class MegaCoNz(Hoster): df = open(file_decrypted, "wb") except IOError, e: - self.fail(str(e)) + self.fail(e) chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum @@ -145,7 +145,7 @@ class MegaCoNz(Hoster): # block = chunk[i:i+16] # if len(block) % 16: # block += '=' * (16 - (len(block) % 16)) - # block = array("I", block) + # 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) @@ -160,7 +160,7 @@ class MegaCoNz(Hoster): # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: # os.remove(file_decrypted) - # self.fail("Checksum mismatch") + # self.fail(_("Checksum mismatch")) os.remove(file_crypted) self.lastDownload = fs_decode(file_decrypted) @@ -207,7 +207,7 @@ class MegaCoNz(Hoster): pyfile.name = attr['n'] + self.FILE_SUFFIX pyfile.size = mega['s'] - # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") self.download(mega['g']) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 8bbc733e0..9c8cc2a90 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote_plus +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -11,9 +10,10 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.46" + __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" @@ -23,25 +23,6 @@ class MegaDebridEu(MultiHoster): API_URL = "https://www.mega-debrid.eu/api.php" - def getFilename(self, url): - try: - return unquote_plus(url.rsplit("/", 1)[1]) - except IndexError: - return "" - - - def handlePremium(self, pyfile): - if not self.api_load(): - self.exitOnFail("Unable to connect to Mega-debrid.eu") - - self.link = self.debridLink(pyfile.url) - self.logDebug("New URL: " + self.link) - - filename = self.getFilename(self.link) - if filename != "": - pyfile.name = filename - - def api_load(self): """ Connexion to the mega-debrid API @@ -59,32 +40,21 @@ class MegaDebridEu(MultiHoster): return False - def debridLink(self, linkToDebrid): + def handlePremium(self, pyfile): """ Debrid a link Return The debrided link if succeed or original link if fail """ - jsonResponse = self.load(self.API_URL, get={'action': 'getLink', 'token': self.token}, - post={"link": linkToDebrid}) - res = json_loads(jsonResponse) - - if res['response_code'] == "ok": - debridedLink = res['debridLink'][1:-1] - return debridedLink - else: - self.exitOnFail("Unable to debrid %s" % linkToDebrid) + 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}) - def exitOnFail(self, msg): - """ - exit the plugin on fail case - And display the reason of this failure - """ - if self.getConfig("unloadFailing"): - self.logError(_(msg)) - self.resetAccount() - else: - self.fail(_(msg)) + res = json_loads(jsonResponse) + if res['response_code'] == "ok": + self.link = res['debridLink'][1:-1] getInfo = create_getInfo(MegaDebridEu) diff --git a/module/plugins/hoster/MegaFilesSe.py b/module/plugins/hoster/MegaFilesSe.py index c3de57914..249eff952 100644 --- a/module/plugins/hoster/MegaFilesSe.py +++ b/module/plugins/hoster/MegaFilesSe.py @@ -9,6 +9,7 @@ class MegaFilesSe(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?megafiles\.se/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """MegaFiles.se hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 048561ac5..e17dd4730 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -11,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): h = getRequest() - h.c.setopt(HTTPHEADER, + 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"]) @@ -26,6 +25,7 @@ class MegaRapidCz(SimpleHoster): __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" @@ -35,13 +35,13 @@ class MegaRapidCz(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)' + 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>' + 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áš' @@ -54,14 +54,14 @@ class MegaRapidCz(SimpleHoster): def handlePremium(self, pyfile): m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) + 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/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py new file mode 100644 index 000000000..a3b4c72ba --- /dev/null +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +import random + +from module.plugins.internal.MultiHoster import MultiHoster + + +def random_with_N_digits(n): + rand = "0." + not_zero = 0 + for i in range(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 handlePremium(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).handlePremium(pyfile) diff --git a/module/plugins/hoster/MegareleaseOrg.py b/module/plugins/hoster/MegareleaseOrg.py index 60796c1ee..6349144ec 100644 --- a/module/plugins/hoster/MegareleaseOrg.py +++ b/module/plugins/hoster/MegareleaseOrg.py @@ -9,6 +9,7 @@ class MegareleaseOrg(DeadHoster): __version__ = "0.02" __pattern__ = r'https?://(?:www\.)?megarelease\.org/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Megarelease.org hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index bdb428143..ed2363fe3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import time +import time from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,6 +12,7 @@ class MegasharesCom(SimpleHoster): __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" @@ -20,17 +20,17 @@ class MegasharesCom(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">' + 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="([^"]+)">' + 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_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 = "([^"]+)";' + REQUEST_URI_PATTERN = r'var request_uri = "(.+?)";' NO_SLOTS_PATTERN = r'<dd class="red">All download slots for this link are currently filled' @@ -66,7 +66,7 @@ class MegasharesCom(SimpleHoster): 'rsargs[]': random_num, 'rsargs[]': passport_num, 'rsargs[]': "replace_sec_pprenewal", - 'rsrnd[]' : str(int(time() * 1000))}) + 'rsrnd[]' : str(int(time.time() * 1000))}) if 'Thank you for reactivating your passport.' in res: self.correctCaptcha() @@ -105,9 +105,8 @@ class MegasharesCom(SimpleHoster): if m is None: self.error(msg) - download_url = m.group(1) - self.logDebug("%s: %s" % (msg, download_url)) - self.download(download_url) + self.link = m.group(1) + self.logDebug("%s: %s" % (msg, self.link)) getInfo = create_getInfo(MegasharesCom) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 7f51a8a46..590819f7f 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -9,6 +9,7 @@ class MegauploadCom(DeadHoster): __version__ = "0.31" __pattern__ = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Megaupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py index 24905ce62..accd079fc 100644 --- a/module/plugins/hoster/MegavideoCom.py +++ b/module/plugins/hoster/MegavideoCom.py @@ -9,6 +9,7 @@ class MegavideoCom(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Megavideo.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index 9bb63701c..2fe5184ae 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -15,9 +15,7 @@ class MovReelCom(XFSHoster): __authors__ = [("JorisV83", "jorisv83-pyload@yahoo.com")] - HOSTER_DOMAIN = "movreel.com" - - LINK_PATTERN = r'<a href="([^"]+)">Download Link' + LINK_PATTERN = r'<a href="(.+?)">Download Link' getInfo = create_getInfo(MovReelCom) diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py index c5a48310e..bcd7c6237 100644 --- a/module/plugins/hoster/MultihostersCom.py +++ b/module/plugins/hoster/MultihostersCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hosters.ZeveraCom import ZeveraCom +from module.plugins.hoster.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 7a6e73252..bbb77f525 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,6 +12,7 @@ class MultishareCz(SimpleHoster): __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" @@ -44,7 +44,7 @@ class MultishareCz(SimpleHoster): 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() * 10000 * random()), + 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}, diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index 5ea2639f1..662638843 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -12,6 +12,7 @@ class MyfastfileCom(MultiHoster): __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" @@ -23,19 +24,16 @@ class MyfastfileCom(MultiHoster): def handlePremium(self, pyfile): - self.logDebug("Original URL: %s" % pyfile.url) - - page = self.load('http://myfastfile.com/api.php', + 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: " + page) - page = json_loads(page) - if page['status'] != 'ok': + 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 = page['link'] - if self.link != pyfile.url: - self.logDebug("Unrestricted URL: " + self.link) + self.link = self.html['link'] getInfo = create_getInfo(MyfastfileCom) diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py new file mode 100644 index 000000000..531368134 --- /dev/null +++ b/module/plugins/hoster/MystoreTo.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# +# Test link: +# http://mystore.to/dl/mxcA50jKfP + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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}) + + +getInfo = create_getInfo(MystoreTo) diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py index 6b5699408..cf708be09 100644 --- a/module/plugins/hoster/NahrajCz.py +++ b/module/plugins/hoster/NahrajCz.py @@ -9,6 +9,7 @@ class NahrajCz(DeadHoster): __version__ = "0.21" __pattern__ = r'http://(?:www\.)?nahraj\.cz/content/download/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Nahraj.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 8b56c0908..c201ac250 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- +import random import re - -from random import random +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,6 +13,7 @@ class NarodRu(SimpleHoster): __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" @@ -33,7 +34,7 @@ class NarodRu(SimpleHoster): def handleFree(self, pyfile): for _i in xrange(5): - self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) + 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: @@ -47,7 +48,7 @@ class NarodRu(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - url = 'http://narod.ru' + m.group(1) + self.link = urlparse.urljoin("http://narod.ru", m.group(1)) self.correctCaptcha() break @@ -60,7 +61,5 @@ class NarodRu(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - self.download(url) - getInfo = create_getInfo(NarodRu) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 35c814656..82f5c22fb 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,295 +1,21 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from urlparse import urljoin -from time import time -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks -from module.plugins.internal.CaptchaService import ReCaptcha - - -def getInfo(urls): - ## returns list of tupels (name, size (in bytes), status (see FileDatabase), 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(1) + ";" - - 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): +class NetloadIn(DeadHoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.50" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' + __pattern__ = r'https?://(?:www\.)?netload\.(in|me)/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Netload.in hoster plugin""" __license__ = "GPLv3" __authors__ = [("spoob", "spoob@pyload.org"), ("RaNaN", "ranan@pyload.org"), - ("Gregy", "gregy@gregy.cz")] - - - 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(1) - 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(1), "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(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(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() + 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 = urljoin("http://netload.in/", url_captcha_html) - break - - self.html = self.load(url_captcha_html) - - recaptcha = ReCaptcha(self) - - for _i in xrange(5): - challenge, response = recaptcha.challenge() - - 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 is not None: - 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(self, page): - return int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 - - - def proceed(self, url): - self.download(url, disposition=True) + ("Gregy", "gregy@gregy.cz" )] - 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() +getInfo = create_getInfo(NetloadIn) diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 2367493e5..a0734d9b1 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -1,79 +1,62 @@ # -*- coding: utf-8 -*- -# -# Note: -# Right now premium support is not added -# Thus, any file that require premium support -# cannot be downloaded. Only the file that is free to -# download can be downloaded. import re -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.14" __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", ""), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("sahil" , "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("Stickell" , "l.stickell@yahoo.it" )] + INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File doesn\'t exist' - # URL_REPLACEMENTS = [("http://", "https://")] + LINK_PREMIUM_PATTERN = LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' - 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 (\d+ minutes)' + # ERROR_PATTERN = r'downloading is not possible' def handleFree(self, pyfile): - file_info = self.load("https://nitroflare.com/api/getDownloadLink", - get={'file': self.info['pattern']['ID']}) - - self.logWarning(file_info[3:]) - file_info = json_loads(file_info[3:]) # removing non ascii characters - if file_info['type'] == "success": - result = file_info['result'] # already a dict - if result['linkType'] == "free": - delay = result['delay'] # Don't need the delay for free downloads - captch_key = result['recaptchaPublic'] - filename = result['name'] - recaptcha = ReCaptcha(self) - # try upto 3 times to solve reCaptcha - for i in xrange(3): - challenge, response = recaptcha.challenge(key=captch_key) - res = self.load("https://nitroflare.com/ajax/freeDownload.php", - post={"method": "fetchDownload", - "recaptcha_challenge_field": challenge, - "recaptcha_response_field": response}) - if self.handleCaptchaErrors(res): - break - if "The captcha wasn't entered correctly" or "You have to fill the captcha" in res: - continue - else: - break - - if "The captcha wasn't entered correctly" or "You have to fill the captcha" in res: - self.logError("Captcha Failed") - self.offline() - # Captcha failed - else: - self.logInfo("result of the captcha is") - self.logInfo(res) - # self.offline() - download_link = re.search(self.DOWNLOAD_PATTERN, res) - if download_link is None: - print "downloasd link failed" - # Download link failed - else: - self.download(download_link) - else: - print "link is invalid" - self.offline() - # Link is invalid - # self.download() + # 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}) + + return super(NitroflareCom, self).handleFree(pyfile) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 361d48c2d..c3313c525 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -10,6 +10,7 @@ class NoPremiumPl(MultiHoster): __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" @@ -83,14 +84,14 @@ class NoPremiumPl(MultiHoster): # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Unknown error (code: %s)" % parsed["errno"] + 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 webiste \ - directly. Update this plugin." % parsed["hosting"]) + _("Download from %s is possible only using NoPremium.pl website \ + directly") % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 8a03d7090..241ee3a29 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -17,8 +17,6 @@ class NosuploadCom(XFSHoster): __authors__ = [("igel", "igelkun@myopera.com")] - HOSTER_DOMAIN = "nosupload.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>' @@ -28,14 +26,14 @@ class NosuploadCom(XFSHoster): def getDownloadLink(self): # stage1: press the "Free Download" button data = self.getPostParameters() - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + 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, ref=True, decode=True) + 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/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index 9754ceed1..b00f71635 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -20,10 +20,8 @@ class NovafileCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "novafile.com" - - ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' - WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' + 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/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index b69242a86..a1cf9baf7 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -9,9 +9,10 @@ from module.utils import fixup class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.09" - __pattern__ = r'http://(?:www\.)?(nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)|likeupload\.org/)\w+' + __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" @@ -27,7 +28,7 @@ class NowDownloadSx(SimpleHoster): WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' - NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] + NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')] def setup(self): @@ -54,11 +55,11 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.LINK_FREE_PATTERN, self.html) - if url is None: + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: self.error(_("Download link not found")) - self.download(str(url.group(1))) + self.link = m.group(1) getInfo = create_getInfo(NowDownloadSx) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index 3f75a33f7..477379597 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.12" - __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|li|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' + __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" @@ -38,7 +39,7 @@ class NowVideoSx(SimpleHoster): if m is None: self.error(_("Free download link not found")) - self.download(m.group(1)) + self.link = m.group(1) getInfo = create_getInfo(NowVideoSx) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 588d8f64a..b50e2fb42 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -7,15 +7,15 @@ import re from module.common.json_layer import json_loads from module.plugins.Hoster import Hoster -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.33" - __pattern__ = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' + __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' __description__ = """oboom.com hoster plugin""" __license__ = "GPLv3" @@ -33,6 +33,7 @@ class OboomCom(Hoster): def process(self, pyfile): self.pyfile.url.replace(".com/#id=", ".com/#") self.pyfile.url.replace(".com/#/", ".com/#") + self.html = self.load(pyfile.url) self.getFileId(self.pyfile.url) self.getSessionToken() self.getFileInfo(self.sessionToken, self.fileId) @@ -74,7 +75,7 @@ class OboomCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + 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, diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index f9c0dbe85..4b947c554 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.76" + __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" @@ -20,17 +21,18 @@ class OneFichierCom(SimpleHoster): ("imclem", None), ("stickell", "l.stickell@yahoo.it"), ("Elrick69", "elrick69[AT]rocketmail[DOT]com"), - ("Walter Purcaro", "vuolter@gmail.com")] + ("Walter Purcaro", "vuolter@gmail.com"), + ("Ludovic Lehmann", "ludo.lehmann@gmail.com")] - NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' - SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + 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*<' - COOKIES = [("1fichier.com", "LG", "en")] - - WAIT_PATTERN = r'>You must wait (\d+) minutes' + WAIT_PATTERN = r'>You must wait \d+ minutes' def setup(self): @@ -54,7 +56,7 @@ class OneFichierCom(SimpleHoster): def handlePremium(self, pyfile): - return self.handleFree(pyfile) + self.download(pyfile.url, post={'dl': "Download", 'did': 0}) getInfo = create_getInfo(OneFichierCom) diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py new file mode 100644 index 000000000..5a60b6787 --- /dev/null +++ b/module/plugins/hoster/OpenloadIo.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class OpenloadIo(SimpleHoster): + __name__ = "OpenloadIo" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://(?:www\.)?openload\.io/f/\w{11}' + + __description__ = """Openload.io hoster plugin""" + __license__ = "GPLv3" + + 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 + +getInfo = create_getInfo(OpenloadIo) diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py index 7e8423ec9..2e4961704 100644 --- a/module/plugins/hoster/OronCom.py +++ b/module/plugins/hoster/OronCom.py @@ -9,6 +9,7 @@ class OronCom(DeadHoster): __version__ = "0.14" __pattern__ = r'https?://(?:www\.)?oron\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Oron.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index d4f4c0135..d06baa0f5 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -13,66 +11,41 @@ from module.utils import parseFileSize class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.09" + __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 getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - - if name.endswith("..."): #: incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - - return name - - def setup(self): self.chunkLimit = 5 def handlePremium(self, pyfile): - https = "https" if self.getConfig("ssl") else "http" + 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 is not None and pyfile.name.endswith('.tmp') and data['filename']: + 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]) - - if self.link != pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): - # only use when name wasn't already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}) - # usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link.")) - - return super(OverLoadMe, self).checkFile() + self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1]) getInfo = create_getInfo(OverLoadMe) diff --git a/module/plugins/hoster/PandaplaNet.py b/module/plugins/hoster/PandaplaNet.py index 78a1ed177..ae8406d82 100644 --- a/module/plugins/hoster/PandaplaNet.py +++ b/module/plugins/hoster/PandaplaNet.py @@ -9,6 +9,7 @@ class PandaplaNet(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Pandapla.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 71342f3e0..0c3b84a9d 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -73,8 +73,7 @@ class PornhostCom(Hoster): if not self.html: self.download_html() - if (re.search(r'gallery not found', self.html) is not None or - re.search(r'You will be redirected to', self.html) is not None): + if re.search(r'gallery not found|You will be redirected to', self.html): return False else: return True diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 1bb787f09..16ce36ea9 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -64,7 +64,7 @@ class PornhubCom(Hoster): if not self.html: self.download_html() - m = re.search(r'<title[^>]+>([^<]+) - ', self.html) + m = re.search(r'<title.+?>([^<]+) - ', self.html) if m: name = m.group(1) else: @@ -83,7 +83,7 @@ class PornhubCom(Hoster): 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) is not None: + 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/module/plugins/hoster/PotloadCom.py b/module/plugins/hoster/PotloadCom.py index d6261af3a..5a41f7d3c 100644 --- a/module/plugins/hoster/PotloadCom.py +++ b/module/plugins/hoster/PotloadCom.py @@ -9,6 +9,7 @@ class PotloadCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Potload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 665005ec3..ab5016673 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -2,7 +2,7 @@ from __future__ import with_statement -from os import remove +import os from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo from module.utils import fs_encode @@ -11,9 +11,10 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.22" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" @@ -22,6 +23,9 @@ class PremiumTo(MultiHoster): ("stickell", "l.stickell@yahoo.it")] + CHECK_TRAFFIC = True + + def handlePremium(self, pyfile): #raise timeout to 2min self.download("http://premium.to/api/getfile.php", @@ -31,22 +35,22 @@ class PremiumTo(MultiHoster): disposition=True) - def checkFile(self): + 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 - lastDownload = fs_encode(self.lastDownload) - with open(lastDownload, "rb") as f: + file = fs_encode(self.lastDownload) + with open(file, "rb") as f: err = f.read(256).strip() - remove(lastDownload) + os.remove(file) if err: self.fail(err) - return super(PremiumTo, self).checkFile() + return super(PremiumTo, self).checkFile(rules) getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 3d19c88ac..181c08b7a 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,9 +7,10 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" @@ -31,7 +32,7 @@ class PremiumizeMe(MultiHoster): 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", + data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php", get={'method' : "directdownloadlink", 'params[login]': user, 'params[pass]' : data['password'], diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index ce0a384e3..3815a1a24 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -11,16 +11,17 @@ class PromptfileCom(SimpleHoster): __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>' + 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="([^"]*)" />' + CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />' LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' @@ -39,7 +40,7 @@ class PromptfileCom(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.download(m.group(1), disposition=True) + self.link = m.group(1) getInfo = create_getInfo(PromptfileCom) diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py index 3a59a2c9e..e984d0033 100644 --- a/module/plugins/hoster/PrzeklejPl.py +++ b/module/plugins/hoster/PrzeklejPl.py @@ -9,6 +9,7 @@ class PrzeklejPl(DeadHoster): __version__ = "0.11" __pattern__ = r'http://(?:www\.)?przeklej\.pl/plik/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Przeklej.pl hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py index 67732a4cd..7f4b7b6cc 100644 --- a/module/plugins/hoster/PutdriveCom.py +++ b/module/plugins/hoster/PutdriveCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hosters.ZeveraCom import ZeveraCom +from module.plugins.hoster.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 210bf4cb2..1e0750b88 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import FOLLOWLOCATION - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,6 +12,7 @@ class QuickshareCz(SimpleHoster): __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" @@ -29,7 +29,7 @@ class QuickshareCz(SimpleHoster): self.getFileInfo() # parse js variables - self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'[^']*')", self.html)) + 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'] @@ -59,19 +59,20 @@ class QuickshareCz(SimpleHoster): 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.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(download_url, post=data) self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) if m is None: self.fail(_("File not found")) - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 - self.logDebug("FREE URL2:" + download_url) + + self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.logDebug("FREE URL2:" + self.link) # check errors - m = re.search(r'/chyba/(\d+)', download_url) + 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") @@ -80,9 +81,6 @@ class QuickshareCz(SimpleHoster): else: self.fail(_("Error %d") % m.group(1)) - # download file - self.download(download_url) - def handlePremium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 13c2f8776..710faf25c 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -11,10 +11,11 @@ class RPNetBiz(MultiHoster): __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" - - __pattern__ = r'https?://.+rpnet\.biz' __authors__ = [("Dman", "dmanugm@gmail.com")] @@ -25,7 +26,6 @@ class RPNetBiz(MultiHoster): def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.logDebug("Original URL: %s" % pyfile.url) # Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", get={"username": user, diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 2f7365e3b..50804e8cd 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -10,6 +10,7 @@ class RapideoPl(MultiHoster): __version__ = "0.02" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapideo.pl multi-hoster plugin""" __license__ = "GPLv3" @@ -83,14 +84,14 @@ class RapideoPl(MultiHoster): # error code isn't yet added to plugin self.fail( parsed["errstring"] - or "Unknown error (code: %s)" % parsed["errno"] + 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 webiste \ - directly. Update this plugin." % parsed["hosting"]) + _("Download from %s is possible only using Rapideo.pl website \ + directly") % parsed["hosting"]) pyfile.name = parsed["filename"] pyfile.size = parsed["filesize"] diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 3473b1c7c..0bbaed57f 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -15,8 +15,6 @@ class RapidfileshareNet(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "rapidfileshare.net" - 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>' diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 84c3b20d6..bd6bb8582 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -1,21 +1,23 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader -from module.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight +from module.plugins.internal.AdsCaptcha import AdsCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.SolveMedia import SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.34" __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" @@ -29,24 +31,26 @@ class RapidgatorNet(SimpleHoster): 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>' + 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_ERROR_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' - DOWNLOAD_LIMIT_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)\s*(\d+)\s*(hour|min)' + + 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[^"\']*)' + 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) + self.sid = self.account.getAccountInfo(self.user).get('sid', None) else: self.sid = None @@ -95,26 +99,24 @@ class RapidgatorNet(SimpleHoster): def handleFree(self, pyfile): - self.checkFree() - jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) self.logDebug(jsvars) self.req.http.lastURL = pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + 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(int(jsvars.get('secs', 45)), False) + 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(HTTPHEADER, ["X-Requested-With:"]) + 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) @@ -122,13 +124,15 @@ class RapidgatorNet(SimpleHoster): for _i in xrange(5): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug(link) - self.download(link, disposition=True) + self.link = m.group(1) break else: - captcha, captcha_key = self.getCaptcha() - challenge, response = captcha.challenge(captcha_key) + 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, @@ -142,49 +146,11 @@ class RapidgatorNet(SimpleHoster): self.error(_("Download link")) - def getCaptcha(self): - m = re.search(self.ADSCAPTCHA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = AdsCaptcha(self) - else: - m = re.search(self.RECAPTCHA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = ReCaptcha(self) - else: - m = re.search(self.SOLVEMEDIA_PATTERN, self.html) - if m: - captcha_key = m.group(1) - captcha = SolveMedia(self) - else: - self.error(_("Captcha")) - - return captcha, captcha_key - - - def checkFree(self): - m = re.search(self.PREMIUM_ONLY_ERROR_PATTERN, self.html) - if m: - self.fail(_("Premium account needed for download")) - else: - m = re.search(self.WAIT_PATTERN, self.html) - - if m: - wait_time = int(m.group(1)) * {"hour": 60, "min": 1}[m.group(2)] - else: - m = re.search(self.DOWNLOAD_LIMIT_ERROR_PATTERN, self.html) - if m is None: - return - elif m.group(1) == "daily": - self.logWarning(_("You have reached your daily downloads limit for today")) - wait_time = secondsToMidnight(gmt=2) - else: - wait_time = 1 * 60 * 60 - - self.logDebug("Waiting %d minutes" % wait_time / 60) - self.wait(wait_time, True) - self.retry() + def handleCaptcha(self): + for klass in (AdsCaptcha, ReCaptcha, SolveMedia): + inst = klass(self) + if inst.detect_key(): + return inst def getJsonResponse(self, url): diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 0c40d95b9..da353ec70 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -1,21 +1,21 @@ # -*- coding: utf-8 -*- +import pycurl import re - -from pycurl import HTTPHEADER -from time import time, altzone +import time from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.09" __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" @@ -24,8 +24,8 @@ class RapiduNet(SimpleHoster): COOKIES = [("rapidu.net", "rapidu_lang", "en")] - FILE_INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' - OFFLINE_PATTERN = r'404 - File not found' + 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">' @@ -39,7 +39,7 @@ class RapiduNet(SimpleHoster): def handleFree(self, pyfile): self.req.http.lastURL = pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", get={'a': "getLoadTimeToDownload"}, @@ -47,30 +47,28 @@ class RapiduNet(SimpleHoster): decode=True) if str(jsvars['timeToDownload']) is "stop": - t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone + 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())) + 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) - for _i in xrange(10): - challenge, response = 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.download(jsvars['url']) - break + if jsvars['message'] == 'success': + self.link = jsvars['url'] def getJsonResponse(self, *args, **kwargs): diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index 2be952efe..a45e4ed4d 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -17,8 +17,6 @@ class RarefileNet(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "rarefile.net" - LINK_PATTERN = r'<a href="(.+?)">\1</a>' diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index bf9fda293..4500fcefc 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote -from time import time +import time +import urllib from module.common.json_layer import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -14,25 +12,16 @@ from module.utils import parseFileSize class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.64" + __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 getFilename(self, url): - try: - name = unquote(url.rsplit("/", 1)[1]) - except IndexError: - name = "Unknown_Filename..." - if not name or name.endswith(".."): #: incomplete filename, append random stuff - name += "%s.tmp" % randrange(100, 999) - return name - - def setup(self): self.chunkLimit = 3 @@ -42,7 +31,7 @@ class RealdebridCom(MultiHoster): get={'lang' : "en", 'link' : pyfile.url, 'password': self.getPassword(), - 'time' : int(time() * 1000)})) + 'time' : int(time.time() * 1000)})) self.logDebug("Returned Data: %s" % data) @@ -53,30 +42,15 @@ class RealdebridCom(MultiHoster): self.logWarning(data['message']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + 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"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): - #only use when name wasnt already set - pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}): - #usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link")) - - return super(RealdebridCom, self).checkFile() - getInfo = create_getInfo(RealdebridCom) diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index d68fbe262..9051c498a 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -56,7 +56,7 @@ class RedtubeCom(Hoster): if not self.html: self.download_html() - if re.search(r'This video has been removed.', self.html) is not None: + if re.search(r'This video has been removed.', self.html): return False else: return True diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 28de35d08..9c07364ec 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urllib import unquote +import urllib from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -11,6 +11,7 @@ class RehostTo(MultiHoster): __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" diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 11c9f3b0f..d60101aed 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Test links: -# http://remixshare.com/download/p946u +# http://remixshare.com/download/z8uli # # Note: # The remixshare.com website is very very slow, so @@ -16,22 +16,26 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.03" + __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")] + __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^_]+)\)<' - OFFLINE_PATTERN = r'<h1>Ooops!<' + 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_FREE_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' + LINK_PATTERN = r'var uri = "(.+?)"' TOKEN_PATTERN = r'var acc = (\d+)' - WAIT_PATTERN = r'var XYZ = r"(\d+)"' + + WAIT_PATTERN = r'var XYZ = "(\d+)"' def setup(self): @@ -40,24 +44,15 @@ class RemixshareCom(SimpleHoster): def handleFree(self, pyfile): - b = re.search(self.LINK_FREE_PATTERN, self.html) + b = re.search(self.LINK_PATTERN, self.html) if not b: - self.error(_("Cannot parse download url")) + self.error(_("File url")) c = re.search(self.TOKEN_PATTERN, self.html) if not c: - self.error(_("Cannot parse file token")) - - dl_url = b.group(1) + c.group(1) - - #Check if we have to wait - seconds = re.search(self.WAIT_PATTERN, self.html) - if seconds: - self.logDebug("Wait " + seconds.group(1)) - self.wait(int(seconds.group(1))) + self.error(_("File token")) - # Finally start downloading... - self.download(dl_url, disposition=True) + self.link = b.group(1) + "/zzz/" + c.group(1) getInfo = create_getInfo(RemixshareCom) diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index aa4830563..1a45def44 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -8,19 +8,21 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RgHostNet(SimpleHoster): __name__ = "RgHostNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" - __pattern__ = r'http://(?:www\.)?rghost\.net/\d+(?:r=\d+)?' + __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'<h1>\s+(<a[^>]+>)?(?P<N>[^<]+)(</a>)?\s+<small[^>]+>\s+\((?P<S>[^)]+)\)\s+</small>\s+</h1>' - OFFLINE_PATTERN = r'File is deleted|this page is not found' + 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\s+href="([^"]+)"\s+class="btn\s+large\s+download"[^>]+>Download</a>' + LINK_FREE_PATTERN = r'<a href="(.+?)" class="btn large' getInfo = create_getInfo(RgHostNet) diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index bb6e0f646..08612e413 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -15,8 +15,6 @@ class SafesharingEu(XFSHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - HOSTER_DOMAIN = "safesharing.eu" - ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)' diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index 64e6456a9..6bfbce328 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -15,8 +15,6 @@ class SecureUploadEu(XFSHoster): __authors__ = [("z00nx", "z00nx0@gmail.com")] - HOSTER_DOMAIN = "secureupload.eu" - INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index ffd2995b8..0ab20949d 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -11,6 +11,7 @@ class SendspaceCom(SimpleHoster): __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" @@ -21,10 +22,10 @@ class SendspaceCom(SimpleHoster): 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="([^"]+)"' + 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>' + CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=(.+?))"></td>' + USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=(.+?))"></td>' def handleFree(self, pyfile): @@ -34,7 +35,7 @@ class SendspaceCom(SimpleHoster): if m: if 'captcha_hash' in params: self.correctCaptcha() - download_url = m.group(1) + self.link = m.group(1) break m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -55,7 +56,5 @@ class SendspaceCom(SimpleHoster): else: self.fail(_("Download link not found")) - self.download(download_url) - getInfo = create_getInfo(SendspaceCom) diff --git a/module/plugins/hoster/Share4webCom.py b/module/plugins/hoster/Share4WebCom.py index 7a276c1fe..7a276c1fe 100644 --- a/module/plugins/hoster/Share4webCom.py +++ b/module/plugins/hoster/Share4WebCom.py diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py index 1ac8a64e7..4a4af1672 100644 --- a/module/plugins/hoster/Share76Com.py +++ b/module/plugins/hoster/Share76Com.py @@ -9,6 +9,7 @@ class Share76Com(DeadHoster): __version__ = "0.04" __pattern__ = r'http://(?:www\.)?share76\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Share76.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py index 4996014d8..d9a71d786 100644 --- a/module/plugins/hoster/ShareFilesCo.py +++ b/module/plugins/hoster/ShareFilesCo.py @@ -9,6 +9,7 @@ class ShareFilesCo(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?sharefiles\.co/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Sharefiles.co hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py index c0fd22c91..9387483cc 100644 --- a/module/plugins/hoster/SharebeesCom.py +++ b/module/plugins/hoster/SharebeesCom.py @@ -9,6 +9,7 @@ class SharebeesCom(DeadHoster): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?sharebees\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """ShareBees hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 636e5824d..64a490993 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -1,22 +1,22 @@ # -*- coding: utf-8 -*- import re - -from time import time -from urllib import unquote -from urlparse import urlparse +import time +import urllib +import urlparse from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.51" __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" @@ -36,17 +36,15 @@ class ShareonlineBiz(SimpleHoster): @classmethod - def getInfo(cls, url="", html=""): - info = {'name': urlparse(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() + def apiInfo(cls, url): + info = super(ShareonlineBiz, cls).apiInfo(url) - field = getURL("http://api.share-online.biz/linkcheck.php", - get={'md5': "1"}, - post={'links': info['pattern']['ID']}, - decode=True).split(";") + field = getURL("http://api.share-online.biz/linkcheck.php", + get={'md5' : "1", + 'links': re.match(cls.__pattern__, url).group("ID")}, + decode=True).split(";") + try: if field[1] == "OK": info['fileid'] = field[0] info['status'] = 2 @@ -57,6 +55,9 @@ class ShareonlineBiz(SimpleHoster): elif field[1] in ("DELETED", "NOT FOUND"): info['status'] = 1 + except IndexError: + pass + return info @@ -69,12 +70,12 @@ class ShareonlineBiz(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + 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() * 1000)), + 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}) @@ -98,18 +99,15 @@ class ShareonlineBiz(SimpleHoster): self.checkErrors() res = self.handleCaptcha() + self.link = res.decode('base64') - download_url = res.decode("base64") - - if not download_url.startswith("http://"): + if not self.link.startswith("http://"): self.error(_("Wrong download url")) self.wait() - self.download(download_url) - - def checkFile(self): + def checkFile(self, rules={}): check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), 'fail' : re.compile(r"<title>Share-Online")}) @@ -121,7 +119,7 @@ class ShareonlineBiz(SimpleHoster): self.invalidCaptcha() self.retry(5, 5 * 60, _("Download failed")) - return super(ShareonlineBiz, self).checkFile() + return super(ShareonlineBiz, self).checkFile(rules) def handlePremium(self, pyfile): #: should be working better loading (account) api internally @@ -145,13 +143,12 @@ class ShareonlineBiz(SimpleHoster): pyfile.name = dlinfo['name'] pyfile.size = int(dlinfo['size']) - dlLink = dlinfo['url'] + self.link = dlinfo['url'] - if dlLink == "server_under_maintenance": + if self.link == "server_under_maintenance": self.tempOffline() else: self.multiDL = True - self.download(dlLink) def checkErrors(self): @@ -164,7 +161,7 @@ class ShareonlineBiz(SimpleHoster): try: self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) - except: + except Exception: self.logError("Unknown error occurred", errmsg) if errmsg is "invalid": diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 07724a9d1..babd0d1d4 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.Hoster import Hoster @@ -61,7 +60,7 @@ class ShareplaceCom(Hoster): url = re.search(r"var beer = '(.*?)';", self.html) if url: url = url.group(1) - url = unquote( + url = urllib.unquote( url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace( "teletubbies", "")) self.logDebug("URL: %s" % url) @@ -83,7 +82,7 @@ class ShareplaceCom(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True diff --git a/module/plugins/hoster/SharingmatrixCom.py b/module/plugins/hoster/SharingmatrixCom.py index fa08a4a8f..3958ebbd6 100644 --- a/module/plugins/hoster/SharingmatrixCom.py +++ b/module/plugins/hoster/SharingmatrixCom.py @@ -9,6 +9,7 @@ class SharingmatrixCom(DeadHoster): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Sharingmatrix.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index bec30f6f2..689223322 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -9,6 +9,7 @@ class ShragleCom(DeadHoster): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Cloudnator.com (Shragle.com) hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 39e8a6aeb..b3f52bc8c 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -2,8 +2,6 @@ import re -from datetime import datetime, timedelta - from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo from module.plugins.internal.SimpleHoster import secondsToMidnight @@ -14,6 +12,7 @@ class SimplyPremiumCom(MultiHoster): __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" @@ -24,53 +23,58 @@ class SimplyPremiumCom(MultiHoster): self.chunkLimit = 16 - def handlePremium(self, pyfile): - for i in xrange(5): - page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) - self.logDebug("JSON data: " + page) - if page != '': - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if '<valid>0</valid>' in page or ( - "You are not allowed to download from this host" in page and self.premium): + 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 page: + elif "NOTFOUND" in self.html: self.offline() - elif "downloadlimit" in page: + elif "downloadlimit" in self.html: self.logWarning(_("Reached maximum connctions")) - self.retry(5, 60, "Reached maximum connctions") + self.retry(5, 60, _("Reached maximum connctions")) - elif "trafficlimit" in page: + 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 page: + elif "hostererror" in self.html: self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") + self.retry(5, 60, _("Hoster is temporarily unavailable")) + + + def handlePremium(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>', page).group(1) + 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>', page).group(1) + 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>', page).group(1) + 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 - if self.link != self.pyfile.url: - self.logDebug("New URL: " + self.link) - getInfo = create_getInfo(SimplyPremiumCom) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index a26bc5751..aae71d983 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -2,15 +2,16 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, replace_patterns class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.15" + __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" @@ -19,37 +20,30 @@ class SimplydebridCom(MultiHoster): def handlePremium(self, pyfile): #fix the links for simply-debrid.com! - self.link = pyfile.url - self.link = self.link.replace("clz.to", "cloudzer.net/file") - self.link = self.link.replace("http://share-online", "http://www.share-online") - self.link = self.link.replace("ul.to", "uploaded.net/file") - self.link = self.link.replace("uploaded.com", "uploaded.net") - self.link = self.link.replace("filerio.com", "filerio.in") - self.link = self.link.replace("lumfile.com", "lumfile.se") - - if('fileparadox' in self.link): + 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://") - if re.match(self.__pattern__, self.link): - self.link = self.link + 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.logDebug("New URL: %s" % self.link) + self.link = self.html - if not re.match(self.__pattern__, self.link): - page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) - if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page): - self.fail(_("Unable to unrestrict link")) - self.link = page + self.wait(5) - self.setWait(5) - self.wait() - - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({"error": "No address associated with hostname"}): - self.retry(24, 3 * 60, "Bad file downloaded") + self.retry(24, 3 * 60, _("Bad file downloaded")) - return super(SimplydebridCom, self).checkFile() + return super(SimplydebridCom, self).checkFile(rules) getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py new file mode 100644 index 000000000..4c5aedb6d --- /dev/null +++ b/module/plugins/hoster/SizedriveCom.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class SizedriveCom(SimpleHoster): + __name__ = "SizedriveCom" + __type__ = "hoster" + __version__ = "0.02" + + __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 handleFree(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) + + +getInfo = create_getInfo(SizedriveCom) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index bd653ff59..9ae12f145 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -7,16 +7,17 @@ from module.plugins.internal.MultiHoster import MultiHoster class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.05" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Smoozed.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("", "")] - def handlePremium(self, pyfile): + def handleFree(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 @@ -55,9 +56,9 @@ class SmoozedCom(MultiHoster): self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({'error': '{"state":"error"}', 'retry': '{"state":"retry"}'}): self.fail(_("Error response received")) - return super(SmoozedCom, self).checkFile() + return super(SmoozedCom, self).checkFile(rules) diff --git a/module/plugins/hoster/SockshareCom.py b/module/plugins/hoster/SockshareCom.py index aabb8dcd1..44eedf9d4 100644 --- a/module/plugins/hoster/SockshareCom.py +++ b/module/plugins/hoster/SockshareCom.py @@ -9,6 +9,7 @@ class SockshareCom(DeadHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Sockshare.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SolidfilesCom.py b/module/plugins/hoster/SolidfilesCom.py new file mode 100644 index 000000000..d359577d6 --- /dev/null +++ b/module/plugins/hoster/SolidfilesCom.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.solidfiles.com/d/609cdb4b1b + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 + + +getInfo = create_getInfo(SolidfilesCom) diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 3eb546604..8dff4f42a 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -1,57 +1,56 @@ # -*- coding: utf-8 -*- -import pycurl import re -from module.plugins.Hoster import Hoster +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.common.json_layer import json_loads -class SoundcloudCom(Hoster): +class SoundcloudCom(SimpleHoster): __name__ = "SoundcloudCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.11" - __pattern__ = r'https?://(?:www\.)?soundcloud\.com/(?P<UID>.+?)/(?P<SID>.+)' + __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__ = [("Peekayy", "peekayy.dev@gmail.com")] - - - def process(self, pyfile): - # default UserAgent of HTTPRequest fails for this hoster so we use this one - self.req.http.c.setopt(pycurl.USERAGENT, 'Mozilla/5.0') - page = self.load(pyfile.url) - m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', page) - songId = clientId = "" - if m: - songId = m.group('ID') - if len(songId) <= 0: - self.logError(_("Could not find song id")) - self.offline() - else: - m = re.search(r'"clientID":"(?P<CID>.*?)"', page) - if m: - clientId = m.group('CID') - - if len(clientId) <= 0: - clientId = "b45b1aa10f1ac2941910a7f0d10f8e28" - - m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', page) - if m: - pyfile.name = m.group('TITLE') + ".mp3" - else: - pyfile.name = re.match(self.__pattern__, pyfile.url).group('SID') + ".mp3" - - # url to retrieve the actual song url - page = self.load("https://api.sndcdn.com/i1/tracks/%s/streams" % songId, get={"client_id": clientId}) - # getting streams - # for now we choose the first stream found in all cases - # it could be improved if relevant for this hoster - streams = [ - (result.group('QUALITY'), result.group('URL')) - for result in re.finditer(r'"(?P<QUALITY>.*?)":"(?P<URL>.*?)"', page) - ] - self.logDebug("Found Streams", streams) - self.logDebug("Downloading", streams[0][0], streams[0][1]) - self.download(streams[0][1]) + __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 handleFree(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() + + +getInfo = create_getInfo(SoundcloudCom) diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index a13220eab..18f04b611 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -9,6 +9,7 @@ class SpeedLoadOrg(DeadHoster): __version__ = "1.02" __pattern__ = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Speedload.org hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py index f23c8d4c7..cd6d65082 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -9,6 +9,7 @@ class SpeedfileCz(DeadHoster): __version__ = "0.32" __pattern__ = r'http://(?:www\.)?speedfile\.cz/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Speedfile.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 0acdb7647..91788b2c8 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -4,8 +4,7 @@ # http://speedy.sh/ep2qY/Zapp-Brannigan.jpg import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,9 +12,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.04" + __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" @@ -38,10 +38,7 @@ class SpeedyshareCom(SimpleHoster): def handleFree(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Download link not found")) - - dl_link = urljoin("http://www.speedyshare.com", m.group(1)) - self.download(dl_link, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(SpeedyshareCom) diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py index bedc2934f..feb9f3300 100644 --- a/module/plugins/hoster/StorageTo.py +++ b/module/plugins/hoster/StorageTo.py @@ -9,6 +9,7 @@ class StorageTo(DeadHoster): __version__ = "0.01" __pattern__ = r'http://(?:www\.)?storage\.to/get/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Storage.to hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 11d4efcdb..97bed8109 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -32,10 +32,10 @@ class StreamCz(Hoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-([^"]+)" />' + 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*))?&' + 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): diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index b9d6d9ae6..0f8c08ad9 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -17,12 +17,8 @@ class StreamcloudEu(XFSHoster): __authors__ = [("seoester", "seoester@googlemail.com")] - HOSTER_DOMAIN = "streamcloud.eu" - 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 diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index ccca76018..254e06c2a 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -1,25 +1,26 @@ # -*- coding: utf-8 -*- +import binascii +import pycurl import random import re import time +import urllib from Crypto.Cipher import ARC4 -from binascii import hexlify, unhexlify -from pycurl import HTTPHEADER -from urllib import quote from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.20" __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" @@ -35,30 +36,29 @@ class TurbobitNet(SimpleHoster): 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_PATTERN = r'(/download/redirect/[^"\']+)' + 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 handleFree(self, pyfile): - self.url = "http://turbobit.net/download/free/%s" % self.info['pattern']['ID'] - self.html = self.load(self.url, ref=True, decode=True) + 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(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.url = self.getDownloadUrl(rtUpdate) + self.html = self.load(self.getDownloadUrl(rtUpdate)) - self.wait() - self.html = self.load(self.url) - - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) - self.downloadFile() + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) def solveCaptcha(self): @@ -76,7 +76,7 @@ class TurbobitNet(SimpleHoster): if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() else: m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: @@ -134,25 +134,29 @@ class TurbobitNet(SimpleHoster): for b in [1, 3]: self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % ( - self.info['pattern']['ID'], b, quote(fun), rtUpdate) + 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") - self.retry() + else: + self.retry() + + self.wait() def decrypt(self, data): - cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) - return unhexlify(cipher.encrypt(unhexlify(data))) + 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): @@ -161,17 +165,4 @@ class TurbobitNet(SimpleHoster): return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) - def handlePremium(self, pyfile): - self.logDebug("Premium download as user %s" % self.user) - self.downloadFile() - - - def downloadFile(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - self.url = "http://turbobit.net" + m.group(1) - self.download(self.url) - - getInfo = create_getInfo(TurbobitNet) diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py index f0893cef6..e4b53b818 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -9,6 +9,7 @@ class TurbouploadCom(DeadHoster): __version__ = "0.03" __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Turboupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 9d0a86fe9..a79d8c869 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -7,7 +7,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -17,10 +17,7 @@ class TusfilesNet(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "tusfiles.net" - 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): @@ -29,9 +26,9 @@ class TusfilesNet(XFSHoster): self.resumeDownload = True - def downloadLink(self, link): + def downloadLink(self, link, disposition=True): try: - return super(TusfilesNet, self).downloadLink(link) + return super(TusfilesNet, self).downloadLink(link, disposition) except BadHeader, e: if e.code is 503: diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index c6ca2ab29..086228637 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -11,6 +11,7 @@ class TwoSharedCom(SimpleHoster): __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" diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index cadd51149..b43ff8d92 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,9 +15,10 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.02" + __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" @@ -29,61 +30,24 @@ class UlozTo(SimpleHoster): 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 = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)] + URL_REPLACEMENTS = [(r'(?<=http://)([^/]+)', "www.ulozto.net")] + SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] - ADULT_PATTERN = r'<form action="([^\"]*)" method="post" id="frm-askAgeForm">' + 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">' + VIPLINK_PATTERN = r'<a href=".+?\?disclaimer=1" class="linkVip">' TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"' def setup(self): - self.multiDL = self.premium + self.chunkLimit = 16 if self.premium else 1 + self.multiDL = True self.resumeDownload = True - def process(self, pyfile): - pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url) - self.html = self.load(pyfile.url, decode=True, cookies=True) - - 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")) - token = m.group(1) - - self.html = self.load(pyfile.url, get={"do": "askAgeForm-submit"}, - post={"agree": "Confirm", "_token_": token}, cookies=True) - - 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'}, cookies=True) - - 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"}) - - self.getFileInfo() - - if self.premium and self.checkTrafficLeft(): - self.handlePremium(pyfile) - else: - self.handleFree(pyfile) - - self.doCheckDownload() - - def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: @@ -104,7 +68,7 @@ class UlozTo(SimpleHoster): # 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()))}) + xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) self.logDebug("xapca = " + str(xapca)) data = json_loads(xapca) @@ -112,18 +76,50 @@ class UlozTo(SimpleHoster): 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.multiDL = True - self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) + self.download("http://www.ulozto.net" + action, post=inputs) def handlePremium(self, pyfile): - self.download(pyfile.url, get={'do': directDownload}, disposition=True) + 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'}) - def doCheckDownload(self): + 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), @@ -133,8 +129,6 @@ class UlozTo(SimpleHoster): }) if check == "wrong_captcha": - #self.delStorage("captcha_id") - #self.delStorage("captcha_text") self.invalidCaptcha() self.retry(reason=_("Wrong captcha code")) @@ -151,7 +145,9 @@ class UlozTo(SimpleHoster): self.retry() elif check == "not_found": - self.fail(_("Server error - file not downloadable")) + self.fail(_("Server error, file not downloadable")) + + return super(UlozTo, self).checkFile(rules) getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 0267d4b61..ad809b47c 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -11,6 +12,7 @@ class UloziskoSk(SimpleHoster): __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" @@ -21,10 +23,10 @@ class UloziskoSk(SimpleHoster): 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 = "([^"]+)">' + 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): @@ -33,8 +35,7 @@ class UloziskoSk(SimpleHoster): m = re.search(self.IMG_PATTERN, self.html) if m: - url = "http://ulozisko.sk" + m.group(1) - self.download(url) + self.link = "http://ulozisko.sk" + m.group(1) else: self.handleFree(pyfile) @@ -55,8 +56,8 @@ class UloziskoSk(SimpleHoster): 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_url = urlparse.urljoin("http://www.ulozisko.sk", m.group(1)) captcha = self.decryptCaptcha(captcha_url, cookies=True) self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index cd4e506c4..d090c8e7d 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -1,10 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re - -from urlparse import urljoin - -from pycurl import FOLLOWLOCATION +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -15,6 +13,7 @@ class UnibytesCom(SimpleHoster): __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" @@ -23,25 +22,25 @@ class UnibytesCom(SimpleHoster): HOSTER_DOMAIN = "unibytes.com" - INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' + 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>' + LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>' def handleFree(self, pyfile): domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') - self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(urljoin(domain, action), post=post_data) + self.html = self.load(urlparse.urljoin(domain, action), post=post_data) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: - url = m.group(1) + self.link = m.group(1) break if '>Somebody else is already downloading using your IP-address<' in self.html: @@ -51,7 +50,7 @@ class UnibytesCom(SimpleHoster): if post_data['step'] == 'last': m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - url = m.group(1) + self.link = m.group(1) self.correctCaptcha() break else: @@ -62,17 +61,15 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': m = re.search(self.WAIT_PATTERN, self.html) - self.wait(int(m.group(1)) if m else 60, False) + self.wait(m.group(1) if m else 60, False) elif last_step in ("captcha", "last"): - post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) + post_data['captcha'] = self.decryptCaptcha(urlparse.urljoin(domain, "/captcha.jpg")) else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) - - self.download(url) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) getInfo = create_getInfo(UnibytesCom) diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index 52f12b5b8..b63796fe0 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -1,88 +1,19 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from datetime import datetime, timedelta -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.SimpleHoster import secondsToMidnight - - -class UnrestrictLi(MultiHoster): +class UnrestrictLi(DeadHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.23" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - LOGIN_ACCOUNT = False - - - def setup(self): - self.chunkLimit = 16 - self.resumeDownload = True - - - def handleFree(self, pyfile): - for _i in xrange(5): - page = self.load('https://unrestrict.li/unrestrict.php', - post={'link': pyfile.url, 'domain': 'long'}) - self.logDebug("JSON data: " + page) - if page != '': - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if 'Expired session' in page or ("You are not allowed to " - "download from this host" in page and self.premium): - self.account.relogin(self.user) - self.retry() - - elif "File offline" in page: - self.offline() - - elif "You are not allowed to download from this host" in page: - self.fail(_("You are not allowed to download from this host")) - - elif "You have reached your daily limit for this host" in page: - self.logWarning(_("Reached daily limit for this host")) - self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") - - elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page: - self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") - - page = json_loads(page) - self.link = page.keys()[0] - self.api_data = page[self.link] - - if self.link != pyfile.url: - self.logDebug("New URL: " + self.link) - - if hasattr(self, 'api_data'): - self.setNameSize() - - - def checkFile(self): - super(UnrestrictLi, self).checkFile() - - if self.getConfig("history"): - self.load("https://unrestrict.li/history/", get={'delete': "all"}) - self.logInfo(_("Download history deleted")) - - - def setNameSize(self): - if 'name' in self.api_data: - self.pyfile.name = self.api_data['name'] - if 'size' in self.api_data: - self.pyfile.size = self.api_data['size'] - - getInfo = create_getInfo(UnrestrictLi) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 4ea4e345f..9d460ef98 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo @@ -10,26 +9,31 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' __description__ = """Uplea.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Redleon", None)] + __authors__ = [("Redleon", None), + ("GammaC0de", None)] + + DISPOSITION = False #@TODO: Remove in 0.4.10 HOSTER_DOMAIN = "uplea.com" - NAME_PATTERN = r'class="agmd size18">(?P<N>.+?)<' - SIZE_PATTERN = r'size14">(?P<S>[\d.,]+) (?P<U>[\w^_])</span>' + 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'"(http?://\w+\.uplea\.com/anonym/.*?)"' + LINK_PATTERN = r'"(https?://\w+\.uplea\.com/anonym/.*?)"' - WAIT_PATTERN = r'timeText:([\d.]+),' - STEP_PATTERN = r'<a href="(/step/.+)">' + 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): @@ -41,21 +45,22 @@ class UpleaCom(XFSHoster): def handleFree(self, pyfile): m = re.search(self.STEP_PATTERN, self.html) if m is None: - self.error("STEP_PATTERN not found") + self.error(_("STEP_PATTERN not found")) - self.html = self.load(urljoin("http://uplea.com/", m.group(1))) + self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1))) m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1)), True) + 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) - self.download(m.group(1), disposition=True) getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index d987770fe..61226e3da 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -9,6 +9,7 @@ class UploadStationCom(DeadHoster): __version__ = "0.52" __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """UploadStation.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index e28944ab9..f323a3538 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -2,18 +2,17 @@ import re -from time import sleep - -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.10" __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" @@ -21,9 +20,9 @@ class UploadableCh(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - FILE_URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.uploadable.ch/file/\g<ID>')] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.uploadable.ch/file/\g<ID>')] - FILE_INFO_PATTERN = r'div id=\"file_name\" title=.*>(?P<N>.+)<span class=\"filename_normal\">\((?P<S>[\d.]+) (?P<U>\w+)\)</span><' + 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">' @@ -35,22 +34,21 @@ class UploadableCh(SimpleHoster): def handleFree(self, pyfile): # Click the "free user" button and wait - a = self.load(pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) + 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, cookies=True, post={'checkDownload': "check"}, decode=True) + b = self.load(pyfile.url, post={'checkDownload': "check"}, decode=True) self.logDebug(b) #: Expected output: {"success":"showCaptcha"} recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) # Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", - cookies=True, post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.info['pattern']['ID']}, @@ -59,21 +57,21 @@ class UploadableCh(SimpleHoster): self.wait(3) # Get ready for downloading - self.load(pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) + self.load(pyfile.url, post={'downloadLink': "show"}, decode=True) self.wait(3) # Download the file - self.download(pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) + self.download(pyfile.url, post={'download': "normal"}, disposition=True) - def checkFile(self): + 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() + return super(UploadableCh, self).checkFile(rules) getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py index 031c5f761..cb4f50184 100644 --- a/module/plugins/hoster/UploadboxCom.py +++ b/module/plugins/hoster/UploadboxCom.py @@ -9,6 +9,7 @@ class UploadboxCom(DeadHoster): __version__ = "0.05" __pattern__ = r'http://(?:www\.)?uploadbox\.com/files/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """UploadBox.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 833468a80..4db160ab4 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,245 +1,106 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://ul.to/044yug9o -# http://ul.to/gzfhd0xs import re - -from time import sleep +import time +import urlparse from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks -from module.plugins.internal.CaptchaService import ReCaptcha -from module.utils import html_unescape, parseFileSize - - -key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') - - -def getID(url): - """ returns id from file url""" - m = re.match(UploadedTo.__pattern__, url) - return m.group('ID') - - -def getAPIData(urls): - post = {"apikey": key} - - idMap = {} - - for i, url in enumerate(urls): - id = getID(url) - post['id_%s' % i] = id - idMap[id] = url - - for _i in xrange(5): - api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') - if api != "can't find request": - break - else: - sleep(3) - - result = {} - - if api: - for line in api.splitlines(): - data = line.split(",", 4) - if data[1] in idMap: - result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]]) - - return result +from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -def parseFileInfo(self, url='', html=''): - if not html and hasattr(self, "html"): - html = self.html - - name = url - size = 0 - fileid = None - - if re.search(self.OFFLINE_PATTERN, html): - # File offline - status = 1 - else: - m = re.search(self.INFO_PATTERN, html) - if m: - name, fileid = html_unescape(m.group('N')), m.group('ID') - size = parseFileSize(m.group('S')) - status = 2 - else: - status = 3 - - return name, size, status, fileid - - -def getInfo(urls): - for chunk in chunks(urls, 80): - result = [] - - api = getAPIData(chunk) - - for data in api.itervalues(): - if data[0] == "online": - result.append((html_unescape(data[2]), data[1], 2, data[4])) - - elif data[0] == "offline": - result.append((data[4], 0, 1, data[4])) - - yield result - - -class UploadedTo(Hoster): +class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.75" + __version__ = "0.92" __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__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("netpok", "netpok@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] - + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' - OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>' - DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' + CHECK_TRAFFIC = True + DISPOSITION = False - def setup(self): - self.multiDL = self.resumeDownload = self.premium - self.chunkLimit = 1 # critical problems with more chunks + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" - self.fileID = getID(self.pyfile.url) - self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] + TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' - def process(self, pyfile): - self.load("http://uploaded.net/language/en", just_header=True) - - api = getAPIData([pyfile.url]) + 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' - # TODO: fallback to parse from site, because api sometimes delivers wrong status codes - if not api: - self.logWarning(_("No response for API call")) + @classmethod + def apiInfo(cls, url): + info = super(UploadedTo, cls).apiInfo(url) - self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1') - name, size, status, self.fileID = parseFileInfo(self) - self.logDebug(name, size, status, self.fileID) - if status == 1: - self.offline() - elif status == 2: - pyfile.name, pyfile.size = name, size + 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: - self.error(_("file info")) + time.sleep(3) - elif api == 'Access denied': - self.fail(_("API key invalid")) + return info - else: - if self.fileID not in api: - self.offline() - self.data = api[self.fileID] - if self.data[0] != "online": - self.offline() + def setup(self): + self.multiDL = self.resumeDownload = self.premium + self.chunkLimit = 1 # critical problems with more chunks - pyfile.name = html_unescape(self.data[2]) - # pyfile.name = self.get_file_name() + def checkErrors(self): + if 'var free_enabled = false;' in self.html: + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) - if self.premium: - self.handlePremium() - else: - self.handleFree() + return super(UploadedTo, self).checkErrors() - def handlePremium(self): - info = self.account.getAccountInfo(self.user, True) - self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, - "left": info['trafficleft'] / 1024 / 1024}) - if int(self.data[1]) / 1024 > info['trafficleft']: - self.logInfo(_("Not enough traffic left")) - self.account.empty(self.user) - self.resetAccount() - self.fail(_("Traffic exceeded")) + def handlePremium(self, pyfile): + self.link = urlparse.urljoin(pyfile.url, "/ddl?pw=" + self.getPassword()) - header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True) - if 'location' in header: - #Direct download - self.logDebug("Direct download link detected") - self.download(header['location']) - else: - #Indirect download - self.html = self.load("http://uploaded.net/file/%s" % self.fileID) - m = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) - if m is None: - self.fail(_("Download URL not m. Try to enable direct downloads")) - url = m.group(1) - self.download(url, post={}) + def handleFree(self, pyfile): + self.load("http://uploaded.net/language/en", just_header=True) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load("http://uploaded.net/js/download.js", decode=True) - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() - m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) - if m is None: - self.fail(_("File not downloadable for free users")) - self.setWait(int(m.group(1))) + self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + if "type:'download'" in self.html: + self.correctCaptcha() + try: + self.link = re.search("url:'(.+?)'", self.html).group(1) - url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID - downloadURL = "" + except Exception: + pass - recaptcha = ReCaptcha(self) - for _i in xrange(5): - challenge, response = recaptcha.challenge() - options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response} - self.wait() - - result = self.load(url, post=options) - self.logDebug("Result: %s" % result) - - if "limit-size" in result: - self.fail(_("File too big for free download")) - elif "limit-slot" in result: # Temporary restriction so just wait a bit - self.setWait(30 * 60, True) - self.wait() - self.retry() - elif "limit-parallel" in result: - self.fail(_("Cannot download in parallel")) - elif "limit-dl" in result or self.DL_LIMIT_PATTERN in result: # limit-dl - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() - elif '"err":"captcha"' in result: - self.invalidCaptcha() - elif "type:'download'" in result: - self.correctCaptcha() - downloadURL = re.search("url:'([^']+)", result).group(1) - break - else: - self.error(_("Unknown error: %s") % result) + def checkFile(self, rules={}): + if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): + self.wait(3 * 60 * 60, True) + self.retry() - if not downloadURL: - self.fail(_("No Download url retrieved/all captcha attempts failed")) + return super(UploadedTo, self).checkFile(rules) - self.download(downloadURL, disposition=True) - check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN}) - if check == "limit-dl": - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() + +getInfo = create_getInfo(UploadedTo) diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py index 8da30be46..bc94e644e 100644 --- a/module/plugins/hoster/UploadhereCom.py +++ b/module/plugins/hoster/UploadhereCom.py @@ -9,6 +9,7 @@ class UploadhereCom(DeadHoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?uploadhere\.com/\w{10}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Uploadhere.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index ac0b4b562..5c74f10eb 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -4,6 +4,7 @@ # http://uploadhero.co/dl/wQBRAVSM import re +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -11,9 +12,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.17" + __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" @@ -21,56 +23,48 @@ class UploadheroCom(SimpleHoster): ("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>' - SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>' - OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.' + 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>' + 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://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' - LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" id="downloadnow"' + LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(.+?)"|"(http://storage\d+\.uploadhero\.co.+?)"' + LINK_PREMIUM_PATTERN = r'<a href="(.+?)" id="downloadnow"' def handleFree(self, pyfile): - self.checkErrors() - m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.error(_("CAPTCHA_PATTERN not found")) - captcha_url = "http://uploadhero.co" + m.group(1) + self.error(_("Captcha not found")) + + captcha = self.decryptCaptcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) - for _i in xrange(5): - captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(pyfile.url, get={"code": captcha}) - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - self.correctCaptcha() - download_url = m.group(1) or m.group(2) - break - else: - self.invalidCaptcha() - else: - self.fail(_("No valid captcha code entered")) + self.html = self.load(pyfile.url, + get={"code": captcha}) - self.download(download_url) + 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("http://uploadhero.co%s" % m.group(1)) + 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() - self.info.pop('error', None) + return super(UploadheroCom, self).checkErrors() getInfo = create_getInfo(UploadheroCom) diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 164b7b243..d1cafcff4 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.common.json_layer import json_loads from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp @@ -11,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -22,7 +21,7 @@ class UploadingCom(SimpleHoster): ("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'id="file_title">(?P<N>.+)</' + 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' @@ -53,8 +52,7 @@ class UploadingCom(SimpleHoster): 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: - url = url.group(1).replace("\\/", "/") - self.download(url) + self.link = url.group(1).replace("\\/", "/") raise Exception("Plugin defect") @@ -67,7 +65,7 @@ class UploadingCom(SimpleHoster): 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(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + 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']})) @@ -93,7 +91,7 @@ class UploadingCom(SimpleHoster): else: self.error(_("No URL")) - self.download(url) + self.link = url getInfo = create_getInfo(UploadingCom) diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py index 743e700eb..0d60cef1f 100644 --- a/module/plugins/hoster/UploadkingCom.py +++ b/module/plugins/hoster/UploadkingCom.py @@ -9,6 +9,7 @@ class UploadkingCom(DeadHoster): __version__ = "0.14" __pattern__ = r'http://(?:www\.)?uploadking\.com/\w{10}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """UploadKing.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index f287a2b51..6410a2dce 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -2,16 +2,17 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?upstore\.net/' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Upstore.Net File Download Hoster""" __license__ = "GPLv3" @@ -22,7 +23,7 @@ class UpstoreNet(SimpleHoster): 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="([^"]*)">' + CHASH_PATTERN = r'<input type="hidden" name="hash" value="(.+?)">' LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' @@ -52,7 +53,7 @@ class UpstoreNet(SimpleHoster): self.wait(wait_time) # then, handle the captcha - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -66,8 +67,7 @@ class UpstoreNet(SimpleHoster): if m is None: self.error(_("Download link not found")) - direct = m.group(1) - self.download(direct, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(UpstoreNet) diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 21d781f55..2c06558e4 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -6,24 +6,21 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.20" - __pattern__ = r'https?://(?:www\.)?uptobox\.com/\w{12}' + __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' __description__ = """Uptobox.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "uptobox.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)' + 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 diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index d894dab24..78da91020 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -11,8 +11,8 @@ class VeehdCom(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", "_")] + __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), + ("replacement_char", "str", "Filename replacement character", "_")] __description__ = """Veehd.com hoster plugin""" __license__ = "GPLv3" @@ -52,7 +52,7 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - m = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) + m = re.search(r'<title.*?>([^<]+) on Veehd</title>', self.html) if m is None: self.error(_("Video title not found")) @@ -73,7 +73,7 @@ class VeehdCom(Hoster): if not self.html: self.download_html() - m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', + 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")) diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 219efa8e1..57b24623b 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -11,7 +11,8 @@ class VeohCom(SimpleHoster): __version__ = "0.22" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' - __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] + __config__ = [("use_premium", "bool" , "Use premium account if available", True ), + ("quality" , "Low;High;Auto", "Quality" , "Auto")] __description__ = """Veoh.com hoster plugin""" __license__ = "GPLv3" @@ -33,7 +34,7 @@ class VeohCom(SimpleHoster): def handleFree(self, pyfile): - quality = self.getConfig("quality") + quality = self.getConfig('quality') if quality == "Auto": quality = ("High", "Low") @@ -42,8 +43,7 @@ class VeohCom(SimpleHoster): m = re.search(pattern, self.html) if m: pyfile.name += ".mp4" - link = m.group(1).replace("\\", "") - self.download(link) + self.link = m.group(1).replace("\\", "") return else: self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index 76af05edd..f1a32a897 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -18,8 +18,6 @@ class VidPlayNet(XFSHoster): __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - HOSTER_DOMAIN = "vidplay.net" - NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index f7485f025..b263c445f 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -8,18 +8,19 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' - __config__ = [("quality", "Lowest;Mobile;SD;HD;Highest", "Quality", "Highest"), - ("original", "bool", "Try to download the original file first", True)] + __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<' + 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.<' @@ -44,16 +45,16 @@ class VimeoCom(SimpleHoster): 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)]) + link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) - if self.getConfig("original"): + if self.getConfig('original'): if "original" in link: - self.download(link[q]) + self.link = link[q] return else: self.logInfo(_("Original file not downloadable")) - quality = self.getConfig("quality") + quality = self.getConfig('quality') if quality == "Highest": qlevel = ("hd", "sd", "mobile") elif quality == "Lowest": @@ -63,7 +64,7 @@ class VimeoCom(SimpleHoster): for q in qlevel: if q in link: - self.download(link[q]) + self.link = link[q] return else: self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/module/plugins/hoster/Vipleech4uCom.py b/module/plugins/hoster/Vipleech4UCom.py index 2ae41b942..5668e0fad 100644 --- a/module/plugins/hoster/Vipleech4uCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -9,6 +9,7 @@ class Vipleech4UCom(DeadHoster): __version__ = "0.20" __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Vipleech4u.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py index c83d5c03e..6cb94e57e 100644 --- a/module/plugins/hoster/WarserverCz.py +++ b/module/plugins/hoster/WarserverCz.py @@ -9,6 +9,7 @@ class WarserverCz(DeadHoster): __version__ = "0.13" __pattern__ = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Warserver.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index e3424fc21..c898d23ab 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,51 +9,49 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.18" - __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' + __pattern__ = r'https?://(?:www\.)?(en\.)?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")] + __authors__ = [("stickell", "l.stickell@yahoo.it "), + ("rush" , "radek.senfeld@gmail.com")] @classmethod - def getInfo(cls, url="", html=""): - info = super(WebshareCz, self).getInfo(url, html) + def apiInfo(cls, url): + info = super(WebshareCz, cls).apiInfo(url) - if url: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() + info['pattern'] = re.match(cls.__pattern__, url).groupdict() - api_data = getURL("https://webshare.cz/api/file_info/", - post={'ident': info['pattern']['ID']}, - decode=True) + api_data = getURL("https://webshare.cz/api/file_info/", + post={'ident': info['pattern']['ID'], 'wst': ""}, + 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'] + if not re.search(r'<status>OK', api_data): + info['status'] = 1 + else: + info['status'] = 2 + info['name'] = re.search(r'<name>(.+?)<', api_data).group(1) + info['size'] = re.search(r'<size>(.+?)<', api_data).group(1) return info def handleFree(self, pyfile): - wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" + wst = self.account.getAccountData(self.user).get('wst', None) if self.account else None - api_data = getURL('https://webshare.cz/api/file_link/', + 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) + if m: + self.link = m.group(1) def handlePremium(self, pyfile): diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 457e72865..f11d03ea8 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -13,6 +12,7 @@ class WrzucTo(SimpleHoster): __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" @@ -34,7 +34,7 @@ class WrzucTo(SimpleHoster): if len(data) != 2: self.error(_("No file ID")) - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + 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']}) @@ -45,8 +45,7 @@ class WrzucTo(SimpleHoster): if len(data) != 4: self.error(_("No download URL")) - download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) - self.download(download_url) + self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) getInfo = create_getInfo(WrzucTo) diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 75ce59353..73c008ae8 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -9,6 +9,7 @@ class WuploadCom(DeadHoster): __version__ = "0.23" __pattern__ = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Wupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index a4e4b04bd..8e2dd3a53 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -9,6 +9,7 @@ class X7To(DeadHoster): __version__ = "0.41" __pattern__ = r'http://(?:www\.)?x7\.to/' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """X7.to hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 1794ae513..169fbc8d3 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,9 +8,9 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.46" - __pattern__ = r'^unmatchable$' + __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)' __description__ = """XFileSharingPro dummy hoster plugin for hook""" __license__ = "GPLv3" @@ -21,7 +21,7 @@ class XFileSharingPro(XFSHoster): def _log(self, type, args): - msg = " | ".join([str(a).strip() for a in args if a]) + msg = " | ".join(str(a).strip() for a in args if a) logger = getattr(self.log, type) logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) @@ -32,10 +32,7 @@ class XFileSharingPro(XFSHoster): self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['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 != '.']) - - if self.HOSTER_NAME[0].isdigit(): - self.HOSTER_NAME = 'X' + self.HOSTER_NAME + 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) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index c6e789fa8..a1711cb0e 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.common.json_layer import json_loads from module.plugins.Hoster import Hoster @@ -22,7 +21,7 @@ class XHamsterCom(Hoster): __version__ = "0.12" __pattern__ = r'http://(?:www\.)?xhamster\.com/movies/.+' - __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] + __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")] __description__ = """XHamster.com hoster plugin""" __license__ = "GPLv3" @@ -35,8 +34,8 @@ class XHamsterCom(Hoster): if not self.file_exists(): self.offline() - if self.getConfig("type"): - self.desired_fmt = self.getConfig("type") + 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()) @@ -83,7 +82,7 @@ class XHamsterCom(Hoster): self.logDebug("long_url = " + long_url) else: if flashvars['file']: - file_url = unquote(flashvars['file']) + file_url = urllib.unquote(flashvars['file']) else: self.error(_("file_url not found")) @@ -123,7 +122,7 @@ class XHamsterCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*Video not found.*)", self.html) is not None: + if re.search(r"(.*Video not found.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index 9bb2da424..a8f291824 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.Hoster import Hoster @@ -25,4 +24,4 @@ class XVideosCom(Hoster): re.search(r"<h2>([^<]+)<span", site).group(1), re.match(self.__pattern__, pyfile.url).group(1), ) - self.download(unquote(re.search(r"flv_url=([^&]+)&", site).group(1))) + self.download(urllib.unquote(re.search(r"flv_url=([^&]+)&", site).group(1))) diff --git a/module/plugins/hoster/XdadevelopersCom.py b/module/plugins/hoster/XdadevelopersCom.py new file mode 100644 index 000000000..45d1e92cb --- /dev/null +++ b/module/plugins/hoster/XdadevelopersCom.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -* +# +# Test links: +# http://forum.xda-developers.com/devdb/project/dl/?id=10885 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(self, pyfile): + self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 + + +getInfo = create_getInfo(XdadevelopersCom) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index bfa62b8db..d167e4cab 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -4,11 +4,9 @@ import re import socket import struct import sys +import time -from os import makedirs -from os.path import exists, join from select import select -from time import time from module.plugins.Hoster import Hoster from module.utils import save_join @@ -84,12 +82,12 @@ class Xdcc(Hoster): ####################### # CONNECT TO IRC AND IDLE FOR REAL LINK - dl_time = time() + dl_time = time.time() sock = socket.socket() sock.connect((host, int(port))) if nick == "pyload": - nick = "pyload-%d" % (time() % 1000) # last 3 digits + 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)) @@ -111,13 +109,13 @@ class Xdcc(Hoster): break if retry: - if time() > retry: + if time.time() > retry: retry = None - dl_time = time() + dl_time = time.time() sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) else: - if (dl_time + self.timeout) < time(): # todo: add in config + 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")) @@ -159,7 +157,7 @@ class Xdcc(Hoster): 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())) + sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer @@ -172,7 +170,7 @@ class Xdcc(Hoster): print "%s: %s" % (msg['origin'], msg['text']) if "You already requested that pack" in msg['text']: - retry = time() + 300 + retry = time.time() + 300 if "you must be on a known channel to request a pack" in msg['text']: self.fail(_("Wrong channel")) diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py new file mode 100644 index 000000000..3b4c9d985 --- /dev/null +++ b/module/plugins/hoster/YadiSk.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- + +import re +import random + +from module.common.json_layer import json_loads +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +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 handleFree(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 + + +getInfo = create_getInfo(YadiSk) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index adc403de4..00185c05a 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re +import urlparse from module.common.json_layer import json_loads from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -12,6 +13,7 @@ class YibaishiwuCom(SimpleHoster): __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" @@ -34,7 +36,7 @@ class YibaishiwuCom(SimpleHoster): self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) - res = json_loads(self.load("http://115.com" + url, decode=False)) + res = json_loads(self.load(urlparse.urljoin("http://115.com", url), decode=False)) if "urls" in res: mirrors = res['urls'] @@ -46,11 +48,10 @@ class YibaishiwuCom(SimpleHoster): for mr in mirrors: try: - url = mr['url'].replace("\\", "") - self.logDebug("Trying URL: " + url) - self.download(url) + self.link = mr['url'].replace("\\", "") + self.logDebug("Trying URL: " + self.link) break - except: + except Exception: continue else: self.fail(_("No working link found")) diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 4bb2520e6..19d07fa36 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -54,7 +54,7 @@ class YoupornCom(Hoster): """ if not self.html: self.download_html() - if re.search(r"(.*invalid video_id.*)", self.html) is not None: + if re.search(r"(.*invalid video_id.*)", self.html): return False else: return True diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index e0def108e..d0316d3ac 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import re - -from urllib import unquote +import reimport urllib from module.plugins.Hoster import Hoster @@ -62,7 +60,7 @@ class YourfilesTo(Hoster): url = re.search(r"var bla = '(.*?)';", self.html) if url: url = url.group(1) - url = unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) + url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) return url else: self.error(_("Absolute filepath not found")) @@ -81,7 +79,7 @@ class YourfilesTo(Hoster): if not self.html: self.download_html() - if re.search(r"HTTP Status 404", self.html) is not None: + if re.search(r"HTTP Status 404", self.html): return False else: return True diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 90c6df3c2..e2ab146a9 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -2,9 +2,7 @@ import os import re -import subprocess - -from urllib import unquote +import subprocessimport urllib from module.plugins.Hoster import Hoster from module.plugins.internal.SimpleHoster import replace_patterns @@ -13,40 +11,36 @@ from module.utils import html_unescape def which(program): """Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646""" - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) fpath, fname = os.path.split(program) if fpath: - if is_exe(program): + 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 is_exe(exe_file): + if isExe(exe_file): return exe_file - return None - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.40" + __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 (5-102, 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)] + __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" @@ -90,7 +84,7 @@ class YoutubeCom(Hoster): def process(self, pyfile): pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) - html = self.load(pyfile.url, decode=True) + 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() @@ -99,33 +93,41 @@ class YoutubeCom(Hoster): self.tempOffline() #get config - use3d = self.getConfig("3d") + 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 desired_fmt and desired_fmt not in self.formats: + + 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 - if not desired_fmt: - desired_fmt = quality.get(self.getConfig("quality"), 18) #parse available streams - streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1) + 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']), unquote(x['url'])) for x in streams] - #self.logDebug("Found links: %s" % 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" % @@ -136,15 +138,18 @@ class YoutubeCom(Hoster): if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] # select quality index + 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 @@ -167,9 +172,9 @@ class YoutubeCom(Hoster): m = "0" pyfile.name += " (starting at %s:%s)" % (m, s) - pyfile.name += file_suffix - filename = self.download(url) + pyfile.name += file_suffix + filename = self.download(url) if ffmpeg and time: inputfile = filename + "_" @@ -182,4 +187,5 @@ class YoutubeCom(Hoster): "-vcodec", "copy", "-acodec", "copy", filename]) + os.remove(inputfile) diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py index dc96facbe..6e4508a18 100644 --- a/module/plugins/hoster/ZShareNet.py +++ b/module/plugins/hoster/ZShareNet.py @@ -9,6 +9,7 @@ class ZShareNet(DeadHoster): __version__ = "0.21" __pattern__ = r'https?://(?:ww[2w]\.)?zshares?\.net/.+' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """ZShare.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ZahikiNet.py b/module/plugins/hoster/ZahikiNet.py new file mode 100644 index 000000000..b2705662b --- /dev/null +++ b/module/plugins/hoster/ZahikiNet.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class ZahikiNet(SimpleHoster): + __name__ = "ZahikiNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?zahiki\.net/\w+/.+' + + __description__ = """Zahiki.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + DIRECT_LINK = True + + NAME_PATTERN = r'/(?P<N>.+?) </title>' + OFFLINE_PATTERN = r'>(Not Found|Il file selezionato non esiste)' + + LINK_FREE_PATTERN = r'file: "(.+?)"' + + + def setup(self): + self.resumeDownload = True + self.multiDL = True + self.limitDL = 6 + + +getInfo = create_getInfo(ZahikiNet) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index fb251142e..617e00e58 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -10,9 +9,10 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.27" + __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" @@ -21,14 +21,14 @@ class ZeveraCom(MultiHoster): def handlePremium(self, pyfile): - return "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) - def checkFile(self): + def checkFile(self, rules={}): if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): self.fail(_("Error response received")) - return super(ZeveraCom, self).checkFile() + return super(ZeveraCom, self).checkFile(rules) getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 2648f532f..d776e5928 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -1,61 +1,94 @@ # -*- coding: utf-8 -*- import re +import urllib -from urlparse import urljoin +from BeautifulSoup import BeautifulSoup +from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.66" + __version__ = "0.79" - __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' + __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")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("sebdelsol", "seb.morin@gmail.com")] - NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' - SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + COOKIES = [("zippyshare.com", "ziplocale", "en")] - OFFLINE_PATTERN = r'>File does not exist on this server<' + 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<' - COOKIES = [("zippyshare.com", "ziplocale", "en")] + LINK_PREMIUM_PATTERN = r"document.location = '(.+?)'" def setup(self): - self.multiDL = True self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True def handleFree(self, pyfile): - checksum = self.get_checksum() - p_url = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() - self.link = urljoin(self.info['pattern']['HOST'], p_url) + if captcha_key: + try: + self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + recaptcha.challenge() + except Exception, e: + self.error(e) - def get_checksum(self): - try: - m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html) - if m: - a1, a2, c1, c2 = map(int, m.groups()) - b = (a1 % a2) + (c1 % c2) - else: - a1, a2 = map(int, re.search(r'\(\'downloadB\'\).omg = (\d+)%(\d+)' , self.html).groups()) - c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups()) - b = (a1 % a2) * (c1 % c2) + 18 + else: + self.link = self.get_link() - except Exception, e: - self.error(_("Unable to calculate checksum"), e) + if self.link and pyfile.name == 'file.html': + pyfile.name = urllib.unquote(self.link.split('/')[-1]) - else: - return b + + def get_link(self): + # get all the scripts inside the html body + soup = 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)) getInfo = create_getInfo(ZippyshareCom) |