From 430092f0ba67e4bb2dd75433b08340d0afca0fa9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 12 Dec 2014 20:34:42 +0100 Subject: Update plugins after SimpleHoster changes --- module/plugins/hoster/Keep2shareCc.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCc.py') diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py index cb5e65a29..d98fa3c09 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2shareCc.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import _isDirectLink, SimpleHoster, cr class Keep2shareCc(SimpleHoster): __name__ = "Keep2shareCc" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -23,8 +23,6 @@ class Keep2shareCc(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://k2s.cc/file/\g")] - CONTENT_DISPOSITION = True - NAME_PATTERN = r'File: (?P.+)' SIZE_PATTERN = r'Size: (?P[^<]+)' @@ -87,13 +85,7 @@ class Keep2shareCc(SimpleHoster): if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.link = self._getDownloadLink(m.group(1)) - - - def handlePremium(self): - super(Keep2shareCc, self).handlePremium() - if self.link: - self.link = self._getDownloadLink(self.link) + self.link = m.group(1) def handleCaptcha(self): @@ -125,11 +117,16 @@ class Keep2shareCc(SimpleHoster): self.fail(_("All captcha attempts failed")) - def _getDownloadLink(self, url): - p = urlparse(self.pyfile.url) + def downloadLink(self, link): + if not link: + return + + p = urlparse(self.pyfile.url) base = "%s://%s" % (p.scheme, p.netloc) - link = _isDirectLink(self, url, self.premium) - return urljoin(base, link) if link else "" + link = _isDirectLink(self, link, self.premium) + + if link: + self.download(urljoin(base, link), disposition=True) getInfo = create_getInfo(Keep2shareCc) -- cgit v1.2.3