diff options
22 files changed, 65 insertions, 105 deletions
diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py index 9793dd795..b6e43d632 100644 --- a/module/plugins/hoster/AndroidfilehostCom.py +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -48,9 +48,9 @@ class AndroidfilehostCom(SimpleHoster): 'fid' : fid}, decode=True) - mirror = re.findall('"url":"(.*?)"', html)[0].replace("\\", "") - mirror_host = mirror.split("/")[2] - self.logDebug("DL-URL: %s" % mirror) + 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", @@ -59,7 +59,5 @@ class AndroidfilehostCom(SimpleHoster): 'mirror': mirror_host}, decode=True) - self.download(mirror, disposition=True) - getInfo = create_getInfo(AndroidfilehostCom) diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 32380810f..db482c7c5 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -52,15 +52,10 @@ class BasketbuildCom(SimpleHoster): self.logDebug("No wait time found") try: - link2 = re.search(r'id="dlLink">\s*<a href="(.+?)"', self.html).group(1) + self.link = re.search(r'id="dlLink">\s*<a href="(.+?)"', self.html).group(1) except AttributeError: self.error(_("DL-Link not found")) - else: - self.logDebug("DL-Link: %s" % link2) - - self.download(link2, disposition=True) - getInfo = create_getInfo(BasketbuildCom) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 339253aeb..125e63481 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -56,8 +56,7 @@ class CatShareNet(SimpleHoster): self.invalidCaptcha() self.retry(reason=_("Wrong captcha entered")) - dl_link = m.group(1) - self.download(dl_link, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index fb9e7f457..49c7a6648 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.97" + __version__ = "0.98" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -74,7 +74,6 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) - self.checkDownloadedFile() def handleFree(self, pyfile): @@ -129,14 +128,12 @@ class CzshareCom(SimpleHoster): if m is None: self.error(_("Download URL not found")) - url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) + self.link = "http://%s/download.php?%s" % (m.group(1), m.group(2)) self.wait() - self.download(url) - self.checkDownloadedFile() - def checkDownloadedFile(self): + def checkFile(self): # check download check = self.checkDownload({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), @@ -158,5 +155,7 @@ class CzshareCom(SimpleHoster): self.invalidCaptcha() self.retry() + return super(CzshareCom, self).checkFile() + getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 3af309cae..6de05af9a 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -85,19 +85,14 @@ class DepositfilesCom(SimpleHoster): if m: if 'response' in params: self.correctCaptcha() - link = unquote(m.group(1)) - self.logDebug("LINK: %s" % link) + + self.link = unquote(m.group(1)) break else: self.error(_("Download link")) else: self.fail(_("No valid captcha response received")) - try: - self.download(link, disposition=True) - except Exception: - self.retry(wait_time=60) - def handlePremium(self, pyfile): if '<span class="html_download_api-gold_traffic_limit">' in self.html: @@ -107,15 +102,14 @@ class DepositfilesCom(SimpleHoster): self.account.relogin(self.user) self.retry() else: - link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + link = re.search(self.LINK_PREMIUM_PATTERN, self.html) mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) + if link: - dlink = link.group(1) + self.link = link.group(1) + elif mirror: - dlink = mirror.group(1) - else: - self.error(_("No direct download link or mirror found")) - self.download(dlink, disposition=True) + self.link = mirror.group(1) getInfo = create_getInfo(DepositfilesCom) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 4776bf470..5d4e9e7b8 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -81,9 +81,11 @@ class DlFreeFr(SimpleHoster): self.handleFree(pyfile) else: # Direct access to requested file for users using free.fr as Internet Service Provider. - self.download(valid_url, disposition=True) + self.link = valid_url + elif headers.get('code') == 404: self.offline() + else: self.fail(_("Invalid return code: ") + str(headers.get('code'))) @@ -104,9 +106,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/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 08d8a2e3e..b4c9ace6a 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -53,12 +53,11 @@ class EuroshareEu(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) - parsed_url = "http://euroshare.eu%s" % m.group(1) - self.logDebug("URL", parsed_url) - self.download(parsed_url, disposition=True) + self.link = "http://euroshare.eu%s" % m.group(1) - def checkFile(): + + def checkFile(self): if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index fb1aea58f..bb91da7d5 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -118,7 +118,7 @@ class FilecloudIo(SimpleHoster): self.logDebug("FetchDownloadUrl: " + rep) rep = json_loads(rep) if rep['status'] == 'ok': - self.download(rep['download_url'], disposition=True) + self.link = rep['download_url'] else: self.fail(rep['message']) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 30c1b85ec..4980ebe39 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -52,14 +52,14 @@ class FilefactoryCom(SimpleHoster): if m is None: self.error(_("Free download link not found")) - dl_link = m.group(1) + self.link = m.group(1) m = re.search(self.WAIT_PATTERN, self.html) if m: self.wait(m.group(1)) - self.download(dl_link, disposition=True) + def checkFile(self): check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">'}) @@ -70,6 +70,8 @@ class FilefactoryCom(SimpleHoster): elif check == "error": self.error(_("Unknown error")) + return super(FilefactoryCom, self).checkFile() + def handlePremium(self, pyfile): self.link = self.directLink(self.load(pyfile.url, just_header=True)) diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index 1fcdf8ff0..0c8ca9c52 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from module.utils import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' @@ -21,6 +21,8 @@ class GoogledriveCom(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + DISPOSITION = False + NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' @@ -57,7 +59,7 @@ class GoogledriveCom(SimpleHoster): link3 = self.load("https://docs.google.com" + link2, just_header=True) self.logDebug("DL-Link: %s" % link3['location']) - self.link = link3['location'] #@NOTE: I don't use disposition=True because it breaks the filename. + self.link = link3['location'] getInfo = create_getInfo(GoogledriveCom) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index eb4d34cc2..2d1c3b096 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -72,7 +72,7 @@ class KingfilesNet(SimpleHoster): if m is None: self.error(_("Download url not found")) - self.download(m.group(1), cookies=True, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index cd922aea7..2c725427d 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -152,4 +152,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/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 048561ac5..7d8a25c03 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -54,9 +54,7 @@ class MegaRapidCz(SimpleHoster): def handlePremium(self, pyfile): m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) + self.link = m.group(1) else: if re.search(self.ERR_LOGIN_PATTERN, self.html): self.relogin(self.user) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 2e9e52813..a6e3b034c 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.77" + __version__ = "0.78" __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+))?' @@ -28,7 +28,8 @@ class OneFichierCom(SimpleHoster): OFFLINE_PATTERN = r'File not found !\s*<' - COOKIES = [("1fichier.com", "LG", "en")] + COOKIES = [("1fichier.com", "LG", "en")] + DISPOSITION = False #: Remove in 0.4.10 WAIT_PATTERN = r'>You must wait (\d+) minutes' diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index ce0a384e3..412a7bf2d 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -39,7 +39,7 @@ class PromptfileCom(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.download(m.group(1), disposition=True) + self.link = m.group(1) getInfo = create_getInfo(PromptfileCom) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index f7e6534f2..7ec843646 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -29,17 +29,19 @@ class RapidgatorNet(SimpleHoster): COOKIES = [("rapidgator.net", "lang", "en")] - NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' - SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' + SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'>(File not found|Error 404)' JSVARS_PATTERN = r'\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*\'?(.*?)\'?;' - PREMIUM_ONLY_ERROR_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' - DOWNLOAD_LIMIT_ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' - WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)' + + PREMIUM_ONLY_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' + ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' + WAIT_PATTERN = r'(Delay between downloads must be not less than|Try again in).+' + LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' - RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' + 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=(.*?)"' @@ -95,8 +97,6 @@ class RapidgatorNet(SimpleHoster): def handleFree(self, pyfile): - self.checkFree() - jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) self.logDebug(jsvars) @@ -122,12 +122,10 @@ class RapidgatorNet(SimpleHoster): for _i in xrange(5): m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug(link) - self.download(link, disposition=True) + self.link = m.group(1) break else: - captcha, captcha_key = self.getCaptcha() + captcha, captcha_key = self.handleCaptcha() response, challenge = captcha.challenge(captcha_key) self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", @@ -142,7 +140,7 @@ class RapidgatorNet(SimpleHoster): self.error(_("Download link")) - def getCaptcha(self): + def handleCaptcha(self): m = re.search(self.ADSCAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) @@ -163,30 +161,6 @@ class RapidgatorNet(SimpleHoster): 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 getJsonResponse(self, url): res = self.load(url, decode=True) if not res.startswith('{'): diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 590f8daf5..ed64b6a89 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -48,7 +48,7 @@ class RemixshareCom(SimpleHoster): if not c: self.error(_("Cannot parse file token")) - dl_url = b.group(1) + c.group(1) + self.link = b.group(1) + c.group(1) #Check if we have to wait seconds = re.search(self.WAIT_PATTERN, self.html) @@ -56,8 +56,5 @@ class RemixshareCom(SimpleHoster): self.logDebug("Wait " + seconds.group(1)) self.wait(seconds.group(1)) - # Finally start downloading... - self.download(dl_url, disposition=True) - getInfo = create_getInfo(RemixshareCom) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index c544c1222..8faad1d8f 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -53,7 +53,7 @@ class UpleaCom(XFSHoster): self.error(_("LINK_PATTERN not found")) self.wait(15) - self.download(m.group(1), disposition=True) + self.link = m.group(1) getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index db9fa53a1..13119eefd 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -66,8 +66,7 @@ class UpstoreNet(SimpleHoster): if m is None: self.error(_("Download link not found")) - direct = m.group(1) - self.download(direct, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(UpstoreNet) diff --git a/module/plugins/hoster/XdadevelopersCom.py b/module/plugins/hoster/XdadevelopersCom.py index 7df891783..7d50d4f57 100644 --- a/module/plugins/hoster/XdadevelopersCom.py +++ b/module/plugins/hoster/XdadevelopersCom.py @@ -32,8 +32,7 @@ class XdadevelopersCom(SimpleHoster): def handleFree(self, pyfile): - self.download(pyfile.url + "&task=get", #@TODO: Revert to `get={'task': "get"}` in 0.4.10 - disposition=True) + 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/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index ca8fce05f..e820ab141 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.14" + __version__ = "1.15" __pattern__ = r'^unmatchable$' @@ -309,6 +309,7 @@ class SimpleHoster(Hoster): DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handleMulti method) LOGIN_ACCOUNT = False #: Set to True to require account login + DISPOSITION = True #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 directLink = fileUrl #@TODO: Remove in 0.4.10 @@ -482,11 +483,11 @@ class SimpleHoster(Hoster): self.logDebug("Handled as free download") self.handleFree(pyfile) - self.downloadLink(self.link) + self.downloadLink(self.link, self.DISPOSITION) #: Remove `DISPOSITION` in 0.4.10 self.checkFile() - def downloadLink(self, link, disposition=False): #@TODO: Set `disposition=True` in 0.4.10 + def downloadLink(self, link, disposition=True): if link and isinstance(link, basestring): self.correctCaptcha() @@ -598,7 +599,7 @@ class SimpleHoster(Hoster): pass self.logDebug("File name: %s" % self.pyfile.name, - "File size: %s" % self.pyfile.size if self.pyfile.size > 0 else "Unknown") + "File size: %s" % (self.pyfile.size if self.pyfile.size > 0 else "Unknown")) def checkInfo(self): diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 624534dbd..624db87b7 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -16,7 +16,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'^unmatchable$' @@ -89,7 +89,7 @@ class XFSHoster(SimpleHoster): self.directDL = self.premium - def downloadLink(self, link, disposition=False): #@TODO: Set `disposition=True` in 0.4.10 + def downloadLink(self, link, disposition=True): if link and isinstance(link, basestring): self.correctCaptcha() |