diff options
Diffstat (limited to 'module/plugins/hoster')
209 files changed, 2978 insertions, 3095 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index fdf060330..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,35 +11,25 @@ from module.utils import parseFileSize class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.46" - __pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*' + __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Alldebrid.com hoster plugin""" + __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 - self.resumeDownload = True + self.chunkLimit = 16 - def handlePremium(self): + def handlePremium(self, pyfile): password = self.getPassword() data = json_loads(self.load("http://www.alldebrid.com/service.php", - get={'link': self.pyfile.url, 'json': "true", 'pw': password})) + get={'link': pyfile.url, 'json': "true", 'pw': password})) self.logDebug("Json data", data) @@ -52,29 +40,15 @@ class AlldebridCom(MultiHoster): self.logWarning(data['error']) self.tempOffline() else: - if self.pyfile.name and not self.pyfile.name.endswith('.tmp'): - self.pyfile.name = data['filename'] - self.pyfile.size = parseFileSize(data['filesize']) + if pyfile.name and not pyfile.name.endswith('.tmp'): + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) self.link = data['link'] - if self.getConfig("https"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != self.pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) - - - def AlldebridCom(self): - super(AlldebridCom, self).checkFile() - - if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) is "error": - self.retry(wait_time=60, reason=_("An error occured while generating link")) - 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 d0d8e7cc8..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.26" + __version__ = "0.43" __pattern__ = r'^unmatchable$' @@ -25,11 +24,19 @@ class BasePlugin(Hoster): @classmethod def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - return {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': unquote(url) or ""} + 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 @@ -43,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: @@ -54,11 +66,11 @@ 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) - self.req.addAuth(account.accounts[server]['password']) + self.req.addAuth(account.getAccountData(server)['password']) else: pwd = self.getPassword() if ':' in pwd: @@ -72,37 +84,20 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": #@TODO: Move to hoster in 0.4.10 - self.fail(_("Empty file")) - - - 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 3a0b8e58c..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.25" + __version__ = "0.27" - __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.*' + __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """BezvaData.cz hoster plugin""" __license__ = "GPLv3" @@ -27,7 +28,7 @@ class BezvadataCz(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): #download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: @@ -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 50013cc43..79aaedcd9 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,9 +11,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.53" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.*?)\.html)' + __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,21 +72,16 @@ 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() - check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) - - if check == "404": - self.retry(3, 60, 'Error 404') - - elif check == "error": + if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") def getDownloadUrl(self): # Return location if direct download is active if self.premium: - header = self.load(self.pyfile.url, cookies=True, just_header=True) + header = self.load(self.pyfile.url, just_header=True) if 'location' in header: return header['location'] @@ -119,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 949a021dd..868be4033 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,9 +9,10 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.14" __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_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): - m = re.search(self.SECONDS_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) - self.wait(wait_time, True) - + def handleFree(self, pyfile): recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() - self.html = self.load(self.pyfile.url, + response, challenge = recaptcha.challenge() + self.html = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - m = re.search(self.LINK_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) + m = re.search(self.LINK_FREE_PATTERN, self.html) + 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 442b0dd6c..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.04" + __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,15 +25,20 @@ 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): + def handleFree(self, pyfile): self.html = self.load("http://www.cloudzilla.to/generateticket/", post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) @@ -47,15 +53,15 @@ 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'], - 'ticket_id': ticket['ticket_id']}) + 'ticket_id': ticket['ticket_id']} - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(CloudzillaTo) 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 e5f94800b..4f872f60a 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import re +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -9,36 +10,37 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Crocko hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' - SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' + 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): + def handleFree(self, pyfile): if "You need Premium membership to download this file." in self.html: self.fail(_("You need Premium membership to download this file")) for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.html) if m: - url, wait_time = 'http://crocko.com' + m.group(1), int(m.group(2)) - self.wait(wait_time) + url = urlparse.urljoin("http://crocko.com", m.group(1)) + self.wait(m.group(2)) self.html = self.load(url) else: break @@ -52,14 +54,10 @@ 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) - check = self.checkDownload({ - "captcha_err": recaptcha.KEY_AJAX_PATTERN - }) - - if check == "captcha_err": + if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): self.invalidCaptcha() else: break 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 914849879..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.96" + __version__ = "0.99" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' + __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 @@ -63,7 +64,7 @@ class CzshareCom(SimpleHoster): return True - def handlePremium(self): + def handlePremium(self, pyfile): # parse download link try: form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) @@ -74,26 +75,28 @@ 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): + def handleFree(self, pyfile): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: self.error(_("FREE_URL_PATTERN not found")) + parsed_url = "http://sdilej.cz" + m.group(1) + self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html - self.html = self.load(parsed_url, 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) try: form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - self.pyfile.size = int(inputs['size']) + pyfile.size = int(inputs['size']) + except Exception, e: self.logError(e) self.error(_("Form")) @@ -102,11 +105,14 @@ 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() + elif re.search(self.MULTIDL_PATTERN, self.html): self.longWait(5 * 60, 12) + else: self.correctCaptcha() break @@ -118,35 +124,39 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: self.error(_("Download URL not found")) - 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.*$"), - "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"), - "multi_dl": re.compile(self.MULTIDL_PATTERN), - "captcha_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>" + "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + "multi-dl" : re.compile(self.MULTIDL_PATTERN), + "captcha" : "<li>Zadaný ověřovací kód nesouhlasí!</li>" }) - if check == "temp_offline": + if check == "temp offline": self.fail(_("File not available - try later")) - if check == "credit": + + elif check == "credit": self.resetAccount() - elif check == "multi_dl": + + elif check == "multi-dl": self.longWait(5 * 60, 12) - elif check == "captcha_err": + + elif check == "captcha": 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 437fea7cd..955c94437 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -11,9 +11,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): __name__ = "DataHu" __type__ = "hoster" - __version__ = "0.02" + __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_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' + LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="(.+?)">' def setup(self): @@ -31,12 +32,4 @@ class DataHu(SimpleHoster): self.multiDL = self.premium - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("LINK_PATTERN not found")) - - self.download(m.group(1), disposition=True) - - getInfo = create_getInfo(DataHu) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index b9e6fd370..ad514f5eb 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,9 +6,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" - __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.*)' + __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dataport.cz hoster plugin""" __license__ = "GPLv3" @@ -23,7 +24,7 @@ class DataportCz(SimpleHoster): FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' - def handleFree(self): + def handleFree(self, pyfile): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} for _i in xrange(60): @@ -37,17 +38,19 @@ 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'}) + "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) + elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load(pyfile.url, decode=True) continue + else: break diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index e4bff8458..f0ad95d1e 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.08" __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,12 +24,12 @@ 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: "(.*?)",' - def handleFree(self): + def handleFree(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} recaptcha = ReCaptcha(self) @@ -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 d20afb620..4f64215fa 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -8,11 +8,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.17" - __pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+' + __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Debriditalia.com hoster plugin""" + __description__ = """Debriditalia.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] @@ -21,29 +22,23 @@ class DebridItaliaCom(MultiHoster): URL_REPLACEMENTS = [("https://", "http://")] - def setup(self): - self.chunkLimit = 1 - self.resumeDownload = True - - - def handlePremium(self): + def handlePremium(self, pyfile): self.html = self.load("http://www.debriditalia.com/api.php", - get={'generate': "on", 'link': self.pyfile.url, 'p': self.getPassword()}) + get={'generate': "on", 'link': pyfile.url, 'p': self.getPassword()}) if "ERROR:" not in self.html: self.link = self.html.strip() else: - errmsg = re.search(r'ERROR:(.*)', self.html).group(1).strip() + self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip() self.html = self.load("http://debriditalia.com/linkgen2.php", post={'xjxfun' : "convertiLink", - 'xjxargs[]': "S<![CDATA[%s]]>" % self.pyfile.url, + 'xjxargs[]': "S<![CDATA[%s]]>" % pyfile.url, 'xjxargs[]': "S%s" % self.getPassword()}) - - self.link = re.search(r'<a href="(.+?)"', self.html).group(1) - - if not self.link: - self.fail(errmsg) + try: + self.link = re.search(r'<a href="(.+?)"', self.html).group(1) + except AttributeError: + pass getInfo = create_getInfo(DebridItaliaCom) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 6588a3b37..8559bbc36 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -11,9 +10,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.55" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Depositfiles.com hoster plugin""" __license__ = "GPLv3" @@ -27,39 +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")] - FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' - PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"' - PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' - - - def handleFree(self): - self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) + 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' - 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) + 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="(.+?)"' - 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() - 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) + def handleFree(self, pyfile): + self.html = self.load(pyfile.url, post={'gateway_result': "1"}) - 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: @@ -67,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.FREE_LINK_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): + 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.PREMIUM_LINK_PATTERN, self.html) - mirror = re.search(self.PREMIUM_MIRROR_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 85e36edb3..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,38 +11,27 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.03" + __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_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 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - - dl_url = m.group(1) - self.download(dl_url, disposition=True) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - - getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 793c81b1c..72d15852c 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -36,9 +36,10 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Dl.free.fr hoster plugin""" __license__ = "GPLv3" @@ -47,8 +48,8 @@ class DlFreeFr(SimpleHoster): ("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é' @@ -78,21 +79,24 @@ class DlFreeFr(SimpleHoster): if content_type and content_type.startswith("text/html"): # Undirect acces to requested file, with a web page providing it (captcha) self.html = self.load(valid_url) - self.handleFree() + 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 + elif headers.get('code') == 404: self.offline() + else: self.fail(_("Invalid return code: ") + str(headers.get('code'))) - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('action="getfile.pl"') adyoulike = AdYouLike(self) - inputs.update(adyoulike.challenge()) + response, challenge = adyoulike.challenge() + inputs.update(response) self.load("http://dl.free.fr/getfile.pl", post=inputs) headers = self.getLastHeaders() @@ -103,9 +107,10 @@ class DlFreeFr(SimpleHoster): 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 658974d13..eec968f5a 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DropboxCom(SimpleHoster): __name__ = "DropboxCom" __type__ = "hoster" - __version__ = "0.03" + __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,17 +27,13 @@ class DropboxCom(SimpleHoster): def setup(self): - self.multiDL = True - self.chunkLimit = 1 + self.multiDL = True + self.chunkLimit = 1 self.resumeDownload = True - def handleFree(self): - self.download(self.pyfile.url, get={'dl': "1"}) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + def handleFree(self, pyfile): + self.download(pyfile.url, get={'dl': "1"}) getInfo = create_getInfo(DropboxCom) 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 b9dc45e78..b8485001e 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -8,20 +8,21 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): __name__ = "EdiskCz" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" - __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*' + __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)' - LINK_PATTERN = r'http://.*edisk\.cz.*\.html' + LINK_FREE_PATTERN = r'http://.*edisk\.cz.*\.html' def setup(self): @@ -47,10 +48,10 @@ class EdiskCz(SimpleHoster): "action": action }) - if not re.match(self.LINK_PATTERN, url): + 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 705a8d18a..842e0cb87 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,60 +8,61 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.28" - __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.*' + __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Euroshare.eu hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' - FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' - ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + LINK_FREE_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' + + ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] - def setup(self): - self.multiDL = self.resumeDownload = self.premium - self.req.setOption("timeout", 120) - - - def handlePremium(self): + def handlePremium(self, pyfile): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(self.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":"(.*?)"')}) + "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) self.retry(reason=_("Access token expired")) + elif check == "json": self.fail(self.lastCheck.group(1)) - def handleFree(self): - if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: + def handleFree(self, pyfile): + if re.search(self.ERR_PARDL_PATTERN, self.html): self.longWait(5 * 60, 12) - m = re.search(self.FREE_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("FREE_URL_PATTERN not found")) - parsed_url = "http://euroshare.eu%s" % m.group(1) - self.logDebug("URL", parsed_url) - self.download(parsed_url, disposition=True) + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = "http://euroshare.eu%s" % m.group(1) - check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) - if check == "multi_dl": + + def checkFile(self, rules={}): + if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) + return super(EuroshareEu, self).checkFile(rules) + 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 fc38a79a9..f3b4d28be 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -4,32 +4,32 @@ import re from module.common.json_layer import json_loads -from module.plugins.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.62" + __version__ = "0.65" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Extabit.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' + NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>.+?)">' SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>' OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' + LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' - def handleFree(self): + def handleFree(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) @@ -42,7 +42,7 @@ class ExtabitCom(SimpleHoster): self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.info('ID') + fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: @@ -51,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() @@ -68,12 +68,11 @@ class ExtabitCom(SimpleHoster): self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + 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 a4c85b4ca..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,58 +10,35 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.11" - __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>\w{24})' + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Fastix hoster plugin""" + __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 - self.resumeDownload = True + self.chunkLimit = 3 - def handlePremium(self): + def handlePremium(self, pyfile): api_key = self.account.getAccountData(self.user) api_key = api_key['api'] - page = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': self.pyfile.url}) - data = json_loads(page) + self.html = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) + + data = json_loads(self.html) self.logDebug("Json data", data) - if "error\":true" in page: + if "error\":true" in self.html: self.offline() else: self.link = data['downloadlink'] - if self.link != self.pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): - #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - super(FastixRu, self).checkFile() - - if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}) is "error": - self.retry(wait_time=60, reason=_("An error occurred while generating link")) - getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 31437c6e7..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.26" + __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 " @@ -45,7 +46,7 @@ class FastshareCz(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -53,27 +54,27 @@ 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): - super(FastshareCz, self).checkFile() + 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'), + 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), + 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) }) - if check == "paralell_dl": + if check == "paralell-dl": self.retry(6, 10 * 60, _("Paralell download")) - elif check == "wrong_captcha": + elif check == "wrong captcha": self.retry(max_tries=5, reason=_("Wrong captcha")) elif check == "credit": self.resetAccount() + 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/FileParadoxIn.py b/module/plugins/hoster/FileParadoxIn.py deleted file mode 100644 index 0b5b57e22..000000000 --- a/module/plugins/hoster/FileParadoxIn.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class FileParadoxIn(XFSHoster): - __name__ = "FileParadoxIn" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'https?://(?:www\.)?fileparadox\.in/\w{12}' - - __description__ = """FileParadox.in hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("RazorWing", "muppetuk1@hotmail.com")] - - - HOSTER_DOMAIN = "fileparadox.in" - - -getInfo = create_getInfo(FileParadoxIn) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 5250a92fe..de030be9c 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.05" + __version__ = "0.10" - __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): - super(FilerNet, self).handlePremium() - if self.link: - self.link = urljoin("http://fileshark.pl/", self.link) - - - def handleFree(self): + 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): - super(FileSharkPl, self).checkFile() - - 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() + 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 e1bd8da71..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.01" + __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): @@ -27,11 +29,10 @@ class FileStoreTo(SimpleHoster): self.multiDL = True - def handleFree(self): + 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 ff1194ecc..244131dc7 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -8,7 +8,8 @@ class FilebeerInfo(DeadHoster): __type__ = "hoster" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*' + __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/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index cb9782f23..38d2972a1 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,9 +10,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+).*' + __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" @@ -20,17 +21,21 @@ class FilecloudIo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' - NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' - OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' + SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' - AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' - LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' + LINK_FREE_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' def setup(self): @@ -39,7 +44,7 @@ class FilecloudIo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): data = {"ukey": self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) @@ -55,14 +60,11 @@ class FilecloudIo(SimpleHoster): if captcha_key is None: self.error(_("ReCaptcha key not found")) - if not self.account: - self.fail(_("User not logged in")) - elif not self.account.logged_in: - challenge, response = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response} - self.account.relogin(self.user) - self.retry(2) + response, challenge = recaptcha.challenge(captcha_key) + self.account.form_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response} + self.account.relogin(self.user) + self.retry(2) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) @@ -77,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) @@ -95,20 +97,19 @@ class FilecloudIo(SimpleHoster): if res['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.info['pattern']['ID'], self.html) + m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) 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")) - def handlePremium(self): + def handlePremium(self, pyfile): akey = self.account.getAccountData(self.user)['akey'] ukey = self.info['pattern']['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) @@ -117,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 ada498a51..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.52" + __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,9 +32,9 @@ 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_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' WAIT_PATTERN = r'<div id="countdown_clock" data-delay="(\d+)">' PREMIUM_ONLY_PATTERN = r'>Premium Account Required' @@ -42,49 +42,44 @@ class FilefactoryCom(SimpleHoster): COOKIES = [("filefactory.com", "locale", "en_US.utf8")] - def handleFree(self): + def handleFree(self, pyfile): if "Currently only Premium Members can download files larger than" in self.html: self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: self.retry(50, 15 * 60, _("All free slots are busy")) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) 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">'}) + 'error' : '<div id="errorMessage">'}) if check == "multiple": self.logDebug("Parallel downloads detected; waiting 15 minutes") self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) + elif check == "error": self.error(_("Unknown error")) + return super(FilefactoryCom, self).checkFile(rules) - def handlePremium(self): - header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: - url = header['location'].strip() - if not url.startswith("http://"): - url = urljoin("http://www.filefactory.com", url) - elif 'content-disposition' in header: - url = self.pyfile.url - else: - html = self.load(self.pyfile.url) - m = re.search(self.LINK_PATTERN, html) + def handlePremium(self, pyfile): + self.link = self.directLink(self.load(pyfile.url, just_header=True)) + + if not self.link: + html = self.load(pyfile.url) + m = re.search(self.LINK_PREMIUM_PATTERN, html) if m: - url = m.group(1) + self.link = m.group(1) else: self.error(_("Premium download link not found")) - - self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index d5367e0be..236603c6e 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -9,7 +9,7 @@ class FilejungleCom(FileserveCom): __type__ = "hoster" __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+).*' + __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+)' __description__ = """Filejungle.com hoster plugin""" __license__ = "GPLv3" @@ -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 66c040770..2a9e3dc26 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -1,8 +1,7 @@ # -*- 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 @@ -12,16 +11,17 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.33" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filepost.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>' + 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' @@ -29,7 +29,7 @@ class FilepostCom(SimpleHoster): FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: self.error(_("Token")) @@ -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 cc3e86bc9..874fde3c8 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -12,9 +12,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): __name__ = "FilepupNet" __type__ = "hoster" - __version__ = "0.02" + __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" @@ -27,7 +28,7 @@ class FilepupNet(SimpleHoster): OFFLINE_PATTERN = r'>This file has been deleted' - LINK_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + LINK_FREE_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' def setup(self): @@ -35,17 +36,13 @@ class FilepupNet(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + 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 = m.group(1) self.download(dl_link, post={'task': "download"}) - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 2a38ac470..156392c79 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -6,8 +6,7 @@ import pycurl import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -16,9 +15,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.19" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Filer.net hoster plugin""" __license__ = "GPLv3" @@ -29,54 +29,38 @@ 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): + def handleFree(self, pyfile): inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) - self.html = self.load(self.pyfile.url, post={'token': inputs['token']}, decode=True) + self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True) inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(self) - - 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(self.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 92ff5a02a..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 @@ -32,9 +32,9 @@ def getInfo(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" - __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.*' + __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' __description__ = """Files.mail.ru hoster plugin""" __license__ = "GPLv3" @@ -42,8 +42,7 @@ class FilesMailRu(Hoster): def setup(self): - if not self.account: - self.multiDL = False + self.multiDL = bool(self.account) def process(self, pyfile): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 2d4478e63..4bca2eb59 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -6,8 +6,8 @@ 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.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import secondsToMidnight from module.utils import parseFileSize @@ -33,9 +33,9 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.54" - __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+).*' + __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' __description__ = """Fileserve.com hoster plugin""" __license__ = "GPLv3" @@ -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>' @@ -118,14 +118,16 @@ class FileserveCom(Hoster): self.logDebug(self.req.http.lastEffectiveURL) check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN, - "wait": re.compile(self.LONG_WAIT_PATTERN), - "limit": self.DAILY_LIMIT_PATTERN}) + "wait" : re.compile(self.LONG_WAIT_PATTERN), + "limit" : self.DAILY_LIMIT_PATTERN}) if check == "expired": self.logDebug("Download link was expired") self.retry() + elif check == "wait": self.doLongWait(self.lastCheck) + elif check == "limit": self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) @@ -159,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, @@ -204,12 +206,9 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url: - check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}) - - if check == "login": - self.account.relogin(self.user) - self.retry(reason=_("Not logged in")) + if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin(self.user) + self.retry(reason=_("Not logged in")) def getInfo(urls): 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 361537927..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 @@ -13,7 +12,8 @@ class FlyFilesNet(SimpleHoster): __type__ = "hoster" __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?flyfiles\.net/.*' + __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 e1fcdab26..79eb1fb83 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): __name__ = "FourSharedCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" - __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*' + __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" @@ -25,37 +26,38 @@ class FourSharedCom(SimpleHoster): NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] SIZE_REPLACEMENTS = [(",", "")] - DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"' - DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"' - FID_PATTERN = r'name="d3fid" value="(.*?)"' + DIRECT_LINK = False + LOGIN_ACCOUNT = True + LINK_FREE_PATTERN = r'name="d3link" value="(.*?)"' + LINK_BTN_PATTERN = r'id="btnLink" href="(.*?)"' - def handleFree(self): - if not self.account: - self.fail(_("User not logged in")) + ID_PATTERN = r'name="d3fid" value="(.*?)"' - m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) + + def handleFree(self, pyfile): + m = re.search(self.LINK_BTN_PATTERN, self.html) if m: link = m.group(1) else: - link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url) + link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url) self.html = self.load(link) - m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link")) - link = m.group(1) + + self.link = m.group(1) try: - m = re.search(self.FID_PATTERN, self.html) + 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) - self.download(link) getInfo = create_getInfo(FourSharedCom) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 00c31c528..6a595e75b 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.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import secondsToMidnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -43,23 +43,27 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.checkDownload({"bad": "bad try", - "paralell": "> Sorry, you cant download more then 1 files at time. <", - "empty": "Warning: Unknown: Filename cannot be empty", - "wrong_captcha": "Wrong Captcha!", + check = self.checkDownload({"bad" : "bad try", + "paralell" : "> Sorry, you cant download more then 1 files at time. <", + "empty" : "Warning: Unknown: Filename cannot be empty", + "wrong_captcha" : "Wrong Captcha!", "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": self.fail(_("Bad Try")) + elif check == "paralell": self.setWait(300, True) self.wait() self.retry() + elif check == "empty": self.fail(_("File not downloadable")) + elif check == "wrong_captcha": self.invalidCaptcha() self.retry() + elif check == "downloadserver": self.retry(5, 15 * 60, _("No Download server")) @@ -103,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 @@ -118,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 @@ -149,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 6bda13792..1cca24c3b 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,11 +6,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.16" - __pattern__ = r'https://(?:www\.)?free-way\.me/.*' + __pattern__ = r'https://(?:www\.)?free-way\.me/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """FreeWayMe hoster plugin""" + __description__ = """FreeWayMe multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Nicolas Giese", "james@free-way.me")] @@ -21,14 +22,33 @@ class FreeWayMe(MultiHoster): self.chunkLimit = 1 - def handlePremium(self): + def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.link = True - self.download( - "https://www.free-way.me/load.php", - get={"multiget": 7, "url": self.pyfile.url, "user": user, "pw": self.account.getpw(user), "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 7b8e4b0bd..50128db10 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re - -from time import strptime, mktime, gmtime +import time +import urlparse from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -24,9 +24,10 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.20" - __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.*' + __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """FshareVn hoster plugin""" __license__ = "GPLv3" @@ -38,31 +39,26 @@ class FshareVn(SimpleHoster): NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - LINK_PATTERN = r'action="(http://download.*?)[#"]' + LINK_FREE_PATTERN = r'action="(http://download.*?)[#"]' WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' - def process(self, pyfile): - self.html = self.load('http://www.fshare.vn/check_link.php', post={ - "action": "check_link", - "arrlinks": pyfile.url - }, decode=True) - self.getFileInfo() + def preload(self): + self.html = self.load("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': pyfile.url}, + decode=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - self.checkDownloadedFile() + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handleFree(self, pyfile): + self.html = self.load(pyfile.url, decode=True) self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = self.pyfile.url + action + url = urlparse.urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -73,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")) @@ -81,25 +77,19 @@ 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() m = re.search(r'var count = (\d+)', self.html) self.setWait(int(m.group(1)) if m else 30) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) - self.url = m.group(1) - self.logDebug("FREE DL URL: %s" % self.url) + self.error(_("LINK_FREE_PATTERN not found")) + self.link = m.group(1) self.wait() - self.download(self.url) - - - def handlePremium(self): - self.download(self.pyfile.url) def checkErrors(self): @@ -109,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" @@ -118,13 +108,3 @@ class FshareVn(SimpleHoster): self.retry(30, 2 * 60, msg) self.info.pop('error', None) - - - def checkDownloadedFile(self): - # check download - check = self.checkDownload({ - "not_found": "<head><title>404 Not Found</title></head>" - }) - - if check == "not_found": - self.fail(_("File not m on server")) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index c6ad68e49..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.44" + __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: @@ -43,7 +42,7 @@ class Ftp(Hoster): if netloc in servers: self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.accounts[netloc]['password']) + self.req.addAuth(self.account.getAccountInfo(netloc)['password']) else: pwd = self.getPassword() if ':' in pwd: @@ -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 37af7f216..c2feeb6f8 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -1,67 +1,59 @@ # -*- 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.02" + __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): - captcha_key = str(randint(1, 100000000)) + def handleFree(self, pyfile): + 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() captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, post={ + self.html = self.load(pyfile.url, post={ "captcha_key": captcha_key, "captcha": captcha, "download": "Download"}) 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 436d825a9..4b27e6cc8 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -11,9 +11,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): __name__ = "GooIm" __type__ = "hoster" - __version__ = "0.03" + __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" @@ -29,11 +30,9 @@ class GooIm(SimpleHoster): self.multiDL = True - def handleFree(self): - url = self.pyfile.url - self.html = self.load(url, cookies=True) + def handleFree(self, pyfile): self.wait(10) - self.download(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 117749f89..ac0043b37 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import re +import urlparse from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -8,41 +8,29 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.85" - __pattern__ = r'(http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*' + __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Hellshare.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' - SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + CHECK_TRAFFIC = True + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' + SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'<h1>File not found.</h1>' - SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False + self.resumeDownload = self.multiDL = bool(self.account) self.chunkLimit = 1 - def process(self, pyfile): - if not self.account: - self.fail(_("User not logged in")) - pyfile.url = re.match(self.__pattern__, pyfile.url).group(1) - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() - if not self.checkTrafficLeft(): - self.fail(_("Not enough traffic left for user ") + self.user) - - m = re.search(self.SHOW_WINDOW_PATTERN, self.html) - if m is None: - self.error(_("SHOW_WINDOW_PATTERN not found")) - - self.url = "http://www.hellshare.com" + m.group(1) - self.download(self.url) - - getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index a7ca19406..9b10760bd 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -8,7 +8,8 @@ class HellspyCz(DeadHoster): __type__ = "hoster" __version__ = "0.28" - __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)/?.*' + __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 317a49caf..2a35a008f 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://180upload.com/js9qdm6kjnrs from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo @@ -9,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}' @@ -18,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 d8a28ef72..f81381c66 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -8,7 +8,8 @@ class IcyFilesCom(DeadHoster): __type__ = "hoster" __version__ = "0.06" - __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.*)' + __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 2dae4cd80..ef267b505 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -1,67 +1,19 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - -class IfileIt(SimpleHoster): +class IfileIt(DeadHoster): __name__ = "IfileIt" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'^unmatchable$' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Ifile.it""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' - RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\'' - INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\s*</strong>\s*</span>' - OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' - TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' - - - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - json_url = 'http://ifile.it/new_download-request.json' - post_data = {"ukey": ukey, "ab": "0"} - res = json_loads(self.load(json_url, post=post_data)) - - self.logDebug(res) - - if res['status'] == 3: - self.offline() - - if res['captcha']: - captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) - - recaptcha = ReCaptcha(self) - post_data['ctype'] = "recaptcha" - - for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) - post_data.update({'recaptcha_challenge': challenge, - 'recaptcha_response' : response}) - res = json_loads(self.load(json_url, post=post_data)) - self.logDebug(res) - - if res['retry']: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("Incorrect captcha")) - - if not "ticket_url" in res: - self.error(_("No download URL")) - - self.download(res['ticket_url']) - - getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index ab3097854..0f09731e4 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): __name__ = "IfolderRu" __type__ = "hoster" - __version__ = "0.38" + __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" @@ -18,49 +19,40 @@ class IfolderRu(SimpleHoster): SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')] - NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' - SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' - OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> (не найден|удален) !!!</p>' - SESSION_ID_PATTERN = r'<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 = "([^"]+)";\}' + NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' + SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' + OFFLINE_PATTERN = ur'<p>Файл номер <b>.*?</b> (не найден|удален) !!!</p>' + + SESSION_ID_PATTERN = r'<input type="hidden" name="session" value="(.+?)"' + INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "(.+?)";\}' HIDDEN_INPUT_PATTERN = r'var v = .*?name=\'(.+?)\' value=\'1\'' - LINK_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>' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False - self.chunkLimit = 1 + self.resumeDownload = self.multiDL = bool(self.account) + self.chunkLimit = 1 - def process(self, pyfile): - file_id = re.match(self.__pattern__, pyfile.url).group('ID') - self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True) + def handleFree(self, pyfile): + url = "http://rusfolder.com/%s" % self.info['pattern']['ID'] + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], decode=True) self.getFileInfo() - 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: @@ -68,9 +60,8 @@ class IfolderRu(SimpleHoster): else: self.fail(_("Invalid captcha")) - download_url = re.search(self.LINK_PATTERN, self.html).group(1) - self.correctCaptcha() - self.download(download_url) + 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 2df639ac1..a9bf14c6d 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): __name__ = "JumbofilesCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(\w{12}).*' + __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" @@ -19,7 +20,7 @@ class JumbofilesCom(SimpleHoster): INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' - LINK_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' + LINK_FREE_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' def setup(self): @@ -27,12 +28,10 @@ class JumbofilesCom(SimpleHoster): self.multiDL = True - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - post_data = {"id": ukey, "op": "download3", "rand": ""} + def handleFree(self, pyfile): + post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} html = self.load(self.pyfile.url, post=post_data, decode=True) - url = re.search(self.LINK_PATTERN, html).group(1) - self.download(url) + self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) getInfo = create_getInfo(JumbofilesCom) 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 86c28e93b..fdae65096 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -1,27 +1,27 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin, urlparse +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import _isDirectLink, SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -class Keep2shareCc(SimpleHoster): - __name__ = "Keep2shareCc" +class Keep2ShareCc(SimpleHoster): + __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Keep2share.cc hoster plugin""" + __description__ = """Keep2Share.cc hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("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>' SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' @@ -29,7 +29,8 @@ class Keep2shareCc(SimpleHoster): 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) +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 13cbf4781..99f309d00 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -9,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Kingfiles.net hoster plugin""" __license__ = "GPLv3" @@ -26,7 +27,7 @@ class KingfilesNet(SimpleHoster): RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' - LINK_PATTERN = r'var download_url = \'(.+)\';' + LINK_FREE_PATTERN = r'var download_url = \'(.+)\';' def setup(self): @@ -34,19 +35,19 @@ class KingfilesNet(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): # Click the free user button post_data = {'op' : "download1", 'usr_login' : "", 'id' : self.info['pattern']['ID'], - 'fname' : self.pyfile.name, + 'fname' : pyfile.name, 'referer' : "", 'method_free': "+"} - self.html = self.load(self.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) @@ -59,24 +60,20 @@ class KingfilesNet(SimpleHoster): post_data = {'op' : "download2", 'id' : self.info['pattern']['ID'], 'rand' : rand, - 'referer' : self.pyfile.url, + 'referer' : pyfile.url, 'method_free' : "+", 'method_premium' : "", 'adcopy_response' : response, 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(self.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_PATTERN, self.html) + 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) - - check = self.checkDownload({'html': re.compile("<html>")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + 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 5fcb5e08b..40d792e11 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -7,26 +7,24 @@ # http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html import re - -from urllib import urlencode, urlopen -from urlparse import urljoin +import urlparse from module.common.json_layer import json_loads, json_dumps -from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.network.RequestFactory import getURL from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight -def api_download_info(url): +def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] - post_data = urlencode({'r': json_dumps(json_data)}) - api_rep = urlopen("http://api.letitbit.net/json", data=post_data).read() + api_rep = getURL("http://api.letitbit.net/json", + post={'r': json_dumps(json_data)}) return json_loads(api_rep) def getInfo(urls): for url in urls: - api_rep = api_download_info(url) + api_rep = api_response(url) if api_rep['status'] == 'OK': info = api_rep['data'][0] yield (info['name'], info['size'], 2, url) @@ -37,9 +35,10 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.30" - __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.*' + __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" @@ -57,81 +56,76 @@ class LetitbitNet(SimpleHoster): self.resumeDownload = True - def getFileInfo(self): - api_rep = api_download_info(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): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: self.error(_("ifree_form")) - self.pyfile.size = float(inputs['sssize']) + pyfile.size = float(inputs['sssize']) 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 + self.logDebug("Seconds found", seconds) + m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = m.group(1) + self.logDebug("ReCaptcha control field found", recaptcha_control_field) + self.wait(seconds) - res = self.load("http://letitbit.net/ajax/download3.php", post=" ", 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, "recaptcha_control_field": recaptcha_control_field} + self.logDebug("Post data to send", post_data) - res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) + self.logDebug(res) + if not res: self.invalidCaptcha() + if res == "error_free_download_blocked": self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() + elif res.startswith('['): urls = json_loads(res) + elif res.startswith('http://'): urls = [res] + else: self.error(_("Unknown response - captcha check")) - self.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): + def handlePremium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] + json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) @@ -139,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/LinestorageCom.py b/module/plugins/hoster/LinestorageCom.py deleted file mode 100644 index a3caacc0c..000000000 --- a/module/plugins/hoster/LinestorageCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class LinestorageCom(XFSHoster): - __name__ = "LinestorageCom" - __type__ = "hoster" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?linestorage\.com/\w{12}' - - __description__ = """Linestorage.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "linestorage.com" - - -getInfo = create_getInfo(LinestorageCom) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 90a47d1ac..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,64 +10,48 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.06" + __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 hoster plugin""" + __description__ = """Linksnappy.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - SINGLE_CHUNK_HOSTERS = ('easybytez.com') - - - def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True + SINGLE_CHUNK_HOSTERS = ["easybytez.com"] - def handlePremium(self): - host = self._get_host(self.pyfile.url) - json_params = json_dumps({'link': self.pyfile.url, - 'type': host, + def handlePremium(self, pyfile): + host = self._get_host(pyfile.url) + json_params = json_dumps({'link' : pyfile.url, + 'type' : host, 'username': self.user, 'password': self.account.getAccountData(self.user)['password']}) - r = self.load('http://gen.linksnappy.com/genAPI.php', + + 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")) - self.pyfile.name = j['filename'] - self.link = j['generated'] + pyfile.name = j['filename'] + self.link = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: self.chunkLimit = 1 else: self.setup() - if self.link != self.pyfile.url: - self.logDebug("New URL: " + self.link) - - - def checkFile(self): - super(LinksnappyCom, self).checkFile() - - check = self.checkDownload({"html302": "<title>302 Found</title>"}) - - if check == "html302": - self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) - @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 0a5b26410..2b4202051 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -13,9 +13,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.22" __pattern__ = r'http://(?:www\.)?load\.to/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """ Load.to hoster plugin """ __license__ = "GPLv3" @@ -27,7 +28,7 @@ class LoadTo(SimpleHoster): SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' - LINK_PATTERN = r'<form method="post" action="(.+?)"' + LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"' WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] @@ -38,38 +39,29 @@ class LoadTo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): # Search for Download URL - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + 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}) - - check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")}) - - if check == "404": - self.invalidCaptcha() - self.retry() - elif check == "html": - self.logWarning(_("Downloaded file is an html page, will retry")) - self.retry() + 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 0abc8487d..ef05cd1ea 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -1,14 +1,15 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class LomafileCom(XFSHoster): +class LomafileCom(DeadHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'http://lomafile\.com/\w{12}' + __config__ = [] #@TODO: Remove in 0.4.10 __description__ = """Lomafile.com hoster plugin""" __license__ = "GPLv3" @@ -16,14 +17,4 @@ class LomafileCom(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "lomafile.com" - - NAME_PATTERN = r'<a href="http://lomafile\.com/w{12}/(?P<N>.+?)">' - - OFFLINE_PATTERN = r'>(No such file|Software error:<)' - TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - - CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' - - getInfo = create_getInfo(LomafileCom) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 2c33b57e7..26af8153f 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -11,9 +11,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """LuckyShare.net hoster plugin""" __license__ = "GPLv3" @@ -41,17 +42,18 @@ class LuckyShareNet(SimpleHoster): # TODO: There should be a filesize limit for free downloads # TODO: Some files could not be downloaded in free mode - def handleFree(self): + def handleFree(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + self.logDebug("JSON: " + rep) - json = self.parseJson(rep) - self.wait(int(json['time'])) + json = self.parseJson(rep) + 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) @@ -67,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 782d78ce1..1ba38fdf7 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -1,128 +1,77 @@ # -*- 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.CaptchaService import SolveMedia, ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.82" + __version__ = "0.88" - __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 captcha_key: + response, challenge = recaptcha.challenge(captcha_key) + self.html = self.load(self.pyfile.url, + post={'g-recaptcha-response': response}, + decode=True) - if self.account: - self.handlePremium() - else: - self.handleFree() - elif result == 1: - self.offline() - else: - self.multiDL = True - self.download(self.link, disposition=True) + def handleFree(self, pyfile): + self.handleCaptcha() - def handleFree(self): 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 fc6724dc7..aa7755af4 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,18 +1,20 @@ # -*- coding: utf-8 -*- +import array +import os +# import pycurl import random import re -from array import array from base64 import standard_b64decode -from os import remove 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 +from module.utils import decode, fs_decode, fs_encode + ############################ General errors ################################### # EINTERNAL (-1): An internal error has occurred. Please submit a bug report, detailing the exact circumstances in which this error occurred @@ -46,15 +48,17 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.26" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#!(?P<ID>[\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" - __authors__ = [("RaNaN", "ranan@pyload.org")] + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + - API_URL = "https://g.api.mega.co.nz/cs" + API_URL = "https://eu.api.mega.co.nz/cs" FILE_SUFFIX = ".crypted" @@ -65,15 +69,20 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - a = array("I", key) - key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) - return key_array + a = array.array("I", self.b64_decode(key)) + + k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) + iv = a[4:6] + array.array("I", (0, 0)) + meta_mac = a[6:8] + return k, iv, meta_mac - def callApi(self, **kwargs): + + def api_response(self, **kwargs): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ + # generate a session id, no idea where to obtain elsewhere - uid = random.randint(10 << 9, 10 ** 10) + uid = random.random.randint(10 << 9, 10 ** 10) res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs])) self.logDebug("Api Response: " + res) @@ -81,9 +90,11 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): - cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) - attr = cbc.decrypt(self.b64_decode(data)) - self.logDebug("Decrypted Attr: " + attr) + k, iv, meta_mac = self.getCipherKey(key) + cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) + attr = decode(cbc.decrypt(self.b64_decode(data))) + + self.logDebug("Decrypted Attr: %s" % attr) if not attr.startswith("MEGA"): self.fail(_("Decryption failed")) @@ -95,76 +106,111 @@ class MegaCoNz(Hoster): """ Decrypts the file at lastDownload` """ # upper 64 bit of counter start - n = key[16:24] + n = self.b64_decode(key)[16:24] # convert counter to long and shift bytes - ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) - cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) + k, iv, meta_mac = self.getCipherKey(key) + ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = AES.new(k, AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") + self.pyfile.setProgress(0) - file_crypted = self.lastDownload + file_crypted = fs_encode(self.lastDownload) file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] try: - f = open(file_crypted, "rb") + f = open(file_crypted, "rb") df = open(file_decrypted, "wb") + except IOError, e: - self.fail(str(e)) + self.fail(e) - # TODO: calculate CBC-MAC for checksum + chunk_size = 2 ** 15 # buffer size, 32k + # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - size = 2 ** 15 # buffer size, 32k - while True: - buf = f.read(size) + chunks = os.path.getsize(file_crypted) / chunk_size + 1 + for i in xrange(chunks): + buf = f.read(chunk_size) if not buf: break - df.write(cipher.decrypt(buf)) + chunk = cipher.decrypt(buf) + df.write(chunk) + + self.pyfile.setProgress(int((100.0 / chunks) * i)) + + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array.array("I", block) + + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) + + self.pyfile.setProgress(100) f.close() df.close() - remove(file_crypted) - self.lastDownload = file_decrypted + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail(_("Checksum mismatch")) + os.remove(file_crypted) + self.lastDownload = fs_decode(file_decrypted) - def process(self, pyfile): - key = None - # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group('ID') - if "!" in node: - node, key = node.split("!", 1) + def checkError(self, code): + ecode = abs(code) + + if ecode in (9, 16, 21): + self.offline() + + elif ecode in (3, 13, 17, 18, 19): + self.tempOffline() + + elif ecode in (1, 4, 6, 10, 15, 21): + self.retry(5, 30, _("Error code: [%s]") % -ecode) - self.logDebug("ID: %s | Key: %s" % (node, key)) + else: + self.fail(_("Error code: [%s]") % -ecode) - if not key: - self.fail(_("No file key provided in the URL")) + + def process(self, pyfile): + pattern = re.match(self.__pattern__, pyfile.url).groupdict() + id = pattern['ID'] + key = pattern['KEY'] + public = pattern['TYPE'] == '' + + self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) # g is for requesting a download url # this is similar to the calls in the mega js app, documentation is very bad - dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] + if public: + mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] + else: + mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] - if "e" in dl: - e = dl['e'] - # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later - if e == -18: - self.retry() - else: - self.fail(_("Error code:") + e) + if isinstance(mega, int): + self.checkError(mega) + elif "e" in mega: + self.checkError(mega['e']) - # TODO: map other error codes, e.g - # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) - - key = self.b64_decode(key) - attr = self.decryptAttr(dl['at'], key) + attr = self.decryptAttr(mega['at'], key) pyfile.name = attr['n'] + self.FILE_SUFFIX + pyfile.size = mega['s'] + + # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") - self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + self.download(mega['g']) - self.download(dl['g']) self.decryptFile(key) # Everything is finished and final name can be set diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index ebef7969c..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,11 +10,12 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.47" - __pattern__ = r'^https?://(?:w{3}\d+\.mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[^/]+/.+$' + __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 hoster plugin""" + __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] @@ -23,26 +23,7 @@ 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): - if not self.connectToApi(): - self.exitOnFail("Unable to connect to Mega-debrid.eu") - - self.link = self.debridLink(self.pyfile.url) - self.logDebug("New URL: " + self.link) - - filename = self.getFilename(self.link) - if filename != "": - self.pyfile.name = filename - - - def connectToApi(self): + def api_load(self): """ Connexion to the mega-debrid API Return True if succeed @@ -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 37732ade6..e17dd4730 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -1,16 +1,16 @@ # -*- 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 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"]) @@ -22,9 +22,10 @@ def getInfo(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.55" + __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" @@ -34,14 +35,15 @@ 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_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' + 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áš' @@ -49,23 +51,17 @@ class MegaRapidCz(SimpleHoster): self.chunkLimit = 1 - def handlePremium(self): - try: - self.html = self.load(self.pyfile.url, decode=True) - except BadHeader, e: - self.account.relogin(self.user) - self.retry(wait_time=60, reason=str(e)) - - m = re.search(self.LINK_PATTERN, self.html) + 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/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 4034f7d32..10a2eb025 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -10,9 +10,9 @@ from module.plugins.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): __name__ = "MegacrypterCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(https?://\w{0,10}\.?megacrypter\.com/[\w!-]+)' + __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' __description__ = """Megacrypter.com decrypter plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class MegacrypterCom(MegaCoNz): FILE_SUFFIX = ".crypted" - def callApi(self, **kwargs): + def api_response(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.logDebug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) @@ -33,13 +33,13 @@ class MegacrypterCom(MegaCoNz): def process(self, pyfile): # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(1) + node = re.match(self.__pattern__, pyfile.url).group(0) # get Mega.co.nz link info - info = self.callApi(link=node, m="info") + info = self.api_response(link=node, m="info") # get crypted file URL - dl = self.callApi(link=node, m="dl") + dl = self.api_response(link=node, m="dl") # TODO: map error codes, implement password protection # if info['pass'] is True: @@ -50,6 +50,7 @@ class MegacrypterCom(MegaCoNz): pyfile.name = info['name'] + self.FILE_SUFFIX self.download(dl['url']) + self.decryptFile(key) # Everything is finished and final name can be set 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 9d8441c6f..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 @@ -10,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.27" + __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' @@ -39,11 +39,11 @@ class MegasharesCom(SimpleHoster): self.multiDL = self.premium - def handlePremium(self): + def handlePremium(self, pyfile): self.handleDownload(True) - def handleFree(self): + def handleFree(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) @@ -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 new file mode 100644 index 000000000..bcd7c6237 --- /dev/null +++ b/module/plugins/hoster/MultihostersCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hoster.ZeveraCom import ZeveraCom + + +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 62acab84c..bbb77f525 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.40" - __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+).*' + __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" @@ -21,47 +21,34 @@ class MultishareCz(SimpleHoster): SIZE_REPLACEMENTS = [(' ', '')] - MULTI_HOSTER = True + CHECK_TRAFFIC = True + MULTI_HOSTER = True INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.info['pattern']['ID']) - + def handleFree(self, pyfile): + self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) - def handlePremium(self): - if not self.checkCredit(): - self.logWarning(_("Not enough credit left to download file")) - self.resetAccount() - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID']) + def handlePremium(self, pyfile): + self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) - def handleMulti(self): - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) + def handleMulti(self, pyfile): + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True) self.checkInfo() - if not self.checkCredit(): + if not self.checkTrafficLeft(): self.fail(_("Not enough credit left to download file")) - url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) - params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} - - self.logDebug(url, params) - - self.link = True - self.download(url, get=params) - - - def checkCredit(self): - self.acc_info = self.account.getAccountInfo(self.user, True) - - self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) - - return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] + self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), + get={'u_ID' : self.acc_info['u_ID'], + 'u_hash': self.acc_info['u_hash'], + 'link' : pyfile.url}, + disposition=True) getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index 7471086fb..662638843 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -9,34 +9,31 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + __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 hoster plugin""" + __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True + self.chunkLimit = -1 - def handlePremium(self): - self.logDebug("Original URL: %s" % self.pyfile.url) - - page = self.load('http://myfastfile.com/api.php', + def handlePremium(self, pyfile): + self.html = self.load('http://myfastfile.com/api.php', get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], - 'link': self.pyfile.url}) - self.logDebug("JSON data: " + page) - page = json_loads(page) - if page['status'] != 'ok': + 'link': pyfile.url}) + self.logDebug("JSON data: " + self.html) + + self.html = json_loads(self.html) + if self.html['status'] != 'ok': self.fail(_("Unable to unrestrict link")) - self.link = page['link'] - if self.link != self.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 21d4e3e3d..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 @@ -10,9 +10,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): __name__ = "NarodRu" __type__ = "hoster" - __version__ = "0.11" + __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" @@ -28,33 +29,37 @@ class NarodRu(SimpleHoster): (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' - LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' + LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' - def handleFree(self): + 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: self.error(_("Captcha")) + post_data = {"action": "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) - m = re.search(self.LINK_PATTERN, self.html) + self.html = self.load(pyfile.url, post=post_data, decode=True) + + 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 + elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: self.invalidCaptcha() + else: self.error(_("Download link")) + else: self.fail(_("No valid captcha code entered")) - self.download(url) - getInfo = create_getInfo(NarodRu) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index f5c5ee802..82f5c22fb 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,294 +1,21 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from urlparse import urljoin -from time import sleep, 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.download_api_data() - - 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 download_api_data(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: - sleep(0.2) - self.download_api_data(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 new file mode 100644 index 000000000..6696d15d3 --- /dev/null +++ b/module/plugins/hoster/NitroflareCom.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class NitroflareCom(SimpleHoster): + __name__ = "NitroflareCom" + __type__ = "hoster" + __version__ = "0.12" + + __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + + __description__ = """Nitroflare.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com"), + ("Stickell", "l.stickell@yahoo.it")] + + # URL_REPLACEMENTS = [("http://", "https://")] + + INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File doesn\'t exist' + + LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + + RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" + PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' + WAIT_PATTERN = r'You have to wait (\d+ minutes)' + # ERROR_PATTERN = r'downloading is not possible' + + + def handleFree(self, pyfile): + # used here to load the cookies which will be required later + self.load(pyfile.url, post={'goToFreePage': ""}) + + self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) + + self.checkErrors() + + try: + js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") + var_time = re.search("var time = (\\d+);", js_file) + wait_time = int(var_time.groups()[0]) + + except Exception: + wait_time = 60 + + self.wait(wait_time) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + self.html = self.load("http://nitroflare.com/ajax/freeDownload.php", + post={'method' : "fetchDownload", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + if "The captcha wasn't entered correctly" in self.html: + self.logWarning("The captcha wasn't entered correctly") + return + + if "You have to fill the captcha" in self.html: + self.logWarning("Captcha unfilled") + return + + return super(NitroflareCom, self).handleFree(pyfile) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py new file mode 100644 index 000000000..c3313c525 --- /dev/null +++ b/module/plugins/hoster/NoPremiumPl.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class NoPremiumPl(MultiHoster): + __name__ = "NoPremiumPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://direct\.nopremium\.pl.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + + __description__ = """NoPremium.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] + + + API_URL = "http://crypt.nopremium.pl" + + API_QUERY = {'site' : "nopremium", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(NoPremiumPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handleFree(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("runFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed["errno"] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + else: + # error code isn't yet added to plugin + self.fail( + parsed["errstring"] + or _("Unknown error (code: %s)") % parsed["errno"] + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + _("Download from %s is possible only using NoPremium.pl website \ + directly") % parsed["hosting"]) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/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 d2ae08954..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.05" + __version__ = "0.09" - __pattern__ = r'http://(?:www\.)?nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)\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" @@ -25,9 +26,9 @@ class NowDownloadSx(SimpleHoster): TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - LINK_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' + LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' - NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] + NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')] def setup(self): @@ -36,7 +37,7 @@ class NowDownloadSx(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) if tokenlink is None or continuelink is None: @@ -54,11 +55,11 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.LINK_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 b59bd79da..477379597 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,16 +8,17 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.12" - __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|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" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.at/video/\g<ID>')] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.sx/video/\g<ID>')] NAME_PATTERN = r'<h4>(?P<N>.+?)<' OFFLINE_PATTERN = r'>This file no longer exists' @@ -31,14 +32,14 @@ class NowVideoSx(SimpleHoster): self.multiDL = True - def handleFree(self): - self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['pattern']['ID']}) + def handleFree(self, pyfile): + self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Free download link not found")) - self.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..cfc448ff0 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,9 +13,9 @@ from module.plugins.internal.CaptchaService import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.32" - __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 f0e16a101..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.75" + __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): @@ -38,7 +40,7 @@ class OneFichierCom(SimpleHoster): self.resumeDownload = True - def handleFree(self): + def handleFree(self, pyfile): id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) @@ -53,8 +55,8 @@ class OneFichierCom(SimpleHoster): self.download(url, post=inputs) - def handlePremium(self): - return self.handleFree() + def handlePremium(self, 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..c31b5b997 --- /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.01" + + __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 54e3e73fb..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,70 +11,41 @@ from module.utils import parseFileSize class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.11" - __pattern__ = r'https?://.*overload\.me.*' + __pattern__ = r'https?://.*overload\.me/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Over-Load.me hoster plugin""" + __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 - self.resumeDownload = True + self.chunkLimit = 5 - def handlePremium(self): - data = self.account.getAccountData(self.user) + def handlePremium(self, pyfile): + https = "https" if self.getConfig('ssl') else "http" + data = self.account.getAccountData(self.user) + page = self.load(https + "://api.over-load.me/getdownload.php", + get={'auth': data['password'], + 'link': pyfile.url}) - page = self.load("https://api.over-load.me/getdownload.php", - get={"auth": data['password'], "link": self.pyfile.url}) data = json_loads(page) - self.logDebug("Returned Data: %s" % data) + self.logDebug(data) if data['error'] == 1: self.logWarning(data['msg']) self.tempOffline() else: - if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['filename']: - self.pyfile.name = data['filename'] - self.pyfile.size = parseFileSize(data['filesize']) - self.link = data['downloadlink'] - - if self.getConfig("https"): - self.link = self.link.replace("http://", "https://") - else: - self.link = self.link.replace("https://", "http://") - - if self.link != self.pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'): - # only use when name wasn't already set - self.pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - super(OverLoadMe, self).checkFile() - - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) + if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) - if check == "error": - # usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link.")) + http_repl = ["http://", "https://"] + 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 b6194ef73..ab5016673 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -2,9 +2,7 @@ from __future__ import with_statement -from os import remove -from os.path import exists -from urllib import quote +import os from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo from module.utils import fs_encode @@ -13,67 +11,46 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.22" - __pattern__ = r'https?://(?:www\.)?premium\.to/.*' + __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Premium.to hoster plugin""" + __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] - def setup(self): - self.resumeDownload = True - self.chunkLimit = 1 + CHECK_TRAFFIC = True - def handlePremium(self): - tra = self.getTraffic() - + def handlePremium(self, pyfile): #raise timeout to 2min - self.req.setOption("timeout", 120) - - self.link = True self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, - 'link' : quote(self.pyfile.url, "")}, + 'link' : pyfile.url}, disposition=True) - def checkFile(self): - super(PremiumTo, self).checkFile() - - check = self.checkDownload({"nopremium": "No premium account available"}) - - if check == "nopremium": + 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) - - trb = self.getTraffic() - self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (self.pyfile.size, tra - trb, trb)) + os.remove(file) if err: self.fail(err) - - def getTraffic(self): - try: - api_r = self.load("http://premium.to/api/straffic.php", - get={'username': self.account.username, 'password': self.account.password}) - traffic = sum(map(int, api_r.split(';'))) - except: - traffic = 0 - return traffic + 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 07536062f..3227fb001 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,25 +7,26 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __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 hoster plugin""" + __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def handlePremium(self): + def handlePremium(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) - self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash + pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash # Correction for automatic assigned filename: Removing html at end if needed suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] - temp = self.pyfile.name.split('.') + temp = pyfile.name.split('.') if temp.pop() in suffix_to_remove: - self.pyfile.name = ".".join(temp) + pyfile.name = ".".join(temp) # Get account data user, data = self.account.selectAccount() @@ -35,7 +36,7 @@ class PremiumizeMe(MultiHoster): get={'method' : "directdownloadlink", 'params[login]': user, 'params[pass]' : data['password'], - 'params[link]' : self.pyfile.url})) + 'params[link]' : pyfile.url})) # Check status and decide what to do status = data['status'] diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index af38c4e15..3815a1a24 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -8,23 +8,24 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __version__ = "0.12" + __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="([^"]*)" />' - LINK_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' + CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />' + LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -32,14 +33,14 @@ class PromptfileCom(SimpleHoster): chash = m.group(1) self.logDebug("Read chash %s" % chash) # continue to stage2 - self.html = self.load(self.pyfile.url, decode=True, post={'chash': chash}) + self.html = self.load(pyfile.url, decode=True, post={'chash': chash}) # STAGE 2: get the direct link - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + 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 new file mode 100644 index 000000000..7f4b7b6cc --- /dev/null +++ b/module/plugins/hoster/PutdriveCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hoster.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 85a4dee39..1e0750b88 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import FOLLOWLOCATION - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" - __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.*' + __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'] @@ -45,34 +45,34 @@ class QuickshareCz(SimpleHoster): self.premium = False if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) - if check == "err": + if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) - def handleFree(self): + def handleFree(self, pyfile): # get download url download_url = '%s/download.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) self.logDebug("FREE URL1:" + download_url, data) - self.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") @@ -81,11 +81,8 @@ class QuickshareCz(SimpleHoster): else: self.fail(_("Error %d") % m.group(1)) - # download file - self.download(download_url) - - def handlePremium(self): + def handlePremium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.download(download_url, get=data) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index d6a67beb3..710faf25c 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -9,30 +9,29 @@ from module.common.json_layer import json_loads class RPNetBiz(MultiHoster): __name__ = "RPNetBiz" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" - __description__ = """RPNet.biz hoster plugin""" - __license__ = "GPLv3" + __pattern__ = r'https?://.+rpnet\.biz' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __pattern__ = r'https?://.*rpnet\.biz' + __description__ = """RPNet.biz multi-hoster plugin""" + __license__ = "GPLv3" __authors__ = [("Dman", "dmanugm@gmail.com")] def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True + self.chunkLimit = -1 - def handlePremium(self): + def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.logDebug("Original URL: %s" % self.pyfile.url) # Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", get={"username": user, "password": data['password'], - "action": "generate", - "links": self.pyfile.url}) + "action" : "generate", + "links" : pyfile.url}) self.logDebug("JSON data: %s" % res) link_status = json_loads(res)['links'][0] # get the first link... since we only queried one diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py new file mode 100644 index 000000000..50804e8cd --- /dev/null +++ b/module/plugins/hoster/RapideoPl.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class RapideoPl(MultiHoster): + __name__ = "RapideoPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + + __description__ = """Rapideo.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] + + + API_URL = "http://enc.rapideo.pl" + + API_QUERY = {'site' : "newrd", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(RapideoPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handleFree(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("RunFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("Loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed["errno"] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + else: + # error code isn't yet added to plugin + self.fail( + parsed["errstring"] + or _("Unknown error (code: %s)") % parsed["errno"] + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + _("Download from %s is possible only using Rapideo.pl website \ + directly") % parsed["hosting"]) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 14d62ee74..0bbaed57f 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class RapidfileshareNet(XFSHoster): __name__ = "RapidfileshareNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' @@ -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>' @@ -24,8 +22,4 @@ class RapidfileshareNet(XFSHoster): TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - def handlePremium(self): - self.fail(_("Premium download not implemented")) - - getInfo = create_getInfo(RapidfileshareNet) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index cc11fa7c7..ae74e8a63 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -1,12 +1,10 @@ # -*- 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.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -14,9 +12,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.33" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapidgator.net hoster plugin""" __license__ = "GPLv3" @@ -30,24 +29,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)' - LINK_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[^"\']*)' + PREMIUM_ONLY_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' + ERROR_PATTERN = r'You have reached your (?:daily|hourly) downloads limit' + WAIT_PATTERN = r'(Delay between downloads must be not less than|Try again in).+' + + LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' + + RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' + ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']+)' SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"' def setup(self): if self.account: - self.sid = self.account.getAccountData(self.user).get('SID', None) + self.sid = self.account.getAccountInfo(self.user).get('sid', None) else: self.sid = None @@ -85,51 +86,51 @@ class RapidgatorNet(SimpleHoster): self.retry(wait_time=60) - def handlePremium(self): - #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) + def handlePremium(self, pyfile): self.api_data = self.api_response('info') self.api_data['md5'] = self.api_data['hash'] - self.pyfile.name = self.api_data['filename'] - self.pyfile.size = self.api_data['size'] - url = self.api_response('download')['url'] - self.download(url) + pyfile.name = self.api_data['filename'] + pyfile.size = self.api_data['size'] - def handleFree(self): - self.checkFree() + self.link = self.api_response('download')['url'] + + def handleFree(self, pyfile): jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) self.logDebug(jsvars) - self.req.http.lastURL = self.pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) - self.wait(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 = self.pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) for _i in xrange(5): - m = re.search(self.LINK_PATTERN, self.html) + 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, @@ -143,49 +144,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 a3b2cffcd..fcccbbebc 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -1,9 +1,8 @@ # -*- 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 @@ -13,19 +12,20 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.08" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Rapidu.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("prOq", None)] + __authors__ = [("prOq", "")] 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">' @@ -34,47 +34,49 @@ class RapiduNet(SimpleHoster): def setup(self): self.resumeDownload = True - self.multiDL = True - self.limitDL = 0 if self.premium else 2 + self.multiDL = self.premium - def handleFree(self): - self.req.http.lastURL = self.pyfile.url - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + def handleFree(self, pyfile): + self.req.http.lastURL = pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getLoadTimeToDownload", {'_go': None}) + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getLoadTimeToDownload"}, + post={'_go': ""}, + decode=True) if str(jsvars['timeToDownload']) is "stop": - t = (24 * 60 * 60) - (int(time()) % (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 + 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) - 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) - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getCheckCaptcha", - {'_go' : None, - 'captcha1': challenge, - 'captcha2': response, - 'fileId' : self.info['ID']}) - if jsvars['message'] == 'success': - self.download(jsvars['url']) - break + if jsvars['message'] == 'success': + self.link = jsvars['url'] - def getJsonResponse(self, url, post_data): - res = self.load(url, post=post_data, decode=True) + def getJsonResponse(self, *args, **kwargs): + res = self.load(*args, **kwargs) if not res.startswith('{'): self.retry() - self.logDebug(url, res) + self.logDebug(res) return json_loads(res) 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 0de78226d..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 quote, 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,36 +12,26 @@ from module.utils import parseFileSize class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.67" - __pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*' + __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 hoster plugin""" + __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 - self.resumeDownload = True + self.chunkLimit = 3 - def handlePremium(self): + def handlePremium(self, pyfile): data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", get={'lang' : "en", - 'link' : quote(self.pyfile.url, ""), + 'link' : pyfile.url, 'password': self.getPassword(), - 'time' : int(time() * 1000)})) + 'time' : int(time.time() * 1000)})) self.logDebug("Returned Data: %s" % data) @@ -54,33 +42,15 @@ class RealdebridCom(MultiHoster): self.logWarning(data['message']) self.tempOffline() else: - if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['file_name']: - self.pyfile.name = data['file_name'] - self.pyfile.size = parseFileSize(data['file_size']) + 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("https"): + if self.getConfig('ssl'): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != self.pyfile.url: - self.logDebug("New URL: %s" % self.link) - - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'): - #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) - - - def checkFile(self): - super(RealdebridCom, self).checkFile() - - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) - - if check == "error": - #usual this download can safely be retried - self.retry(wait_time=60, reason=_("An error occured while generating link")) - 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 b1d0c6e93..9c07364ec 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urllib import quote, unquote +import urllib from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo @@ -8,34 +8,21 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.21" - __pattern__ = r'https?://.*rehost\.to\..*' + __pattern__ = r'https?://.*rehost\.to\..+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Rehost.com hoster plugin""" + __description__ = """Rehost.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def getFilename(self, url): - return unquote(url.rsplit("/", 1)[1]) - - - def setup(self): - self.chunkLimit = 1 - self.resumeDownload = True - - - def handlePremium(self): - data = self.account.getAccountInfo(self.user) - long_ses = data['long_ses'] - - #raise timeout to 2min - self.req.setOption("timeout", 120) - - self.link = True + def handlePremium(self, pyfile): self.download("http://rehost.to/process_download.php", - get={'user': "cookie", 'pass': long_ses, 'dl': quote(self.pyfile.url, "")}, + get={'user': "cookie", + 'pass': self.account.getAccountInfo(self.user)['session'], + 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index ed171895e..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.02" + __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_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): @@ -39,23 +43,16 @@ class RemixshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): 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/RyushareCom.py b/module/plugins/hoster/RyushareCom.py deleted file mode 100644 index 0964c51fc..000000000 --- a/module/plugins/hoster/RyushareCom.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Test links: -# http://ryushare.com/cl0jy8ric2js/random.bin - -import re - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -from module.plugins.internal.CaptchaService import SolveMedia - - -class RyushareCom(XFSHoster): - __name__ = "RyushareCom" - __type__ = "hoster" - __version__ = "0.20" - - __pattern__ = r'http://(?:www\.)?ryushare\.com/\w+' - - __description__ = """Ryushare.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("quareevo", "quareevo@arcor.de")] - - - HOSTER_DOMAIN = "ryushare.com" - - WAIT_PATTERN = r'You have to wait ((?P<H>\d+) hour[s]?, )?((?P<M>\d+) minute[s], )?(?P<S>\d+) second[s]' - - LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' - - - def getDownloadLink(self): - retry = False - self.html = self.load(self.pyfile.url) - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - if "method_premium" in inputs: - del inputs['method_premium'] - - self.html = self.load(self.pyfile.url, post=inputs) - action, inputs = self.parseHtmlForm('F1') - - self.setWait(65) - # Wait 1 hour - if "You have reached the download-limit" in self.html: - self.setWait(1 * 60 * 60, True) - retry = True - - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait = m.groupdict(0) - waittime = int(wait['H']) * 60 * 60 + int(wait['M']) * 60 + int(wait['S']) - self.setWait(waittime, True) - retry = True - - self.wait() - if retry: - self.retry() - - for _i in xrange(5): - solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - - inputs['adcopy_challenge'] = challenge - inputs['adcopy_response'] = response - - self.html = self.load(self.pyfile.url, post=inputs) - if "WRONG CAPTCHA" in self.html: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("You have entered 5 invalid captcha codes")) - - if "Click here to download" in self.html: - return re.search(r'<a href="([^"]+)">Click here to download</a>', self.html).group(1) - - -getInfo = create_getInfo(RyushareCom) 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/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py deleted file mode 100644 index 637098b88..000000000 --- a/module/plugins/hoster/SendmywayCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class SendmywayCom(XFSHoster): - __name__ = "SendmywayCom" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'http://(?:www\.)?sendmyway\.com/\w{12}' - - __description__ = """SendMyWay.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "sendmyway.com" - - -getInfo = create_getInfo(SendmywayCom) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 12f966e31..0ab20949d 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -8,9 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): __name__ = "SendspaceCom" __type__ = "hoster" - __version__ = "0.16" + __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,20 +22,20 @@ 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_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): + def handleFree(self, pyfile): params = {} for _i in xrange(3): - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) 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) @@ -51,11 +52,9 @@ class SendspaceCom(SimpleHoster): params = {'download': "Regular Download"} self.logDebug(params) - self.html = self.load(self.pyfile.url, post=params) + self.html = self.load(pyfile.url, post=params) 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 4634917ad..7a276c1fe 100644 --- a/module/plugins/hoster/Share4webCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -4,8 +4,8 @@ from module.plugins.hoster.UnibytesCom import UnibytesCom from module.plugins.internal.SimpleHoster import create_getInfo -class Share4webCom(UnibytesCom): - __name__ = "Share4webCom" +class Share4WebCom(UnibytesCom): + __name__ = "Share4WebCom" __type__ = "hoster" __version__ = "0.11" @@ -19,4 +19,4 @@ class Share4webCom(UnibytesCom): HOSTER_DOMAIN = "share4web.com" -getInfo = create_getInfo(UnibytesCom) +getInfo = create_getInfo(Share4WebCom) 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 dc3d5093c..a260f39f7 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -1,10 +1,9 @@ # -*- 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 @@ -14,9 +13,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.50" __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" @@ -28,32 +28,36 @@ class ShareonlineBiz(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g<ID>")] + CHECK_TRAFFIC = True + RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" - ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' + ERROR_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' @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} + def apiInfo(cls, url): + info = super(ShareonlineBiz, cls).apiInfo(url) if url: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() - field = getURL("http://api.share-online.biz/linkcheck.php", - get={'md5': "1"}, - post={'links': info['pattern']['ID']}, + get={'md5' : "1", + 'links': re.match(cls.__pattern__, url).group("ID")}, decode=True).split(";") - if field[1] == "OK": - info['fileid'] = field[0] - info['status'] = 2 - info['name'] = field[2] - info['size'] = field[3] #: in bytes - info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 + try: + if field[1] == "OK": + info['fileid'] = field[0] + info['status'] = 2 + info['name'] = field[2] + info['size'] = field[3] #: in bytes + info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 + + elif field[1] in ("DELETED", "NOT FOUND"): + info['status'] = 1 - elif field[1] in ("DELETED", "NOT FOUND"): - info['status'] = 1 + except IndexError: + pass return info @@ -67,12 +71,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}) @@ -86,34 +90,27 @@ class ShareonlineBiz(SimpleHoster): self.fail(_("No valid captcha solution received")) - def handleFree(self): - self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff - + def handleFree(self, pyfile): self.wait(3) - self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) + self.html = self.load("%s/free/" % pyfile.url, + post={'dl_free': "1", 'choice': "free"}, + decode=True) self.checkErrors() res = self.handleCaptcha() + self.link = res.decode('base64') - 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): - super(ShareonlineBiz, self).checkFile() - check = self.checkDownload({ - 'cookie': re.compile(r'<div id="dl_failure"'), - 'fail' : re.compile(r"<title>Share-Online") - }) + def checkFile(self, rules={}): + check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), + 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": self.invalidCaptcha() @@ -123,13 +120,15 @@ class ShareonlineBiz(SimpleHoster): self.invalidCaptcha() self.retry(5, 5 * 60, _("Download failed")) + return super(ShareonlineBiz, self).checkFile(rules) - def handlePremium(self): #: should be working better loading (account) api internally - self.account.getAccountInfo(self.user, True) + def handlePremium(self, pyfile): #: should be working better loading (account) api internally html = self.load("http://api.share-online.biz/account.php", - {"username": self.user, "password": self.account.accounts[self.user]['password'], - "act": "download", "lid": self.info['fileid']}) + get={'username': self.user, + 'password': self.account.getAccountData(self.user)['password'], + 'act' : "download", + 'lid' : self.info['fileid']}) self.api_data = dlinfo = {} @@ -142,16 +141,15 @@ class ShareonlineBiz(SimpleHoster): if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo['name'] - self.pyfile.size = int(dlinfo['size']) + 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): @@ -163,8 +161,8 @@ class ShareonlineBiz(SimpleHoster): errmsg = m.group(1).lower() try: - self.logError(errmsg, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) - except: + self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) + 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 ccf4bcda5..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 @@ -10,9 +9,9 @@ from module.plugins.Hoster import Hoster class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" - __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?\w+' + __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' __description__ = """Shareplace.com hoster plugin""" __license__ = "GPLv3" @@ -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 b31f0e450..689223322 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -8,7 +8,8 @@ class ShragleCom(DeadHoster): __type__ = "hoster" __version__ = "0.22" - __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.*?)/' + __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 87ccb317e..b3f52bc8c 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -2,76 +2,79 @@ import re -from datetime import datetime, timedelta - from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.SimpleHoster import secondsToMidnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.08" - __pattern__ = r'https?://.*(simply-premium)\.com' + __pattern__ = r'https?://.+simply-premium\.com' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] - __description__ = """Simply-Premium.com hoster plugin""" + __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def setup(self): - self.chunkLimit = 16 - self.resumeDownload = False + self.chunkLimit = 16 - def handlePremium(self): - 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), "Daily limit for this host reached") + 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 b4be77031..aae71d983 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -2,62 +2,48 @@ 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.14" + __version__ = "0.17" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php/*' + __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 hoster plugin""" + __description__ = """Simply-debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def setup(self): - self.resumeDownload = True - self.multiDL = True - self.chunkLimit = 1 - - - def handlePremium(self): + def handlePremium(self, pyfile): #fix the links for simply-debrid.com! - self.link = self.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.logDebug("New URL: %s" % self.link) - - if not re.match(self.__pattern__, self.link): - page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password']) - 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.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.setWait(5) - self.wait() + self.link = self.html + self.wait(5) - def checkFile(self): - super(SimplydebridCom, self).checkFile() - check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"}) + def checkFile(self, rules={}): + if self.checkDownload({"error": "No address associated with hostname"}): + self.retry(24, 3 * 60, _("Bad file downloaded")) - if check == "bad1" or check == "bad2": - self.retry(24, 3 * 60, "Bad file downloaded") + 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..3b9748fb6 --- /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.01" + + __pattern__ = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' + + __description__ = """Sizedrive.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'>Nome:</b> (?P<N>.+?)<' + SIZE_PATTERN = r'>Tamanho:</b>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'ARQUIVO DELATADO POR' + + + def setup(self): + self.resumeDownload = False + self.multiDL = False + self.chunkLimit = 1 + + + def 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 new file mode 100644 index 000000000..9ae12f145 --- /dev/null +++ b/module/plugins/hoster/SmoozedCom.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class SmoozedCom(MultiHoster): + __name__ = "SmoozedCom" + __type__ = "hoster" + __version__ = "0.05" + + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + + __description__ = """Smoozed.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + 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 + + # Correction for automatic assigned filename: Removing html at end if needed + suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] + temp = pyfile.name.split('.') + + if temp.pop() in suffix_to_remove: + pyfile.name = ".".join(temp) + + # Check the link + get_data = {'session_key': self.account.getAccountInfo(self.user)['session'], + 'url' : pyfile.url} + + data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + + if data["state"] != "ok": + self.fail(data["message"]) + + if data["data"].get("state", "ok") != "ok": + if data["data"] == "Offline": + self.offline() + else: + self.fail(data["data"]["message"]) + + pyfile.name = data["data"]["name"] + pyfile.size = int(data["data"]["size"]) + + # Start the download + header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) + + if not "location" in header: + self.fail(_("Unable to initialize download")) + else: + self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] + + + def checkFile(self, rules={}): + if self.checkDownload({'error': '{"state":"error"}', + 'retry': '{"state":"retry"}'}): + self.fail(_("Error response received")) + + return super(SmoozedCom, self).checkFile(rules) diff --git a/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 4665dff05..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 c04d8b281..cd6d65082 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -8,7 +8,8 @@ class SpeedfileCz(DeadHoster): __type__ = "hoster" __version__ = "0.32" - __pattern__ = r'http://(?:www\.)?speedfile\.cz/.*' + __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 fa54d6060..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.03" + __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" @@ -27,7 +27,7 @@ class SpeedyshareCom(SimpleHoster): OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' - LINK_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' + LINK_FREE_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' def setup(self): @@ -35,17 +35,10 @@ class SpeedyshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + 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) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + 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 6813271d0..97bed8109 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -25,17 +25,17 @@ class StreamCz(Hoster): __type__ = "hoster" __version__ = "0.20" - __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' + __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+' __description__ = """Stream.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-([^"]+)" />' + 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 4f854a99d..0f8c08ad9 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class StreamcloudEu(XFSHoster): __name__ = "StreamcloudEu" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}' @@ -17,14 +17,12 @@ class StreamcloudEu(XFSHoster): __authors__ = [("seoester", "seoester@googlemail.com")] - HOSTER_DOMAIN = "streamcloud.eu" - - LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud\.eu:?\d*/.*/video\.(mp4|flv))",' + WAIT_PATTERN = r'var count = (\d+)' def setup(self): - self.multiDL = True - self.chunkLimit = 1 + self.multiDL = True + self.chunkLimit = 1 self.resumeDownload = self.premium diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 258ec7d3e..7995bd0c0 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -1,13 +1,13 @@ # -*- 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 @@ -17,9 +17,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """ Turbobit.net hoster plugin """ __license__ = "GPLv3" @@ -35,26 +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/[^"\']+)' - LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'(/download/redirect/[^"\']+)' - CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' + LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' - def handleFree(self): - self.url = "http://turbobit.net/download/free/%s" % self.info['pattern']['ID'] - self.html = self.load(self.url, ref=True, decode=True) + def handleFree(self, pyfile): + self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID'], + decode=True) rtUpdate = self.getRtUpdate() self.solveCaptcha() - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.url = self.getDownloadUrl(rtUpdate) - self.wait() - self.html = self.load(self.url) - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) - self.downloadFile() + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + + self.html = self.load(self.getDownloadUrl(rtUpdate)) + + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"]) + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) def solveCaptcha(self): @@ -72,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: @@ -130,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): @@ -157,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): - 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 7dd7b7dce..e4b53b818 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -8,7 +8,8 @@ class TurbouploadCom(DeadHoster): __type__ = "hoster" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+).*' + __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 a4e352956..6021a4c30 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- +from module.network.HTTPRequest import BadHeader from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -16,20 +17,24 @@ 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): - self.multiDL = False self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True - def handlePremium(self): - return self.handleFree() + def downloadLink(self, link, disposition=True): + try: + return super(TusfilesNet, self).downloadLink(link, disposition) + + except BadHeader, e: + if e.code is 503: + self.multiDL = False + raise Retry("503") getInfo = create_getInfo(TusfilesNet) diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 59a8ce6e1..086228637 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -8,20 +8,21 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" - __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.*' + __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """2Shared.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' - SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' + SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' - LINK_PATTERN = r'window.location =\'(.+?)\';' + LINK_FREE_PATTERN = r'window.location =\'(.+?)\';' def setup(self): @@ -29,13 +30,4 @@ class TwoSharedCom(SimpleHoster): self.multiDL = True - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link")) - - link = m.group(1) - self.download(link) - - getInfo = create_getInfo(TwoSharedCom) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 6b84a5e1b..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.01" + __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,65 +30,25 @@ 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="(.+?)"' - FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"' - PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"' - 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() - else: - self.handleFree() - - self.doCheckDownload() - - - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: self.error(_("Free download form not found")) @@ -107,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) @@ -115,54 +76,78 @@ 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"}) + + + 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 handlePremium(self): - self.download(self.pyfile.url + "?do=directDownload", disposition=True) - #parsed_url = self.findDownloadURL(premium=True) - #self.download(parsed_url, post={"download": "Download"}) + 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"}) - def findDownloadURL(self, premium=False): - msg = _("%s link" % ("Premium" if premium else "Free")) - m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) - if m is None: - self.error(msg) - parsed_url = "http://www.ulozto.net" + m.group(1) - self.logDebug("%s: %s" % (msg, parsed_url)) - return parsed_url + return super(UlozTo, self).checkErrors() - def doCheckDownload(self): + def checkFile(self, rules={}): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), - "offline": re.compile(self.OFFLINE_PATTERN), - "passwd": self.PASSWD_PATTERN, - "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. - "not_found": "<title>Ulož.to</title>" + "offline" : re.compile(self.OFFLINE_PATTERN), + "passwd" : self.PASSWD_PATTERN, + "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. + "not_found" : "<title>Ulož.to</title>" }) if check == "wrong_captcha": - #self.delStorage("captcha_id") - #self.delStorage("captcha_text") self.invalidCaptcha() self.retry(reason=_("Wrong captcha code")) + elif check == "offline": self.offline() + elif check == "passwd": self.fail(_("Wrong password")) + elif check == "server_error": self.logError(_("Server error, try downloading later")) self.multiDL = False self.wait(1 * 60 * 60, True) self.retry() + elif check == "not_found": - self.fail(_("Server error - file not downloadable")) + 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 b48964771..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 @@ -8,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): __name__ = "UloziskoSk" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.*' + __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_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,16 +35,15 @@ 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() + self.handleFree(pyfile) - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) parsed_url = 'http://www.ulozisko.sk' + m.group(1) m = re.search(self.ID_PATTERN, self.html) @@ -55,18 +56,17 @@ 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) - self.download(parsed_url, post={ - "antispam": captcha, - "id": id, - "name": self.pyfile.name, - "but": "++++STIAHNI+S%DABOR++++" - }) + self.download(parsed_url, + post={"antispam": captcha, + "id" : id, + "name" : pyfile.name, + "but" : "++++STIAHNI+S%DABOR++++"}) getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 8c39cce82..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 @@ -12,9 +10,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.11" + __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,24 +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_PATTERN = r'<a href="([^"]+)">Download</a>' + LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>' - def handleFree(self): - domain = "http://www.%s/" % self.HOSTER_DOMAIN + 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: @@ -48,9 +48,9 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - url = m.group(1) + self.link = m.group(1) self.correctCaptcha() break else: @@ -61,14 +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 7535d7b41..b63796fe0 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -1,102 +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 - - -def secondsToMidnight(gmt=0): - now = datetime.utcnow() + timedelta(hours=gmt) - - if now.hour is 0 and now.minute < 10: - midnight = now - else: - midnight = now + timedelta(days=1) - - td = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - now - - if hasattr(td, 'total_seconds'): - res = td.total_seconds() - else: #@NOTE: work-around for python 2.5 and 2.6 missing timedelta.total_seconds - res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 - - return int(res) - - -class UnrestrictLi(MultiHoster): +class UnrestrictLi(DeadHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.23" - __pattern__ = r'https?://(?:[^/]*\.)?(unrestrict|unr)\.li' + __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' + __config__ = [] #@TODO: Remove in 0.4.10 - __description__ = """Unrestrict.li hoster plugin""" + __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - def setup(self): - self.chunkLimit = 16 - self.resumeDownload = True - - - def handleFree(self): - for _i in xrange(5): - page = self.load('https://unrestrict.li/unrestrict.php', - post={'link': self.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 != self.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 7ae46ef38..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.05" + __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): @@ -38,24 +42,25 @@ class UpleaCom(XFSHoster): self.resumeDownload = True - def handleFree(self): + 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.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 6d8a032e9..2907bd825 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -2,8 +2,6 @@ import re -from time import sleep - from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -11,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Uploadable.ch hoster plugin""" __license__ = "GPLv3" @@ -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">' @@ -33,29 +32,23 @@ class UploadableCh(SimpleHoster): RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" - def setup(self): - self.multiDL = False - self.chunkLimit = 1 - - - def handleFree(self): + def handleFree(self, pyfile): # Click the "free user" button and wait - a = self.load(self.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(self.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']}, @@ -64,27 +57,21 @@ class UploadableCh(SimpleHoster): self.wait(3) # Get ready for downloading - self.load(self.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(self.pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) - - - def checkFile(self): - super(UploadableCh, self).checkFile() + self.download(pyfile.url, post={'download': "normal"}, disposition=True) - check = self.checkDownload({'wait_or_reconnect': re.compile("Please wait for"), - 'is_html' : re.compile("<head>")}) - if check == "wait_or_reconnect": + 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() - elif check == "is_html": - self.error("Downloaded file is an html file") + 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..669694b22 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,245 +1,124 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://ul.to/044yug9o -# http://ul.to/gzfhd0xs import re - -from time import sleep +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 -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.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 +class UploadedTo(SimpleHoster): + __name__ = "UploadedTo" + __type__ = "hoster" + __version__ = "0.88" - return name, size, status, fileid + __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] + __description__ = """Uploaded.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] -def getInfo(urls): - for chunk in chunks(urls, 80): - result = [] - api = getAPIData(chunk) + DISPOSITION = False - for data in api.itervalues(): - if data[0] == "online": - result.append((html_unescape(data[2]), data[1], 2, data[4])) + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" - elif data[0] == "offline": - result.append((data[4], 0, 1, data[4])) + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] - yield result + TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' + LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' -class UploadedTo(Hoster): - __name__ = "UploadedTo" - __type__ = "hoster" - __version__ = "0.75" + 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' - __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' - __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")] + @classmethod + def apiInfo(cls, url): + info = super(UploadedTo, cls).apiInfo(url) + for _i in xrange(5): + html = getURL("http://uploaded.net/api/filemultiple", + get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}, + decode=True) + + if html != "can't find request": + api = html.split(",", 4) + if api[0] == "online": + info.update({'name': api[4].strip(), 'size': api[2], 'status': 2}) + else: + info['status'] = 1 + break + else: + time.sleep(3) - 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' + return info def setup(self): self.multiDL = self.resumeDownload = self.premium self.chunkLimit = 1 # critical problems with more chunks - self.fileID = getID(self.pyfile.url) - self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID - - def process(self, pyfile): - self.load("http://uploaded.net/language/en", just_header=True) + def checkErrors(self): + if 'var free_enabled = false;' in self.html: + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) - api = getAPIData([pyfile.url]) + elif "limit-size" in self.html: + self.fail(_("File too big for free download")) - # TODO: fallback to parse from site, because api sometimes delivers wrong status codes + elif "limit-slot" in self.html: # Temporary restriction so just wait a bit + self.wait(30 * 60, True) + self.retry() - if not api: - self.logWarning(_("No response for API call")) + elif "limit-parallel" in self.html: + self.fail(_("Cannot download in parallel")) - 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 - else: - self.error(_("file info")) + elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: # limit-dl + self.wait(3 * 60 * 60, True) + self.retry() - elif api == 'Access denied': - self.fail(_("API key invalid")) + elif '"err":"captcha"' in self.html: + self.invalidCaptcha() else: - if self.fileID not in api: - self.offline() + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1)) - self.data = api[self.fileID] - if self.data[0] != "online": - self.offline() - pyfile.name = html_unescape(self.data[2]) - - # pyfile.name = self.get_file_name() + def handleFree(self, pyfile): + self.load("http://uploaded.net/language/en", just_header=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - - - 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")) - - 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={}) + self.html = self.load("http://uploaded.net/js/download.js", decode=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) + if "type:'download'" in self.html: + self.correctCaptcha() + try: + self.link = re.search("url:'(.+?)'", self.html).group(1) - 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))) + except Exception: + pass - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + self.checkErrors() - url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID - downloadURL = "" - recaptcha = ReCaptcha(self) + def checkFile(self, rules={}): + if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): + self.wait(3 * 60 * 60, True) + self.retry() - 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) + return super(UploadedTo, self).checkFile(rules) - if not downloadURL: - self.fail(_("No Download url retrieved/all captcha attempts failed")) - 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 189079017..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.16" + __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,61 +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+)"' - FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' - PREMIUM_URL_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): - self.checkErrors() + def handleFree(self, pyfile): 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")) - for _i in xrange(5): - captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, get={"code": captcha}) - m = re.search(self.FREE_URL_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")) + captcha = self.decryptCaptcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) - self.download(download_url) + self.html = self.load(pyfile.url, + get={"code": captcha}) - - def handlePremium(self): - self.logDebug("%s: Use Premium Account" % self.__name__) - link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) - self.download(link) + 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 b163f2252..c2e0d2873 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.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -40,35 +39,34 @@ class UploadingCom(SimpleHoster): self.getFileInfo() if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - def handlePremium(self): + def handlePremium(self, pyfile): postData = {'action': 'get_link', - 'code': self.info['pattern']['ID'], - 'pass': 'undefined'} + 'code' : self.info['pattern']['ID'], + 'pass' : 'undefined'} self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) url = re.search(r'"link"\s*:\s*"(.*?)"', self.html) if url: - url = url.group(1).replace("\\/", "/") - self.download(url) + self.link = url.group(1).replace("\\/", "/") raise Exception("Plugin defect") - def handleFree(self): + def handleFree(self, pyfile): m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) if m: - self.pyfile.error = m.group(1) - self.logWarning(self.pyfile.error) - self.retry(6, (6 * 60 if m.group(2) else 15) * 60, self.pyfile.error) + pyfile.error = m.group(1) + self.logWarning(pyfile.error) + self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + 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,12 +91,7 @@ class UploadingCom(SimpleHoster): else: self.error(_("No URL")) - self.download(url) - - check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) - if check == "html": - self.logWarning(_("Redirected to a HTML page, wait 10 minutes and retry")) - self.wait(10 * 60, True) + 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 25c424f1f..ec0c88c82 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -9,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?upstore\.net/' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Upstore.Net File Download Hoster""" __license__ = "GPLv3" @@ -22,11 +23,11 @@ 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="([^"]*)">' - LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' + CHASH_PATTERN = r'<input type="hidden" name="hash" value="(.+?)">' + LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -35,7 +36,7 @@ class UpstoreNet(SimpleHoster): self.logDebug("Read hash " + chash) # continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 2: solv captcha and wait # first get the infos we need: recaptcha key and wait time @@ -52,22 +53,21 @@ 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}) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link - m = re.search(self.LINK_PATTERN, self.html, re.S) + m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break 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 6dbac397b..57b24623b 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -8,10 +8,11 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" - __version__ = "0.21" + __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" @@ -32,17 +33,17 @@ class VeohCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): - quality = self.getConfig("quality") + def handleFree(self, pyfile): + quality = self.getConfig('quality') if quality == "Auto": quality = ("High", "Low") + for q in quality: pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q m = re.search(pattern, self.html) if m: - self.pyfile.name += ".mp4" - link = m.group(1).replace("\\", "") - self.download(link) + pyfile.name += ".mp4" + 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 0e42c1674..a5196cb92 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -8,11 +8,12 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __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" @@ -34,27 +35,26 @@ class VimeoCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): password = self.getPassword() if self.js and 'class="btn iconify_down_b"' in self.html: - html = self.js.eval(self.load(self.pyfile.url, get={'action': "download", 'password': password}, decode=True)) + html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password}, decode=True)) pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) ' else: - id = re.match(self.__pattern__, self.pyfile.url).group('ID') - html = self.load("https://player.vimeo.com/video/" + id, get={'password': password}) + 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": @@ -64,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 340a3feaa..5668e0fad 100644 --- a/module/plugins/hoster/Vipleech4uCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -3,16 +3,17 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class Vipleech4uCom(DeadHoster): - __name__ = "Vipleech4uCom" +class Vipleech4UCom(DeadHoster): + __name__ = "Vipleech4UCom" __type__ = "hoster" __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" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] -getInfo = create_getInfo(Vipleech4uCom) +getInfo = create_getInfo(Vipleech4UCom) 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 a08341ff3..ae670c8d4 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """WebShare.cz hoster plugin""" __license__ = "GPLv3" @@ -21,7 +22,7 @@ class WebshareCz(SimpleHoster): @classmethod def getInfo(cls, url="", html=""): - info = super(WebshareCz, self).getInfo(url, html) + info = super(WebshareCz, cls).getInfo(url, html) if url: info['pattern'] = re.match(cls.__pattern__, url).groupdict() @@ -40,25 +41,22 @@ class WebshareCz(SimpleHoster): return info - def handleFree(self): - fid = re.match(self.__pattern__, self.pyfile.url).group('ID') + def handleFree(self, pyfile): wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" api_data = getURL('https://webshare.cz/api/file_link/', - post={'ident': fid, 'wst': wst}, + 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")) + if m: + self.link = m.group(1) - self.link = m.group(1) - - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(WebshareCz) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 8e9653307..f11d03ea8 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.02" + __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" @@ -29,24 +29,23 @@ class WrzucTo(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: self.error(_("No file ID")) - self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.req.http.lastURL = pyfile.url self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) if len(data) != 4: self.error(_("No download URL")) - 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 8e01c067c..73c008ae8 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -8,7 +8,8 @@ class WuploadCom(DeadHoster): __type__ = "hoster" __version__ = "0.23" - __pattern__ = r'http://(?:www\.)?wupload\..*?/file/((\w+/)?\d+)(/.*)?' + __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 0acad3dba..1bfb504b7 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.45" __pattern__ = r'^unmatchable$' @@ -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()))) @@ -31,27 +31,29 @@ class XFileSharingPro(XFSHoster): self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): self.account = account + elif self.account: self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: return self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) def setup(self): - self.chunkLimit = 1 + self.chunkLimit = 1 self.resumeDownload = self.premium - self.multiDL = True + self.multiDL = True getInfo = create_getInfo(XFileSharingPro) 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 d9190805d..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 @@ -12,7 +11,7 @@ class XVideosCom(Hoster): __type__ = "hoster" __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)/.*' + __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)' __description__ = """XVideos.com hoster plugin""" __license__ = "GPLv3" @@ -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 ef6da4a71..d167e4cab 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -6,8 +6,6 @@ import struct import sys import time -from os import makedirs -from os.path import exists, join from select import select from module.plugins.Hoster import Hoster @@ -92,7 +90,10 @@ class Xdcc(Hoster): 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)) - time.sleep(3) + + self.setWait(3) + self.wait() + sock.send("JOIN #%s\r\n" % chan) sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) 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 3b4692933..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 @@ -9,9 +10,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): __name__ = "YibaishiwuCom" __type__ = "hoster" - __version__ = "0.13" + __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" @@ -22,31 +24,34 @@ class YibaishiwuCom(SimpleHoster): SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\'' OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>' - LINK_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) + url = m.group(1) + self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) - res = json_loads(self.load("http://115.com" + url, decode=False)) + res = json_loads(self.load(urlparse.urljoin("http://115.com", url), decode=False)) if "urls" in res: mirrors = res['urls'] + elif "data" in res: mirrors = res['data'] + else: mirrors = None for mr in mirrors: try: - 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 83ab89110..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 @@ -10,9 +8,9 @@ from module.plugins.Hoster import Hoster class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' + __pattern__ = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' __description__ = """Youfiles.to hoster plugin""" __license__ = "GPLv3" @@ -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 bb0737440..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/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 26d64555b..617e00e58 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,42 +1,34 @@ # -*- coding: utf-8 -*- +import re +import urlparse + from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.29" - __pattern__ = r'http://(?:www\.)?zevera\.com/.*' + __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 hoster plugin""" + __description__ = """Zevera.com multi-hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def setup(self): - self.resumeDownload = True - self.multiDL = True - self.chunkLimit = 1 - - - def handlePremium(self): - if self.account.getAPIData(self.req, cmd="checklink", olink=self.pyfile.url) != "Alive": - self.fail(_("Offline or not downloadable")) + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=self.pyfile.url) - if not "location" in header: - self.fail(_("Unable to initialize download")) - self.link = header['location'] + def handlePremium(self, pyfile): + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) - def checkFile(self): - super(ZeveraCom, self).checkFile() + def checkFile(self, rules={}): + if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): + self.fail(_("Error response received")) - if self.checkDownload({"error": 'action="ErrorDownload.aspx'}) is "error": - self.fail(_("Error response received - contact Zevera support")) + 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 67b384c5f..c47ac4fe1 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -1,64 +1,94 @@ # -*- coding: utf-8 -*- import re +import urllib -from urlparse import urljoin +from BeautifulSoup import BeautifulSoup +from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.63" + __version__ = "0.78" - __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.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True - def handleFree(self): - url = self.get_link() - self.download(url) + def handleFree(self, pyfile): + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + if captcha_key: + try: + self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + recaptcha.challenge() - 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()) - 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()) + except Exception, e: + self.error(e) - b = (a1 % a2) * (c1 % c2) - except: - self.error(_("Unable to calculate checksum")) else: - return b + 18 + self.link = self.get_link() + + if self.link and pyfile.name == 'file.html': + pyfile.name = urllib.unquote(self.link.split('/')[-1]) def get_link(self): - checksum = self.get_checksum() - p_url = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) - dl_link = urljoin(self.info['pattern']['HOST'], p_url) - return dl_link + # 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) |