From c4f167e267ba949ee20ec8a6d3c611d6dd93b325 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 20 Jan 2015 01:22:00 +0100 Subject: Fix plugin filename case --- module/plugins/hoster/Keep2ShareCc.py | 115 ++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 module/plugins/hoster/Keep2ShareCc.py (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py new file mode 100644 index 000000000..d02b9f709 --- /dev/null +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- + +import re + +from urlparse import urljoin + +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class Keep2ShareCc(SimpleHoster): + __name__ = "Keep2ShareCc" + __type__ = "hoster" + __version__ = "0.20" + + __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' + + __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")] + + NAME_PATTERN = r'File: (?P.+)' + SIZE_PATTERN = r'Size: (?P[^<]+)' + + 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 = \'(.+?)\';' + + CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' + + WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' + TEMP_ERROR_PATTERN = r'>\s*(Download count files exceed|Traffic limit exceed|Free account does not allow to download more than one file at the same time)' + ERROR_PATTERN = r'>\s*(Free user can\'t download large files|You no can access to this file|This download available only for premium users|This is private file)' + + + def checkErrors(self): + m = re.search(self.TEMP_ERROR_PATTERN, self.html) + if m: + self.info['error'] = m.group(1) + self.wantReconnect = True + self.retry(wait_time=30 * 60, reason=m.group(0)) + + m = re.search(self.ERROR_PATTERN, self.html) + if m: + errmsg = self.info['error'] = m.group(1) + self.error(errmsg) + + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logDebug("Hoster told us to wait for %s" % m.group(1)) + + # string to time convert courtesy of https://stackoverflow.com/questions/10663720 + ftr = [3600, 60, 1] + wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) + + self.wantReconnect = True + self.retry(wait_time=wait_time, reason="Please wait to download this file") + + self.info.pop('error', None) + + + def handleFree(self, pyfile): + self.fid = re.search(r'', self.html).group(1) + self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + + self.checkErrors() + + m = re.search(self.LINK_FREE_PATTERN, self.html) + + if m is None: + self.handleCaptcha() + + self.wait(30) + + self.html = self.load(pyfile.url, post={'uniqueId': self.fid, 'free': 1}) + + self.checkErrors() + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + + self.link = m.group(1) + + + def handleCaptcha(self): + recaptcha = ReCaptcha(self) + 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() + else: + self.invalidCaptcha() + + +getInfo = create_getInfo(Keep2ShareCc) -- cgit v1.2.3 From cf4ded052964047de88d676045329b8fa4fca2dc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 22 Jan 2015 21:31:19 +0100 Subject: Update plugins after CaptchaService changes --- module/plugins/hoster/Keep2ShareCc.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index d02b9f709..34bc3de54 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -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.+?)"' @@ -77,9 +78,7 @@ class Keep2ShareCc(SimpleHoster): self.wait(30) - self.html = self.load(pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - self.checkErrors() + self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: @@ -100,13 +99,13 @@ class Keep2ShareCc(SimpleHoster): captcha_url = urljoin("http://k2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: - 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) - if 'recaptcha' not in self.html: + if 'verification code is incorrect' not in self.html: self.correctCaptcha() else: self.invalidCaptcha() -- cgit v1.2.3 From 79725268402043906f619f7c09e848e02ab8a17b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 31 Jan 2015 22:00:59 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/Keep2ShareCc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 34bc3de54..6b7b422c5 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -57,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") -- cgit v1.2.3 From 7d90803262ccbb4fc5296a4dc3ce30fe98f55631 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/hoster/Keep2ShareCc.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 6b7b422c5..6916797bd 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -14,6 +14,7 @@ class Keep2ShareCc(SimpleHoster): __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Keep2Share.cc hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 589121e80835c63aea0880a53c6678de5c31c16e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 28 Mar 2015 01:59:01 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/Keep2ShareCc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 6916797bd..5afa87a4a 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -30,7 +30,7 @@ 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 = 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.+?)"' @@ -67,7 +67,7 @@ class Keep2ShareCc(SimpleHoster): def handleFree(self, pyfile): - self.fid = re.search(r'', self.html).group(1) + self.fid = re.search(r'', self.html).group(1) self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) self.checkErrors() -- cgit v1.2.3 From 4e05549637e1fd9d417fe0f6a0dec3fed8d1cbdf Mon Sep 17 00:00:00 2001 From: saintego Date: Mon, 30 Mar 2015 01:59:18 +0200 Subject: Some issue in keep2share.cc #1236 `Problem is not fixed. With this change we are able to load captcha, but I got Parse error: No file downloaded | Plugin may be out of date --- module/plugins/hoster/Keep2ShareCc.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 5afa87a4a..296226e3c 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -22,7 +22,7 @@ class Keep2ShareCc(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", "http://k2s.cc/file/\g")] + URL_REPLACEMENTS = [(__pattern__ + ".*", "http://keep2s.cc/file/\g")] NAME_PATTERN = r'File: (?P.+)' SIZE_PATTERN = r'Size: (?P[^<]+)' @@ -30,7 +30,7 @@ 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 = 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.+?)"' @@ -67,8 +67,10 @@ class Keep2ShareCc(SimpleHoster): def handleFree(self, pyfile): - self.fid = re.search(r'', self.html).group(1) + self.fid = re.search(r'', 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() @@ -77,7 +79,7 @@ class Keep2ShareCc(SimpleHoster): if m is None: self.handleCaptcha() - self.wait(30) + self.wait(31) self.html = self.load(pyfile.url) @@ -89,17 +91,20 @@ class Keep2ShareCc(SimpleHoster): def handleCaptcha(self): - recaptcha = ReCaptcha(self) post_data = {'free' : 1, 'freeDownloadRequest': 1, 'uniqueId' : self.fid, 'yt0' : ''} + m = re.search(r'id="(captcha\-form)"', self.html) + self.logDebug("captcha-form found %s" % m) m = re.search(self.CAPTCHA_PATTERN, self.html) + self.logDebug("CAPTCHA_PATTERN found %s" % m) if m: - captcha_url = urljoin("http://k2s.cc/", m.group(1)) + captcha_url = 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}) -- cgit v1.2.3 From 1cfc960fd3ec384364ffb1e09d3ee98fc657eddb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Apr 2015 16:51:14 +0200 Subject: [SimpleDereferer][SimpleHoster] Update user-agent --- module/plugins/hoster/Keep2ShareCc.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 296226e3c..65e9ddc2d 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -30,7 +30,7 @@ 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 = 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.+?)"' @@ -67,20 +67,18 @@ class Keep2ShareCc(SimpleHoster): def handleFree(self, pyfile): - self.fid = re.search(r'', self.html).group(1) + self.fid = re.search(r'', 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.logDebug(self.fid) + # self.logDebug(pyfile.url) self.checkErrors() m = re.search(self.LINK_FREE_PATTERN, self.html) - if m is None: self.handleCaptcha() - self.wait(31) - self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -98,6 +96,7 @@ class Keep2ShareCc(SimpleHoster): m = re.search(r'id="(captcha\-form)"', self.html) self.logDebug("captcha-form found %s" % m) + m = re.search(self.CAPTCHA_PATTERN, self.html) self.logDebug("CAPTCHA_PATTERN found %s" % m) if m: -- cgit v1.2.3 From 1ef93e913238275f7657d496ba3d2e7eeb5a30a2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 May 2015 01:06:01 +0200 Subject: Use 'import' instead 'from' --- module/plugins/hoster/Keep2ShareCc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/Keep2ShareCc.py') diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 65e9ddc2d..fdae65096 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -100,7 +99,7 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.html) self.logDebug("CAPTCHA_PATTERN found %s" % m) if m: - captcha_url = urljoin("http://keep2s.cc/", m.group(1)) + captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: recaptcha = ReCaptcha(self) -- cgit v1.2.3