From 0072668fd976f9ce4dbaac7e807791f21cbe07ed Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 6 Jul 2014 18:57:55 +0200 Subject: Compute wait time using secondsToMidnight --- module/plugins/hoster/LetitbitNet.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 58532fd28..62743d468 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -13,22 +13,21 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: zoidberg """ # API Documentation: # http://api.letitbit.net/reg/static/api.pdf - # Test links (random.bin): # http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html import re import urllib -from module.plugins.internal.SimpleHoster import SimpleHoster from module.common.json_layer import json_loads, json_dumps + +from module.plugins.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster def api_download_info(url): @@ -52,7 +51,7 @@ class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' - __version__ = "0.23" + __version__ = "0.24" __description__ = """Letitbit.net hoster plugin""" __author_name__ = ("zoidberg", "z00nx") __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com") @@ -126,10 +125,10 @@ class LetitbitNet(SimpleHoster): if not response: self.invalidCaptcha() if response == "error_free_download_blocked": - self.logInfo("Daily limit reached, waiting 24 hours") - self.wait(24 * 60 * 60) + self.logWarning("Daily limit reached") + self.wait(secondsToMidnight(gmt=2), True) if response == "error_wrong_captcha": - self.logInfo("Wrong Captcha") + self.logError("Wrong Captcha") self.invalidCaptcha() self.retry() elif response.startswith('['): -- 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/LetitbitNet.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 62743d468..3814cfd9b 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -56,14 +56,16 @@ class LetitbitNet(SimpleHoster): __author_name__ = ("zoidberg", "z00nx") __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com") - CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';" - SECONDS_PATTERN = r"seconds\s*=\s*(\d+);" - CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P[^']+)'" - - DOMAIN = "http://letitbit.net" FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] + + HOSTER_NAME = "letitbit.net" + + #CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';" + SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' + CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P[^']+)'" RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" + def setup(self): self.resumeDownload = True #TODO confirm that resume works @@ -81,11 +83,13 @@ class LetitbitNet(SimpleHoster): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: self.parseError("page 1 / ifree_form") + + domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(self.DOMAIN + action, post=inputs, cookies=True) + self.html = self.load(domain + action, post=inputs, cookies=True) # action, inputs = self.parseHtmlForm('id="d3_form"') # if not action: self.parseError("page 2 / d3_form") @@ -110,7 +114,7 @@ class LetitbitNet(SimpleHoster): self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds + 1) - response = self.load("%s/ajax/download3.php" % self.DOMAIN, post=" ", cookies=True) + response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': self.parseError('Unknown response - ajax_check_url') self.logDebug(response) @@ -120,7 +124,7 @@ class LetitbitNet(SimpleHoster): post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load('%s/ajax/check_recaptcha.php' % self.DOMAIN, post=post_data, cookies=True) + response = self.load('%s/ajax/check_recaptcha.php' % domain, post=post_data, cookies=True) self.logDebug(response) if not response: self.invalidCaptcha() -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/LetitbitNet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3814cfd9b..3df1e8330 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -92,8 +92,9 @@ class LetitbitNet(SimpleHoster): self.html = self.load(domain + action, post=inputs, cookies=True) # action, inputs = self.parseHtmlForm('id="d3_form"') - # if not action: self.parseError("page 2 / d3_form") - # #self.logDebug(action, inputs) + # if not action: + # self.parseError("page 2 / d3_form") + # self.logDebug(action, inputs) # # self.html = self.load(action, post = inputs, cookies = True) # -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/LetitbitNet.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3df1e8330..1ebed3bd4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -31,9 +31,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster def api_download_info(url): - json_data = ['yw7XQy2v9', ["download/info", {"link": url}]] + json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] post_data = urllib.urlencode({'r': json_dumps(json_data)}) - api_rep = urllib.urlopen('http://api.letitbit.net/json', data=post_data).read() + api_rep = urllib.urlopen("http://api.letitbit.net/json", data=post_data).read() return json_loads(api_rep) @@ -157,7 +157,7 @@ class LetitbitNet(SimpleHoster): def handlePremium(self): api_key = self.user - premium_key = self.account.getAccountData(self.user)["password"] + premium_key = self.account.getAccountData(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) -- cgit v1.2.3 From 544900fde4e3f4441371ed7328aef07f51b5a358 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 16 Jul 2014 01:14:52 +0200 Subject: Remove some unused pattern attributes --- module/plugins/hoster/LetitbitNet.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 1ebed3bd4..a492a87ff 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -60,7 +60,6 @@ class LetitbitNet(SimpleHoster): HOSTER_NAME = "letitbit.net" - #CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';" SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P[^']+)'" RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/LetitbitNet.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index a492a87ff..1a5928f17 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -99,18 +99,18 @@ class LetitbitNet(SimpleHoster): # # try: # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups() - # found = re.search(self.SECONDS_PATTERN, self.html) - # seconds = int(found.group(1)) if found else 60 + # m = re.search(self.SECONDS_PATTERN, self.html) + # seconds = int(m.group(1)) if m else 60 # self.wait(seconds+1) # except Exception, e: # self.logError(e) # self.parseError("page 3 / js") - found = re.search(self.SECONDS_PATTERN, self.html) - seconds = int(found.group(1)) if found else 60 + m = re.search(self.SECONDS_PATTERN, self.html) + seconds = int(m.group(1)) if m else 60 self.logDebug("Seconds found", seconds) - found = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) - recaptcha_control_field = found.group(1) + 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 + 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/LetitbitNet.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 1a5928f17..3159be4f1 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -1,30 +1,16 @@ # -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - +# # API Documentation: # http://api.letitbit.net/reg/static/api.pdf -# Test links (random.bin): +# +# Test links: # http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html import re -import urllib -from module.common.json_layer import json_loads, json_dumps +from urllib import urlencode, urlopen +from module.common.json_layer import json_loads, json_dumps from module.plugins.hoster.UnrestrictLi import secondsToMidnight from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster @@ -32,8 +18,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster def api_download_info(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] - post_data = urllib.urlencode({'r': json_dumps(json_data)}) - api_rep = urllib.urlopen("http://api.letitbit.net/json", data=post_data).read() + post_data = urlencode({'r': json_dumps(json_data)}) + api_rep = urlopen("http://api.letitbit.net/json", data=post_data).read() return json_loads(api_rep) @@ -50,8 +36,10 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' __version__ = "0.24" + + __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' + __description__ = """Letitbit.net hoster plugin""" __author_name__ = ("zoidberg", "z00nx") __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com") -- 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/LetitbitNet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3159be4f1..ec1dd14bd 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -148,13 +148,13 @@ class LetitbitNet(SimpleHoster): json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - self.logDebug('API Data: ' + api_rep) + self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) direct_link = api_rep['data'][0][0] - self.logDebug('Direct Link: ' + direct_link) + self.logDebug("Direct Link: " + direct_link) self.download(direct_link, disposition=True) -- 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/LetitbitNet.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index ec1dd14bd..2d6130d3c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -50,7 +50,6 @@ class LetitbitNet(SimpleHoster): SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P[^']+)'" - RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" def setup(self): @@ -108,7 +107,13 @@ class LetitbitNet(SimpleHoster): self.logDebug(response) recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + + captcha_key = recaptcha.detect_key() + if captcha_key is None: + self.parseError("ReCaptcha key not found") + + challenge, response = recaptcha.challenge(captcha_key) + post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) -- 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/LetitbitNet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 2d6130d3c..a9f41b795 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -41,8 +41,9 @@ class LetitbitNet(SimpleHoster): __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' __description__ = """Letitbit.net hoster plugin""" - __author_name__ = ("zoidberg", "z00nx") - __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com") + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("z00nx", "z00nx0@gmail.com")] + FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] -- 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/LetitbitNet.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index a9f41b795..cae7fdf67 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -41,6 +41,7 @@ class LetitbitNet(SimpleHoster): __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' __description__ = """Letitbit.net hoster plugin""" + __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("z00nx", "z00nx0@gmail.com")] -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/LetitbitNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index cae7fdf67..68d768b7c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -38,7 +38,7 @@ class LetitbitNet(SimpleHoster): __type__ = "hoster" __version__ = "0.24" - __pattern__ = r'http://(?:www\.)?(letitbit|shareflare).net/download/.*' + __pattern__ = r'http://(?:www\.)?(letitbit|shareflare)\.net/download/.*' __description__ = """Letitbit.net hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 8939f015a688a07ec7d0bd14b6a3704f6a2cb4a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:12:40 +0200 Subject: Pattern update 3 --- module/plugins/hoster/LetitbitNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 68d768b7c..17e638a18 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -51,7 +51,7 @@ class LetitbitNet(SimpleHoster): HOSTER_NAME = "letitbit.net" SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' - CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P[^']+)'" + CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P.+?)\'' def setup(self): -- 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/LetitbitNet.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 17e638a18..8443c2206 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -36,7 +36,7 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = r'http://(?:www\.)?(letitbit|shareflare)\.net/download/.*' @@ -70,7 +70,7 @@ class LetitbitNet(SimpleHoster): def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: - self.parseError("page 1 / ifree_form") + self.error("page 1 / ifree_form") domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) @@ -81,7 +81,7 @@ class LetitbitNet(SimpleHoster): # action, inputs = self.parseHtmlForm('id="d3_form"') # if not action: - # self.parseError("page 2 / d3_form") + # self.error("page 2 / d3_form") # self.logDebug(action, inputs) # # self.html = self.load(action, post = inputs, cookies = True) @@ -93,7 +93,7 @@ class LetitbitNet(SimpleHoster): # self.wait(seconds+1) # except Exception, e: # self.logError(e) - # self.parseError("page 3 / js") + # self.error("page 3 / js") m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 @@ -105,14 +105,14 @@ class LetitbitNet(SimpleHoster): response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': - self.parseError('Unknown response - ajax_check_url') + self.error('Unknown response - ajax_check_url') self.logDebug(response) recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha key not found") + self.error("ReCaptcha key not found") challenge, response = recaptcha.challenge(captcha_key) @@ -135,7 +135,7 @@ class LetitbitNet(SimpleHoster): elif response.startswith('http://'): urls = [response] else: - self.parseError("Unknown response - captcha check") + self.error("Unknown response - captcha check") self.correctCaptcha() -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hoster/LetitbitNet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 8443c2206..002c986e2 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -56,7 +56,7 @@ class LetitbitNet(SimpleHoster): def setup(self): self.resumeDownload = True - #TODO confirm that resume works + def getFileInfo(self): api_rep = api_download_info(self.pyfile.url) @@ -67,6 +67,7 @@ class LetitbitNet(SimpleHoster): else: self.offline() + def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: @@ -149,6 +150,7 @@ class LetitbitNet(SimpleHoster): else: self.fail("Download did not finish correctly") + def handlePremium(self): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] -- cgit v1.2.3 From 7b67f68c1636014fe02286da71bdc6c13dc3eeee Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 00:50:23 +0200 Subject: Simplify captcha challenge calls --- module/plugins/hoster/LetitbitNet.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 002c986e2..9357cc758 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -110,12 +110,7 @@ class LetitbitNet(SimpleHoster): self.logDebug(response) recaptcha = ReCaptcha(self) - - captcha_key = recaptcha.detect_key() - if captcha_key is None: - self.error("ReCaptcha key not found") - - challenge, response = recaptcha.challenge(captcha_key) + challenge, response = recaptcha.challenge() post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} -- 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/LetitbitNet.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 9357cc758..983a50c6c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -71,7 +71,7 @@ class LetitbitNet(SimpleHoster): def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: - self.error("page 1 / ifree_form") + self.error("ifree_form") domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) @@ -80,22 +80,6 @@ class LetitbitNet(SimpleHoster): self.html = self.load(domain + action, post=inputs, cookies=True) - # action, inputs = self.parseHtmlForm('id="d3_form"') - # if not action: - # self.error("page 2 / d3_form") - # self.logDebug(action, inputs) - # - # self.html = self.load(action, post = inputs, cookies = True) - # - # try: - # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups() - # m = re.search(self.SECONDS_PATTERN, self.html) - # seconds = int(m.group(1)) if m else 60 - # self.wait(seconds+1) - # except Exception, e: - # self.logError(e) - # self.error("page 3 / js") - m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 self.logDebug("Seconds found", seconds) @@ -106,7 +90,7 @@ class LetitbitNet(SimpleHoster): response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': - self.error('Unknown response - ajax_check_url') + self.error("Unknown response - ajax_check_url") self.logDebug(response) recaptcha = ReCaptcha(self) @@ -123,7 +107,6 @@ class LetitbitNet(SimpleHoster): self.logWarning("Daily limit reached") self.wait(secondsToMidnight(gmt=2), True) if response == "error_wrong_captcha": - self.logError("Wrong Captcha") self.invalidCaptcha() self.retry() elif response.startswith('['): @@ -137,7 +120,6 @@ class LetitbitNet(SimpleHoster): for download_url in urls: try: - self.logDebug("Download URL", download_url) self.download(download_url) break except Exception, e: -- 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/LetitbitNet.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 983a50c6c..94702e4ab 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -71,7 +71,7 @@ class LetitbitNet(SimpleHoster): def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: - self.error("ifree_form") + self.error(_("ifree_form")) domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) @@ -90,7 +90,7 @@ class LetitbitNet(SimpleHoster): response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': - self.error("Unknown response - ajax_check_url") + self.error(_("Unknown response - ajax_check_url")) self.logDebug(response) recaptcha = ReCaptcha(self) @@ -104,7 +104,7 @@ class LetitbitNet(SimpleHoster): if not response: self.invalidCaptcha() if response == "error_free_download_blocked": - self.logWarning("Daily limit reached") + self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) if response == "error_wrong_captcha": self.invalidCaptcha() @@ -114,7 +114,7 @@ class LetitbitNet(SimpleHoster): elif response.startswith('http://'): urls = [response] else: - self.error("Unknown response - captcha check") + self.error(_("Unknown response - captcha check")) self.correctCaptcha() @@ -125,7 +125,7 @@ class LetitbitNet(SimpleHoster): except Exception, e: self.logError(e) else: - self.fail("Download did not finish correctly") + self.fail(_("Download did not finish correctly")) def handlePremium(self): -- 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/LetitbitNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 94702e4ab..8a5765a8c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -86,7 +86,7 @@ class LetitbitNet(SimpleHoster): 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 + 1) + self.wait(seconds) response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': -- 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/LetitbitNet.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 8a5765a8c..b370544ee 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -34,16 +34,16 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): - __name__ = "LetitbitNet" - __type__ = "hoster" + __name__ = "LetitbitNet" + __type__ = "hoster" __version__ = "0.25" __pattern__ = r'http://(?:www\.)?(letitbit|shareflare)\.net/download/.*' __description__ = """Letitbit.net hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("z00nx", "z00nx0@gmail.com")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("z00nx", "z00nx0@gmail.com")] FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] -- cgit v1.2.3 From a372550e6eaf0d0235e68f2d20535123410e121f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 2 Nov 2014 22:46:15 +0100 Subject: [LetitbitNet][Share4webCom][UnibytesCom] https support + use urljoin + update PATTERNs --- module/plugins/hoster/LetitbitNet.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index b370544ee..aacd74f7a 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -9,6 +9,7 @@ import re from urllib import urlencode, urlopen +from urlparse import urljoin from module.common.json_layer import json_loads, json_dumps from module.plugins.hoster.UnrestrictLi import secondsToMidnight @@ -36,9 +37,9 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" - __pattern__ = r'http://(?:www\.)?(letitbit|shareflare)\.net/download/.*' + __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.*' __description__ = """Letitbit.net hoster plugin""" __license__ = "GPLv3" @@ -46,9 +47,7 @@ class LetitbitNet(SimpleHoster): ("z00nx", "z00nx0@gmail.com")] - FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] - - HOSTER_NAME = "letitbit.net" + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P.+?)\'' @@ -73,12 +72,11 @@ class LetitbitNet(SimpleHoster): if not action: self.error(_("ifree_form")) - domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(domain + action, post=inputs, cookies=True) + self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs, cookies=True) m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 @@ -88,7 +86,7 @@ class LetitbitNet(SimpleHoster): self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds) - response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) + response = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) if response != '1': self.error(_("Unknown response - ajax_check_url")) self.logDebug(response) @@ -99,7 +97,7 @@ class LetitbitNet(SimpleHoster): post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load('%s/ajax/check_recaptcha.php' % domain, post=post_data, cookies=True) + response = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) self.logDebug(response) if not response: self.invalidCaptcha() -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/LetitbitNet.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index aacd74f7a..a1a812de4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -86,31 +86,32 @@ class LetitbitNet(SimpleHoster): self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds) - response = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) - if response != '1': + res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) + if res != '1': self.error(_("Unknown response - ajax_check_url")) - self.logDebug(response) + self.logDebug(res) recaptcha = ReCaptcha(self) challenge, response = recaptcha.challenge() - post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, + post_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) - self.logDebug(response) - if not response: + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + self.logDebug(res) + if not res: self.invalidCaptcha() - if response == "error_free_download_blocked": + if res == "error_free_download_blocked": self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) - if response == "error_wrong_captcha": + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() - elif response.startswith('['): - urls = json_loads(response) - elif response.startswith('http://'): - urls = [response] + elif res.startswith('['): + urls = json_loads(res) + elif res.startswith('http://'): + urls = [res] else: self.error(_("Unknown response - captcha check")) -- cgit v1.2.3 From 86d3b6249073947132ed3a9eeb1b1e987d19569a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 1 Dec 2014 18:17:13 +0100 Subject: Update some plugins --- module/plugins/hoster/LetitbitNet.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index a1a812de4..ed8d4a39d 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -139,7 +139,4 @@ class LetitbitNet(SimpleHoster): if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) - direct_link = api_rep['data'][0][0] - self.logDebug("Direct Link: " + direct_link) - - self.download(direct_link, disposition=True) + self.download(api_rep['data'][0][0], disposition=True) -- cgit v1.2.3 From 854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:45:04 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/LetitbitNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index ed8d4a39d..5fcb5e08b 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -50,7 +50,7 @@ class LetitbitNet(SimpleHoster): URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' - CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P.+?)\'' + CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(.+?)\'' def setup(self): -- cgit v1.2.3 From b6a2bd53628bd2824bac1dafc7b4eafdf3c815dd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:48:03 +0100 Subject: Update plugins after SimpleHoster changes --- module/plugins/hoster/LetitbitNet.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 5fcb5e08b..a7b11047f 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -12,9 +12,8 @@ from urllib import urlencode, urlopen from urlparse import urljoin from module.common.json_layer import json_loads, json_dumps -from module.plugins.hoster.UnrestrictLi import secondsToMidnight 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): @@ -37,9 +36,9 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" - __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.*' + __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __description__ = """Letitbit.net hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3