From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- 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 a7f1efdb8..e9f294087 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -35,7 +35,7 @@ class Keep2shareCC(SimpleHoster): FILE_NAME_PATTERN = r'File: (?P.+)' FILE_SIZE_PATTERN = r'Size: (?P[^<]+)' - FILE_OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' + OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' DIRECT_LINK_PATTERN = r'To download this file with slow speed, use this link' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' -- cgit v1.2.3 From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/Keep2shareCC.py | 7 ++++--- 1 file changed, 4 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 e9f294087..74dc05b89 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -37,11 +37,12 @@ class Keep2shareCC(SimpleHoster): FILE_SIZE_PATTERN = r'Size: (?P[^<]+)' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' - DIRECT_LINK_PATTERN = r'To download this file with slow speed, use this link' + LINK_PATTERN = r'To download this file with slow speed, use this link' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time' - RECAPTCHA_KEY = '6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb' + RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" + def handleFree(self): self.sanitize_url() @@ -76,7 +77,7 @@ class Keep2shareCC(SimpleHoster): self.wait(30 * 60, reconnect=True) self.retry() - m = re.search(self.DIRECT_LINK_PATTERN, self.html) + m = re.search(self.LINK_PATTERN, self.html) if not m: self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- 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 74dc05b89..12df08743 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -78,7 +78,7 @@ class Keep2shareCC(SimpleHoster): self.retry() m = re.search(self.LINK_PATTERN, self.html) - if not m: + if m is None: self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/Keep2shareCC.py | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 12df08743..c1ec66435 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -1,34 +1,23 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see . # -############################################################################ - -# Test links (random.bin): +# +# Test links: # http://k2s.cc/file/55fb73e1c00c5/random.bin import re + from urlparse import urlparse, urljoin -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2shareCC(SimpleHoster): __name__ = "Keep2shareCC" __type__ = "hoster" - __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' __version__ = "0.10" + + __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' + __description__ = """Keep2share.cc hoster plugin""" __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" -- cgit v1.2.3 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/hoster/Keep2shareCC.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index c1ec66435..78d6aaba7 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -52,7 +52,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logDebug('Hoster told us to wait for %s' % m.group(1)) + 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(':')))]) @@ -62,7 +62,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html) if m: # if someone is already downloading on our line, wait 30min and retry - self.logDebug('Already downloading, waiting for 30 minutes') + self.logDebug("Already downloading, waiting for 30 minutes") self.wait(30 * 60, reconnect=True) self.retry() @@ -89,14 +89,14 @@ class Keep2shareCC(SimpleHoster): self.correctCaptcha() break else: - self.logInfo('Wrong captcha') + self.logInfo("Wrong captcha") self.invalidCaptcha() else: self.fail("All captcha attempts failed") def startDownload(self, url): d = urljoin(self.base_url, url) - self.logDebug('Direct Link: ' + d) + self.logDebug("Direct Link: " + d) self.download(d, disposition=True) def sanitize_url(self): -- cgit v1.2.3 From 01c5c24e6aa993b2060618e244f47a476725657d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 1 Oct 2014 04:45:27 +0200 Subject: [OneFichierCom] Fixed wait pattern + code optimizations --- module/plugins/hoster/Keep2shareCC.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 78d6aaba7..f17faae46 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://k2s.cc/file/55fb73e1c00c5/random.bin import re @@ -22,13 +19,14 @@ class Keep2shareCC(SimpleHoster): __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" + FILE_NAME_PATTERN = r'File: (?P.+)' FILE_SIZE_PATTERN = r'Size: (?P[^<]+)' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' LINK_PATTERN = r'To download this file with slow speed, use this link' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time' + MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" @@ -59,7 +57,7 @@ class Keep2shareCC(SimpleHoster): self.wait(wait_time, reconnect=True) self.retry() - m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html) + m = re.search(self.MULTIDL_ERROR, self.html) if m: # if someone is already downloading on our line, wait 30min and retry self.logDebug("Already downloading, waiting for 30 minutes") @@ -71,6 +69,7 @@ class Keep2shareCC(SimpleHoster): self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) + def handleCaptcha(self): recaptcha = ReCaptcha(self) for _ in xrange(5): @@ -94,11 +93,13 @@ class Keep2shareCC(SimpleHoster): else: self.fail("All captcha attempts failed") + def startDownload(self, url): d = urljoin(self.base_url, url) self.logDebug("Direct Link: " + d) self.download(d, disposition=True) + def sanitize_url(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: -- cgit v1.2.3 From 23ae563604dca1dae262fbc598154b99b2f1eae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 3 Oct 2014 09:06:05 +0200 Subject: Update plugins after CaptchaService and XFileSharingPro changes --- module/plugins/hoster/Keep2shareCC.py | 9 ++++++--- 1 file changed, 6 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 f17faae46..bf2150a48 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -28,8 +28,6 @@ class Keep2shareCC(SimpleHoster): WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' - RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" - def handleFree(self): self.sanitize_url() @@ -72,8 +70,13 @@ class Keep2shareCC(SimpleHoster): def handleCaptcha(self): recaptcha = ReCaptcha(self) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + for _ in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + challenge, response = recaptcha.challenge(captcha_key) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'CaptchaForm%5Bcode%5D': '', -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/Keep2shareCC.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index bf2150a48..191d26139 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -16,8 +16,7 @@ class Keep2shareCC(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' __description__ = """Keep2share.cc hoster plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __authors__ = [("stickell", "l.stickell@yahoo.it")] FILE_NAME_PATTERN = r'File: (?P.+)' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- 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 191d26139..a9d4145d1 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -16,6 +16,7 @@ class Keep2shareCC(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' __description__ = """Keep2share.cc hoster plugin""" + __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] -- cgit v1.2.3 From 2ae91b81a2f12a1c9b1f78524df78a2b3f1ef494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Oct 2014 14:52:42 +0200 Subject: Update hosters to self.error --- module/plugins/hoster/Keep2shareCC.py | 6 +++--- 1 file changed, 3 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 a9d4145d1..1da65f3c8 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.10" + __version__ = "0.11" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -64,7 +64,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.parseError("Unable to detect direct link") + self.error("Unable to detect direct link") self.startDownload(m.group(1)) @@ -73,7 +73,7 @@ class Keep2shareCC(SimpleHoster): captcha_key = recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha key not found") + self.error("ReCaptcha key not found") for _ in xrange(5): challenge, response = recaptcha.challenge(captcha_key) -- cgit v1.2.3 From 166a0c3e33cebc81ce9440a93042befa595e2a87 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 16:40:30 +0200 Subject: [Keep2shareCC] Fix CAPTCHA_PATTERN --- module/plugins/hoster/Keep2shareCC.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 1da65f3c8..26a50bb61 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -11,13 +11,14 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2shareCC(SimpleHoster): __name__ = "Keep2shareCC" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' __description__ = """Keep2share.cc hoster plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] FILE_NAME_PATTERN = r'File: (?P.+)' @@ -25,6 +26,7 @@ class Keep2shareCC(SimpleHoster): OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' LINK_PATTERN = r'To download this file with slow speed, use this link' + CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' @@ -69,17 +71,14 @@ class Keep2shareCC(SimpleHoster): def handleCaptcha(self): - recaptcha = ReCaptcha(self) + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m is None: + self.error("Captcha key not found") - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.error("ReCaptcha key not found") + captcha_url = urljoin(self.base_url, m.group(1)) for _ in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) - post_data = {'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': response, - 'CaptchaForm%5Bcode%5D': '', + post_data = {'CaptchaForm[code]': self.decryptCaptcha(captcha_url), 'free': 1, 'freeDownloadRequest': 1, 'uniqueId': self.fid, -- cgit v1.2.3 From a4f5e00338353e9795cb27d6c4f21fb8a75b0d4f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 12:43:02 +0200 Subject: [Keep2shareCC] Fix handleCaptcha --- module/plugins/hoster/Keep2shareCC.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 26a50bb61..a56ac36da 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.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P\w+)' @@ -71,19 +71,23 @@ class Keep2shareCC(SimpleHoster): def handleCaptcha(self): - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m is None: - self.error("Captcha key not found") - - captcha_url = urljoin(self.base_url, m.group(1)) + recaptcha = ReCaptcha(self) for _ in xrange(5): - post_data = {'CaptchaForm[code]': self.decryptCaptcha(captcha_url), - 'free': 1, + post_data = {'free': 1, 'freeDownloadRequest': 1, 'uniqueId': self.fid, 'yt0': ''} + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = urljoin(self.base_url, 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: -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/Keep2shareCC.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index a56ac36da..d6258bb06 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -38,7 +38,7 @@ class Keep2shareCC(SimpleHoster): self.fid = re.search(r'', self.html).group(1) self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.DOTALL) + m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.S) if m: # Direct mode self.startDownload(m.group(1)) else: @@ -94,7 +94,6 @@ class Keep2shareCC(SimpleHoster): self.correctCaptcha() break else: - self.logInfo("Wrong captcha") self.invalidCaptcha() else: self.fail("All captcha attempts failed") -- cgit v1.2.3 From 1c4bf83881d2a22da3773666a580d51f6b57bfd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 03:07:21 +0200 Subject: Avoid gettext conflict due variable `_` --- 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 d6258bb06..aea80d29f 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -73,7 +73,7 @@ class Keep2shareCC(SimpleHoster): def handleCaptcha(self): recaptcha = ReCaptcha(self) - for _ in xrange(5): + for _i in xrange(5): post_data = {'free': 1, 'freeDownloadRequest': 1, 'uniqueId': self.fid, -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- 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 aea80d29f..bd7825d08 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -66,7 +66,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Unable to detect direct link") + self.error(_("LINK_PATTERN not found")) self.startDownload(m.group(1)) @@ -96,7 +96,7 @@ class Keep2shareCC(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("All captcha attempts failed") + self.fail(_("All captcha attempts failed")) def startDownload(self, url): -- cgit v1.2.3 From 8b3589dd394d81177bf4680dddb5bdb9506b89ea Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:04:10 +0100 Subject: Update plugins to last changes --- 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 bd7825d08..36b5bfad3 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -54,14 +54,14 @@ 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(':')))]) - self.wait(wait_time, reconnect=True) + self.wait(wait_time, True) self.retry() m = re.search(self.MULTIDL_ERROR, self.html) if m: # if someone is already downloading on our line, wait 30min and retry self.logDebug("Already downloading, waiting for 30 minutes") - self.wait(30 * 60, reconnect=True) + self.wait(30 * 60, True) self.retry() m = re.search(self.LINK_PATTERN, self.html) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/Keep2shareCC.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/Keep2shareCC.py') diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index 36b5bfad3..e570d534d 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -9,16 +9,16 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class Keep2shareCC(SimpleHoster): - __name__ = "Keep2shareCC" - __type__ = "hoster" + __name__ = "Keep2shareCC" + __type__ = "hoster" __version__ = "0.13" __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")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] FILE_NAME_PATTERN = r'File: (?P.+)' -- cgit v1.2.3 From 772e47ef806d18fd209e910be0535bce7c07dc7b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:47:07 +0100 Subject: Update all other plugins --- 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 e570d534d..fb4352147 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -21,8 +21,8 @@ class Keep2shareCC(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - FILE_NAME_PATTERN = r'File: (?P.+)' - FILE_SIZE_PATTERN = r'Size: (?P[^<]+)' + 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' LINK_PATTERN = r'To download this file with slow speed, use this link' -- cgit v1.2.3 From 5fe85e1ec8dd4d54d55491d26a5c41a0bde38176 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 9 Nov 2014 22:21:51 +0100 Subject: [Keep2shareCc] Fix file name --- module/plugins/hoster/Keep2shareCC.py | 116 ---------------------------------- 1 file changed, 116 deletions(-) delete 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 deleted file mode 100644 index fb4352147..000000000 --- a/module/plugins/hoster/Keep2shareCC.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urlparse, 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.13" - - __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")] - - - 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' - - LINK_PATTERN = r'To download this file with slow speed, use this link' - CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' - WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' - MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time' - - - def handleFree(self): - self.sanitize_url() - self.html = self.load(self.pyfile.url) - - self.fid = re.search(r'', self.html).group(1) - self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) - - m = re.search(r"function download\(\){.*window\.location\.href = '([^']+)';", self.html, re.S) - if m: # Direct mode - self.startDownload(m.group(1)) - else: - self.handleCaptcha() - - self.wait(30) - - self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - 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.wait(wait_time, True) - self.retry() - - m = re.search(self.MULTIDL_ERROR, self.html) - if m: - # if someone is already downloading on our line, wait 30min and retry - self.logDebug("Already downloading, waiting for 30 minutes") - self.wait(30 * 60, True) - self.retry() - - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("LINK_PATTERN not found")) - self.startDownload(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(self.base_url, 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")) - - - def startDownload(self, url): - d = urljoin(self.base_url, url) - self.logDebug("Direct Link: " + d) - self.download(d, disposition=True) - - - def sanitize_url(self): - header = self.load(self.pyfile.url, just_header=True) - if 'location' in header: - self.pyfile.url = header['location'] - p = urlparse(self.pyfile.url) - self.base_url = "%s://%s" % (p.scheme, p.hostname) - - -getInfo = create_getInfo(Keep2shareCC) -- cgit v1.2.3