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/FilecloudIo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 56eedf33a..4977742af 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -34,7 +34,7 @@ class FilecloudIo(SimpleHoster): FILE_SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' FILE_NAME_PATTERN = r'id="aliasSpan">(?P.*?)  <' - FILE_OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)' + OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING' UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," -- 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/FilecloudIo.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 4977742af..5b9d86007 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -18,7 +18,7 @@ """ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.common.json_layer import json_loads from module.plugins.internal.CaptchaService import ReCaptcha @@ -39,10 +39,11 @@ class FilecloudIo(SimpleHoster): UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" - ERROR_MSG_PATTERN = r"var __error_msg\s*=\s*l10n\.(.*?);" - DOWNLOAD_LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - RECAPTCHA_KEY = '6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1' + RECAPTCHA_KEY = "6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1" + def setup(self): self.resumeDownload = self.multiDL = True @@ -53,7 +54,7 @@ class FilecloudIo(SimpleHoster): found = re.search(self.AB1_PATTERN, self.html) if not found: - raise PluginParseError("__AB1") + self.parseError("__AB1") data["__ab1"] = found.group(1) if not self.account: @@ -99,9 +100,9 @@ class FilecloudIo(SimpleHoster): if response["dl"]: self.html = self.load('http://filecloud.io/download.html') - found = re.search(self.DOWNLOAD_LINK_PATTERN % self.file_info['ID'], self.html) + found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if not found: - raise PluginParseError("Download URL") + self.parseError("Download URL") download_url = found.group(1) self.logDebug("Download URL: %s" % download_url) -- cgit v1.2.3 From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/hoster/FilecloudIo.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 5b9d86007..13265e3e4 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: zoidberg """ import re -- 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/FilecloudIo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 13265e3e4..5d2d4b3c0 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -53,7 +53,7 @@ class FilecloudIo(SimpleHoster): found = re.search(self.AB1_PATTERN, self.html) if not found: self.parseError("__AB1") - data["__ab1"] = found.group(1) + data['__ab1'] = found.group(1) if not self.account: self.fail("User not logged in") @@ -70,25 +70,25 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) response = json_loads(response) - if "error" in response and response["error"]: + if "error" in response and response['error']: self.fail(response) self.logDebug(response) - if response["captcha"]: + if response['captcha']: recaptcha = ReCaptcha(self) found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) captcha_key = found.group(1) if found else self.RECAPTCHA_KEY - data["ctype"] = "recaptcha" + data['ctype'] = "recaptcha" for _ in xrange(5): - data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key) + data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" response = self.load(json_url, post=data) self.logDebug(response) response = json_loads(response) - if "retry" in response and response["retry"]: + if "retry" in response and response['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -96,7 +96,7 @@ class FilecloudIo(SimpleHoster): else: self.fail("Incorrect captcha") - if response["dl"]: + if response['dl']: self.html = self.load('http://filecloud.io/download.html') found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if not found: -- 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/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 5d2d4b3c0..fadbdeb1d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -51,7 +51,7 @@ class FilecloudIo(SimpleHoster): data = {"ukey": self.file_info['ID']} found = re.search(self.AB1_PATTERN, self.html) - if not found: + if found is None: self.parseError("__AB1") data['__ab1'] = found.group(1) @@ -99,7 +99,7 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) - if not found: + if found is None: self.parseError("Download URL") download_url = found.group(1) self.logDebug("Download URL: %s" % download_url) -- 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/FilecloudIo.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index fadbdeb1d..8fc1ddca2 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -50,10 +50,10 @@ class FilecloudIo(SimpleHoster): def handleFree(self): data = {"ukey": self.file_info['ID']} - found = re.search(self.AB1_PATTERN, self.html) - if found is None: + m = re.search(self.AB1_PATTERN, self.html) + if m is None: self.parseError("__AB1") - data['__ab1'] = found.group(1) + data['__ab1'] = m.group(1) if not self.account: self.fail("User not logged in") @@ -76,8 +76,8 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) if response['captcha']: recaptcha = ReCaptcha(self) - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - captcha_key = found.group(1) if found else self.RECAPTCHA_KEY + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + captcha_key = m.group(1) if m else self.RECAPTCHA_KEY data['ctype'] = "recaptcha" for _ in xrange(5): @@ -98,10 +98,10 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') - found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) - if found is None: + m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) + if m is None: self.parseError("Download URL") - download_url = found.group(1) + download_url = m.group(1) self.logDebug("Download URL: %s" % download_url) if "size" in self.file_info and self.file_info['size']: -- 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/FilecloudIo.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 8fc1ddca2..025bd483f 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -1,31 +1,19 @@ # -*- 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 . -""" - import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + from module.common.json_layer import json_loads from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' __version__ = "0.02" + + __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' + __description__ = """Filecloud.io hoster plugin""" __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") -- 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/FilecloudIo.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 025bd483f..c90e7d6d8 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -26,9 +26,9 @@ class FilecloudIo(SimpleHoster): UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" + LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' - RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - RECAPTCHA_KEY = "6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1" def setup(self): @@ -43,11 +43,18 @@ class FilecloudIo(SimpleHoster): self.parseError("__AB1") data['__ab1'] = m.group(1) + recaptcha = ReCaptcha(self) + + m = re.search(self.RECAPTCHA_PATTERN, self.html) + captcha_key = m.group(1) if m else recaptcha.detect_key() + + if captcha_key is None: + self.parseError("ReCaptcha key not found") + if not self.account: self.fail("User not logged in") elif not self.account.logged_in: - recaptcha = ReCaptcha(self) - captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY) + captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, "recaptcha_response_field": captcha_response} self.account.relogin(self.user) @@ -63,9 +70,6 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) if response['captcha']: - recaptcha = ReCaptcha(self) - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - captcha_key = m.group(1) if m else self.RECAPTCHA_KEY data['ctype'] = "recaptcha" for _ in xrange(5): -- 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/FilecloudIo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index c90e7d6d8..dd53422b4 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -15,8 +15,9 @@ class FilecloudIo(SimpleHoster): __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' __description__ = """Filecloud.io hoster plugin""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + FILE_SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' FILE_NAME_PATTERN = r'id="aliasSpan">(?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/FilecloudIo.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index dd53422b4..a3cc47bf0 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -15,6 +15,7 @@ class FilecloudIo(SimpleHoster): __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' __description__ = """Filecloud.io hoster plugin""" + __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] -- 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/FilecloudIo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index a3cc47bf0..6d60bf793 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -22,15 +22,15 @@ class FilecloudIo(SimpleHoster): FILE_SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' FILE_NAME_PATTERN = r'id="aliasSpan">(?P.*?)  <' - OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)' - TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' + LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' def setup(self): -- 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/FilecloudIo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 6d60bf793..da7683160 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -25,10 +25,10 @@ class FilecloudIo(SimpleHoster): OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' - UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," - AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" + UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' - RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' -- 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/FilecloudIo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index da7683160..5672e780d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' @@ -42,7 +42,7 @@ class FilecloudIo(SimpleHoster): m = re.search(self.AB1_PATTERN, self.html) if m is None: - self.parseError("__AB1") + self.error("__AB1") data['__ab1'] = m.group(1) recaptcha = ReCaptcha(self) @@ -51,7 +51,7 @@ class FilecloudIo(SimpleHoster): captcha_key = m.group(1) if m else recaptcha.detect_key() if captcha_key is None: - self.parseError("ReCaptcha key not found") + self.error("ReCaptcha key not found") if not self.account: self.fail("User not logged in") @@ -94,7 +94,7 @@ class FilecloudIo(SimpleHoster): self.html = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if m is None: - self.parseError("Download URL") + self.error("Download URL") download_url = m.group(1) self.logDebug("Download URL: %s" % download_url) -- 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/FilecloudIo.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 5672e780d..659a2cc0f 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -37,6 +37,7 @@ class FilecloudIo(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def handleFree(self): data = {"ukey": self.file_info['ID']} @@ -104,6 +105,7 @@ class FilecloudIo(SimpleHoster): else: self.fail("Unexpected server response") + def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] ukey = self.file_info['ID'] -- 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/FilecloudIo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 659a2cc0f..74652be04 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -93,14 +93,15 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') + m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if m is None: self.error("Download URL") - download_url = m.group(1) - self.logDebug("Download URL: %s" % download_url) if "size" in self.file_info and self.file_info['size']: self.check_data = {"size": int(self.file_info['size'])} + + download_url = m.group(1) self.download(download_url) else: self.fail("Unexpected server response") -- 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/FilecloudIo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 74652be04..60b4838ec 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -75,7 +75,7 @@ class FilecloudIo(SimpleHoster): if response['captcha']: data['ctype'] = "recaptcha" - for _ in xrange(5): + for _i in xrange(5): data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" -- 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/FilecloudIo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 60b4838ec..6f8f3f775 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -43,7 +43,7 @@ class FilecloudIo(SimpleHoster): m = re.search(self.AB1_PATTERN, self.html) if m is None: - self.error("__AB1") + self.error(_("__AB1")) data['__ab1'] = m.group(1) recaptcha = ReCaptcha(self) @@ -52,10 +52,10 @@ class FilecloudIo(SimpleHoster): captcha_key = m.group(1) if m else recaptcha.detect_key() if captcha_key is None: - self.error("ReCaptcha key not found") + self.error(_("ReCaptcha key not found")) if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) elif not self.account.logged_in: captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, @@ -89,14 +89,14 @@ class FilecloudIo(SimpleHoster): self.correctCaptcha() break else: - self.fail("Incorrect captcha") + self.fail(_("Incorrect captcha")) if response['dl']: self.html = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if m is None: - self.error("Download URL") + self.error(_("LINK_PATTERN not found")) if "size" in self.file_info and self.file_info['size']: self.check_data = {"size": int(self.file_info['size'])} @@ -104,7 +104,7 @@ class FilecloudIo(SimpleHoster): download_url = m.group(1) self.download(download_url) else: - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) def handlePremium(self): -- 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/FilecloudIo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 6f8f3f775..b54189059 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -8,16 +8,16 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): - __name__ = "FilecloudIo" - __type__ = "hoster" + __name__ = "FilecloudIo" + __type__ = "hoster" __version__ = "0.03" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' __description__ = """Filecloud.io hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] FILE_SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' -- 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/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index b54189059..a5469ceb9 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -20,8 +20,8 @@ class FilecloudIo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - FILE_SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' - FILE_NAME_PATTERN = r'id="aliasSpan">(?P.*?)  <' + SIZE_PATTERN = r'{var __ab1 = (?P\d+);}' + NAME_PATTERN = r'id="aliasSpan">(?P.*?)  <' OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' -- cgit v1.2.3 From 03f3b86f500c495932fd118b54569d92f700847c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 3 Nov 2014 16:57:55 +0100 Subject: Code cosmetics about file_info and other stuff --- module/plugins/hoster/FilecloudIo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index a5469ceb9..f31be155d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' @@ -39,7 +39,7 @@ class FilecloudIo(SimpleHoster): def handleFree(self): - data = {"ukey": self.file_info['ID']} + data = {"ukey": self.info['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: @@ -94,12 +94,12 @@ class FilecloudIo(SimpleHoster): if response['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) + m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) if m is None: self.error(_("LINK_PATTERN not found")) - if "size" in self.file_info and self.file_info['size']: - self.check_data = {"size": int(self.file_info['size'])} + if "size" in self.info and self.info['size']: + self.check_data = {"size": int(self.info['size'])} download_url = m.group(1) self.download(download_url) @@ -109,7 +109,7 @@ class FilecloudIo(SimpleHoster): def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] - ukey = self.file_info['ID'] + ukey = self.info['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", post={"akey": akey, "ukey": ukey}) -- 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/FilecloudIo.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index f31be155d..819a7faf3 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -64,26 +64,26 @@ class FilecloudIo(SimpleHoster): self.retry(2) json_url = "http://filecloud.io/download-request.json" - response = self.load(json_url, post=data) - self.logDebug(response) - response = json_loads(response) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "error" in response and response['error']: - self.fail(response) + if "error" in res and res['error']: + self.fail(res) - self.logDebug(response) - if response['captcha']: + self.logDebug(res) + if res['captcha']: data['ctype'] = "recaptcha" for _i in xrange(5): data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" - response = self.load(json_url, post=data) - self.logDebug(response) - response = json_loads(response) + res = self.load(json_url, post=data) + self.logDebug(res) + res = json_loads(res) - if "retry" in response and response['retry']: + if "retry" in res and res['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -91,7 +91,7 @@ class FilecloudIo(SimpleHoster): else: self.fail(_("Incorrect captcha")) - if response['dl']: + if res['dl']: self.html = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) -- 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/FilecloudIo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 819a7faf3..85ea3dae4 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' @@ -39,7 +39,7 @@ class FilecloudIo(SimpleHoster): def handleFree(self): - data = {"ukey": self.info['ID']} + data = {"ukey": self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: @@ -94,7 +94,7 @@ class FilecloudIo(SimpleHoster): if res['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.info['ID'], self.html) + m = re.search(self.LINK_PATTERN % self.info['pattern']['ID'], self.html) if m is None: self.error(_("LINK_PATTERN not found")) @@ -109,7 +109,7 @@ class FilecloudIo(SimpleHoster): def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] - ukey = self.info['ID'] + ukey = self.info['pattern']['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", post={"akey": akey, "ukey": ukey}) -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/FilecloudIo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 85ea3dae4..495f2268d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -34,8 +34,9 @@ class FilecloudIo(SimpleHoster): def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + self.chunkLimit = 1 def handleFree(self): -- cgit v1.2.3 From 4d578cb15f3d6edd036e438e504739b97660f93e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Dec 2014 16:58:35 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/FilecloudIo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 495f2268d..cb9782f23 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -58,9 +58,9 @@ class FilecloudIo(SimpleHoster): if not self.account: self.fail(_("User not logged in")) elif not self.account.logged_in: - captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, - "recaptcha_response_field": captcha_response} + challenge, response = recaptcha.challenge(captcha_key) + self.account.form_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response} self.account.relogin(self.user) self.retry(2) -- cgit v1.2.3 From cdb06469a640c1875229903a2dbdfa8be469b5bc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:52:30 +0100 Subject: Improve a lot of plugin __pattern__ --- module/plugins/hoster/FilecloudIo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilecloudIo.py') diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index cb9782f23..8b6804a68 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -12,7 +12,7 @@ class FilecloudIo(SimpleHoster): __type__ = "hoster" __version__ = "0.05" - __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+).*' + __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P\w+)' __description__ = """Filecloud.io hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3