From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/hoster/LetitbitNet.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'module/plugins/hoster/LetitbitNet.py') diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 62afb6c7c..60634354b 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -12,7 +12,7 @@ import urlparse from module.common.json_layer import json_loads, json_dumps from module.network.RequestFactory import getURL from module.plugins.internal.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight +from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnight def api_response(url): @@ -22,7 +22,7 @@ def api_response(url): return json_loads(api_rep) -def getInfo(urls): +def get_info(urls): for url in urls: api_rep = api_response(url) if api_rep['status'] == 'OK': @@ -35,7 +35,7 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -53,16 +53,16 @@ class LetitbitNet(SimpleHoster): def setup(self): - self.resumeDownload = True + self.resume_download = True - def handleFree(self, pyfile): - action, inputs = self.parseHtmlForm('id="ifree_form"') + def handle_free(self, pyfile): + action, inputs = self.parse_html_form('id="ifree_form"') if not action: self.error(_("ifree_form")) pyfile.size = float(inputs['sssize']) - self.logDebug(action, inputs) + self.log_debug(action, inputs) inputs['desc'] = "" self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs) @@ -70,12 +70,12 @@ class LetitbitNet(SimpleHoster): m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 - self.logDebug("Seconds found", seconds) + self.log_debug("Seconds found", seconds) 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.log_debug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds) @@ -83,7 +83,7 @@ class LetitbitNet(SimpleHoster): if res != '1': self.error(_("Unknown response - ajax_check_url")) - self.logDebug(res) + self.log_debug(res) recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() @@ -92,21 +92,21 @@ class LetitbitNet(SimpleHoster): "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} - self.logDebug("Post data to send", post_data) + self.log_debug("Post data to send", post_data) res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data) - self.logDebug(res) + self.log_debug(res) if not res: - self.invalidCaptcha() + self.invalid_captcha() if res == "error_free_download_blocked": - self.logWarning(_("Daily limit reached")) - self.wait(secondsToMidnight(gmt=2), True) + self.log_warning(_("Daily limit reached")) + self.wait(seconds_to_midnight(gmt=2), True) if res == "error_wrong_captcha": - self.invalidCaptcha() + self.invalid_captcha() self.retry() elif res.startswith('['): @@ -121,13 +121,13 @@ class LetitbitNet(SimpleHoster): self.link = urls[0] - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - self.logDebug("API Data: " + api_rep) + self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) if api_rep['status'] == 'FAIL': -- cgit v1.2.3 From d2e2b127651a5a44b56337eb6d9ca246c97a208a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Jul 2015 03:03:26 +0200 Subject: Spare fixes and 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 60634354b..15a46066a 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -123,7 +123,7 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): api_key = self.user - premium_key = self.account.getAccountData(self.user)['password'] + premium_key = self.account.get_account_data(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) -- cgit v1.2.3 From 9e5d813d7721e351ac02ba72bdc473a7d77ba6b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Jul 2015 20:04:36 +0200 Subject: Code 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 15a46066a..061311bab 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -10,14 +10,14 @@ import re import urlparse from module.common.json_layer import json_loads, json_dumps -from module.network.RequestFactory import getURL +from module.network.RequestFactory import getURL as get_url from module.plugins.internal.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnight def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] - api_rep = getURL("http://api.letitbit.net/json", + api_rep = get_url("http://api.letitbit.net/json", post={'r': json_dumps(json_data)}) return json_loads(api_rep) -- cgit v1.2.3 From ff9383bfe06d14d23bc0ed6af79aa8967965d078 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 10:59:52 +0200 Subject: Code cosmetics (3) --- 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 061311bab..8e912bcb8 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnig def api_response(url): - json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] + json_data = ["yw7XQy2v9", ["download/info", {'link': url}]] api_rep = get_url("http://api.letitbit.net/json", post={'r': json_dumps(json_data)}) return json_loads(api_rep) @@ -88,9 +88,9 @@ class LetitbitNet(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() - post_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field": response, - "recaptcha_control_field": recaptcha_control_field} + post_data = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'recaptcha_control_field': recaptcha_control_field} self.log_debug("Post data to send", post_data) @@ -125,7 +125,7 @@ class LetitbitNet(SimpleHoster): api_key = self.user premium_key = self.account.get_account_data(self.user)['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] + json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) -- cgit v1.2.3 From 33e2b36605e41962a2e8eee304a7f3d29690ffa8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 13:42:29 +0200 Subject: [OCR] Fix __init__ (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 8e912bcb8..1676a9399 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -18,7 +18,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnig def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {'link': url}]] api_rep = get_url("http://api.letitbit.net/json", - post={'r': json_dumps(json_data)}) + post={'r': json_dumps(json_data)}) return json_loads(api_rep) -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- 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 1676a9399..63c57c9a5 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -36,6 +36,7 @@ class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" __version__ = "0.32" + __status__ = "stable" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] -- cgit v1.2.3 From 027cb529d79558de19c47da88a782b31745a65c9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 21 Jul 2015 22:53:37 +0200 Subject: New Captcha skeleton --- 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 63c57c9a5..92bb5ab62 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -100,14 +100,14 @@ class LetitbitNet(SimpleHoster): self.log_debug(res) if not res: - self.invalid_captcha() + self.captcha.invalid() if res == "error_free_download_blocked": self.log_warning(_("Daily limit reached")) self.wait(seconds_to_midnight(gmt=2), True) if res == "error_wrong_captcha": - self.invalid_captcha() + self.captcha.invalid() self.retry() elif res.startswith('['): -- cgit v1.2.3 From 6af9b38a8d5d49355b85aef6ddd003605d6bba05 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Jul 2015 23:44:45 +0200 Subject: Improve Captcha --- 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 92bb5ab62..59d1ae41b 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -11,7 +11,7 @@ import urlparse from module.common.json_layer import json_loads, json_dumps from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.ReCaptcha import ReCaptcha +from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnight -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (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 59d1ae41b..b08fd515f 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -36,7 +36,7 @@ class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" __version__ = "0.32" - __status__ = "stable" + __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code 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 b08fd515f..03314548c 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -25,7 +25,7 @@ def api_response(url): def get_info(urls): for url in urls: api_rep = api_response(url) - if api_rep['status'] == 'OK': + if api_rep['status'] == "OK": info = api_rep['data'][0] yield (info['name'], info['size'], 2, url) else: @@ -131,7 +131,7 @@ class LetitbitNet(SimpleHoster): self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) - if api_rep['status'] == 'FAIL': + if api_rep['status'] == "FAIL": self.fail(api_rep['data']) self.link = api_rep['data'][0][0] -- cgit v1.2.3 From 8f17f875f6e28f73ddb10da59c6464bd04922222 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 04:59:27 +0200 Subject: Account rewritten --- 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 03314548c..b3aaa892e 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -124,7 +124,7 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): api_key = self.user - premium_key = self.account.get_account_data(self.user)['password'] + premium_key = self.account.get_data(self.user)['password'] json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) -- cgit v1.2.3 From a95c217627a1cb651b24e69f20640df40797aff9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 09:34:18 +0200 Subject: Account rewritten (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 b3aaa892e..e93b60460 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -124,7 +124,7 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): api_key = self.user - premium_key = self.account.get_data(self.user)['password'] + premium_key = self.account.get_info(self.user)['login']['password'] json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) -- cgit v1.2.3