From 10ce4afb555375e2cf101c8e89b53f398ba67c8c Mon Sep 17 00:00:00 2001 From: igel-kun Date: Sun, 29 Jun 2014 21:30:29 +0200 Subject: Update FilepostCom.py --- module/plugins/hoster/FilepostCom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 01ac76850..d173a0df4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -34,7 +34,7 @@ class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' - __version__ = "0.27" + __version__ = "0.28" __description__ = """Filepost.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" @@ -44,6 +44,7 @@ class FilepostCom(SimpleHoster): FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. |
' RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" + PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' def handleFree(self): # Find token and captcha key -- cgit v1.2.3 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/FilepostCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index d173a0df4..000dc1de7 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -41,7 +41,7 @@ class FilepostCom(SimpleHoster): FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[0-9\.]+ [kKMG]i?B)\' class="inp_text"/>' #FILE_INFO_PATTERN = r'

(?P[^<]+)

\s*
\s*
    \s*
  • Size: (?P[0-9.]+) (?P[kKMG])i?B
  • ' - FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' + OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' -- 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/FilepostCom.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 000dc1de7..c56df23c8 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -14,7 +14,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - @author: zoidberg changelog: 0.27 - 2012-08-12 - hgg -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c56df23c8..a6f3fae14 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -90,10 +90,10 @@ class FilepostCom(SimpleHoster): for i in xrange(5): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' if i: - post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge( + post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( captcha_key) self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( - captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"])) + captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index a6f3fae14..351576b29 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -39,11 +39,11 @@ class FilepostCom(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[0-9\.]+ [kKMG]i?B)\' class="inp_text"/>' - #FILE_INFO_PATTERN = r'

(?P[^<]+)

\s*
\s*
    \s*
  • Size: (?P[0-9.]+) (?P[kKMG])i?B
  • ' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' + + PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" - PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' def handleFree(self): # Find token and captcha key -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 351576b29..e024df6df 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -50,12 +50,12 @@ class FilepostCom(SimpleHoster): file_id = re.match(self.__pattern__, self.pyfile.url).group(1) found = re.search(self.FLP_TOKEN_PATTERN, self.html) - if not found: + if found is None: self.parseError("Token") flp_token = found.group(1) found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - if not found: + if found is None: self.parseError("Captcha key") captcha_key = found.group(1) -- 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/FilepostCom.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index e024df6df..93488236a 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -49,15 +49,15 @@ class FilepostCom(SimpleHoster): # Find token and captcha key file_id = re.match(self.__pattern__, self.pyfile.url).group(1) - found = re.search(self.FLP_TOKEN_PATTERN, self.html) - if found is None: + m = re.search(self.FLP_TOKEN_PATTERN, self.html) + if m is None: self.parseError("Token") - flp_token = found.group(1) + flp_token = m.group(1) - found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) - if found is None: + m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + if m is None: self.parseError("Captcha key") - captcha_key = found.group(1) + captcha_key = m.group(1) # Get wait time get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} -- 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/FilepostCom.py | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 93488236a..0e1b6ea5a 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -1,39 +1,21 @@ # -*- 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 . - - - changelog: - 0.27 - 2012-08-12 - hgg - fix "global name 'js_answer' is not defined" bug - fix captcha bug #1 (failed on non-english "captcha wrong" errors) -""" - import re + from time import time -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.CaptchaService import ReCaptcha 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 FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' __version__ = "0.28" + + __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' + __description__ = """Filepost.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" @@ -45,6 +27,7 @@ class FilepostCom(SimpleHoster): RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" + def handleFree(self): # Find token and captcha key file_id = re.match(self.__pattern__, self.pyfile.url).group(1) @@ -70,7 +53,7 @@ class FilepostCom(SimpleHoster): post_dict = {"token": flp_token, "code": file_id, "file_pass": ''} if 'var is_pass_exists = true;' in self.html: - # Solve password + # Solve password for file_pass in self.getPassword().splitlines(): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass -- 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/FilepostCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 0e1b6ea5a..c5439cf01 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -114,7 +114,7 @@ class FilepostCom(SimpleHoster): elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']: return None elif 'CAPTCHA' in json_response['js']['error']: - self.logDebug('error response is unknown, but mentions CAPTCHA -> return None') + self.logDebug("Error response is unknown, but mentions CAPTCHA") return None else: self.fail(json_response['js']['error']) -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c5439cf01..c96f20c06 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -24,7 +24,7 @@ class FilepostCom(SimpleHoster): OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' - RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" + RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" @@ -37,7 +37,7 @@ class FilepostCom(SimpleHoster): self.parseError("Token") flp_token = m.group(1) - m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) + m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: self.parseError("Captcha key") captcha_key = m.group(1) -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c96f20c06..9c33a79ef 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -17,8 +17,8 @@ class FilepostCom(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[0-9\.]+ [kKMG]i?B)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' -- 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/FilepostCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 9c33a79ef..11afb4afb 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -17,6 +17,7 @@ class FilepostCom(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/hoster/FilepostCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 11afb4afb..0dc0d7c63 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -21,7 +21,7 @@ class FilepostCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[0-9\.]+ [kKMG]i?B)\' class="inp_text"/>' + FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.]+) (?P\w+)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 0dc0d7c63..1412a63e8 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -14,14 +14,14 @@ class FilepostCom(SimpleHoster): __type__ = "hoster" __version__ = "0.28" - __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*' + __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.]+) (?P\w+)\' class="inp_text"/>' + FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P\w+)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' -- 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/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 1412a63e8..4449ae2c2 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -25,8 +25,8 @@ class FilepostCom(SimpleHoster): OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' - RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'" - FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'" + RECAPTCHA_PATTERN = r'Captcha.init\({\s*key:\s*\'(.+?)\'' + FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' def handleFree(self): -- cgit v1.2.3 From 388a2f6478d42e423f1f8442d8539983f3762f22 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 14 Oct 2014 13:38:49 +0200 Subject: Improve unit detection in size pattern --- module/plugins/hoster/FilepostCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 4449ae2c2..f833ab737 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -21,7 +21,7 @@ class FilepostCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P\w+)\' class="inp_text"/>' + FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' -- 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/FilepostCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index f833ab737..0748b64f2 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' @@ -35,12 +35,12 @@ class FilepostCom(SimpleHoster): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: - self.parseError("Token") + self.error("Token") flp_token = m.group(1) m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: - self.parseError("Captcha key") + self.error("Captcha key") captcha_key = m.group(1) # Get wait time @@ -98,7 +98,7 @@ class FilepostCom(SimpleHoster): self.logDebug(json_response) if not 'js' in json_response: - self.parseError('JSON %s 1' % field) + self.error('JSON %s 1' % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -122,7 +122,7 @@ class FilepostCom(SimpleHoster): # ~? self.fail(js_answer['error']) if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: - self.parseError('JSON %s 2' % field) + self.error('JSON %s 2' % field) return json_response['js']['answer'][field] -- 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/FilepostCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 0748b64f2..45fb2e644 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -93,6 +93,7 @@ class FilepostCom(SimpleHoster): # Download self.download(download_url) + def getJsonResponse(self, get_dict, post_dict, field): json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) self.logDebug(json_response) -- cgit v1.2.3 From e3f5280529921100f48bb8a79853bf480c7611e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 02:53:05 +0200 Subject: Replace single quotes with doubles in self.error and self.fail msg --- module/plugins/hoster/FilepostCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 45fb2e644..4090ce92b 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -99,7 +99,7 @@ class FilepostCom(SimpleHoster): self.logDebug(json_response) if not 'js' in json_response: - self.error('JSON %s 1' % field) + self.error("JSON %s 1" % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -123,7 +123,7 @@ class FilepostCom(SimpleHoster): # ~? self.fail(js_answer['error']) if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: - self.error('JSON %s 2' % field) + self.error("JSON %s 2" % field) return json_response['js']['answer'][field] -- 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/FilepostCom.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 4090ce92b..338c89cae 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -35,12 +35,12 @@ class FilepostCom(SimpleHoster): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: - self.error("Token") + self.error(_("Token")) flp_token = m.group(1) m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: - self.error("Captcha key") + self.error(_("Captcha key")) captcha_key = m.group(1) # Get wait time @@ -58,14 +58,14 @@ class FilepostCom(SimpleHoster): for file_pass in self.getPassword().splitlines(): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.logInfo("Password protected link, trying " + file_pass) + self.logInfo(_("Password protected link, trying ") + file_pass) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: break else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: # Solve recaptcha @@ -88,7 +88,7 @@ class FilepostCom(SimpleHoster): self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) # Download self.download(download_url) @@ -99,7 +99,7 @@ class FilepostCom(SimpleHoster): self.logDebug(json_response) if not 'js' in json_response: - self.error("JSON %s 1" % field) + self.error(_("JSON %s 1") % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -120,10 +120,9 @@ class FilepostCom(SimpleHoster): return None else: self.fail(json_response['js']['error']) - # ~? self.fail(js_answer['error']) if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: - self.error("JSON %s 2" % field) + self.error(_("JSON %s 2") % field) return json_response['js']['answer'][field] -- 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/FilepostCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 338c89cae..2380628f0 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -10,15 +10,15 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): - __name__ = "FilepostCom" - __type__ = "hoster" + __name__ = "FilepostCom" + __type__ = "hoster" __version__ = "0.29" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' __description__ = """Filepost.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' -- 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/FilepostCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 2380628f0..314ad449c 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -21,7 +21,7 @@ class FilepostCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' + INFO_PATTERN = r']*>(?P[^>]+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
|
' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' -- 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/FilepostCom.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 314ad449c..db5ea20d3 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,9 +12,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.30" - __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/([^/]+).*' + __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P[^/]+)' __description__ = """Filepost.com hoster plugin""" __license__ = "GPLv3" @@ -30,9 +30,6 @@ class FilepostCom(SimpleHoster): def handleFree(self): - # Find token and captcha key - file_id = re.match(self.__pattern__, self.pyfile.url).group(1) - m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: self.error(_("Token")) @@ -45,13 +42,13 @@ class FilepostCom(SimpleHoster): # Get wait time get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'} - post_dict = {'action': 'set_download', 'token': flp_token, 'code': file_id} + post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']} wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time')) if wait_time > 0: self.wait(wait_time) - post_dict = {"token": flp_token, "code": file_id, "file_pass": ''} + post_dict = {"token": flp_token, "code": self.info['pattern']['ID'], "file_pass": ''} if 'var is_pass_exists = true;' in self.html: # Solve password -- 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/FilepostCom.py | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index db5ea20d3..b94892ef4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -92,36 +92,39 @@ class FilepostCom(SimpleHoster): def getJsonResponse(self, get_dict, post_dict, field): - json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) - self.logDebug(json_response) + res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) - if not 'js' in json_response: + self.logDebug(res) + + if not 'js' in res: self.error(_("JSON %s 1") % field) - # i changed js_answer to json_response['js'] since js_answer is nowhere set. + # i changed js_answer to res['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author - # accessed json_response['js']['error'] as well as js_answer['error']. + # accessed res['js']['error'] as well as js_answer['error']. # see the two lines commented out with "# ~?". - if 'error' in json_response['js']: - if json_response['js']['error'] == 'download_delay': - self.retry(wait_time=json_response['js']['params']['next_download']) + if 'error' in res['js']: + + if res['js']['error'] == 'download_delay': + self.retry(wait_time=res['js']['params']['next_download']) # ~? self.retry(wait_time=js_answer['params']['next_download']) - elif 'Wrong file password' in json_response['js']['error']: - return None - elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']: - return None - elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']: + + elif ('Wrong file password' in res['js']['error'] + or 'You entered a wrong CAPTCHA code' in res['js']['error'] + or 'CAPTCHA Code nicht korrekt' in res['js']['error']): return None - elif 'CAPTCHA' in json_response['js']['error']: + + elif 'CAPTCHA' in res['js']['error']: self.logDebug("Error response is unknown, but mentions CAPTCHA") return None + else: - self.fail(json_response['js']['error']) + self.fail(res['js']['error']) - if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: + if not 'answer' in res['js'] or not field in res['js']['answer']: self.error(_("JSON %s 2") % field) - return json_response['js']['answer'][field] + return res['js']['answer'][field] getInfo = create_getInfo(FilepostCom) -- cgit v1.2.3 From 6325eda4e8c142edd11c747f7a9d4a3fa975c494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 20 Dec 2014 14:24:13 +0100 Subject: Fix password retrieving in some plugins --- module/plugins/hoster/FilepostCom.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FilepostCom.py') diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index b94892ef4..66c040770 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P[^/]+)' @@ -52,17 +52,20 @@ class FilepostCom(SimpleHoster): if 'var is_pass_exists = true;' in self.html: # Solve password - for file_pass in self.getPassword().splitlines(): + password = self.getPassword() + + if password: + self.logInfo(_("Password protected link, trying ") + file_pass) + get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.logInfo(_("Password protected link, trying ") + file_pass) - download_url = self.getJsonResponse(get_dict, post_dict, 'link') - if download_url: - break + self.link = self.getJsonResponse(get_dict, post_dict, 'link') + if not self.link: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) else: # Solve recaptcha -- cgit v1.2.3