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/FshareVn.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 3c230bbe2..7b8e4b0bd 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -24,7 +24,7 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.*' @@ -66,15 +66,20 @@ class FshareVn(SimpleHoster): if not inputs: self.error(_("No FORM")) + elif 'link_file_pwd_dl' in inputs: - for password in self.getPassword().splitlines(): + password = self.getPassword() + + if password: self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password self.html = self.load(self.url, post=inputs, decode=True) - if not 'name="link_file_pwd_dl"' in self.html: - break + + if 'name="link_file_pwd_dl"' in self.html: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) + else: self.html = self.load(self.url, post=inputs, decode=True) -- 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/FshareVn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 7b8e4b0bd..a3f9703df 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -26,7 +26,7 @@ class FshareVn(SimpleHoster): __type__ = "hoster" __version__ = "0.18" - __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.*' + __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' __description__ = """FshareVn hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From fd105f8e51768ec1943cda2375bdfdbe5b0a3951 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 9 Jan 2015 00:35:51 +0100 Subject: "New Year" Update: hoster plugins --- module/plugins/hoster/FshareVn.py | 46 ++++++++++++--------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index a3f9703df..872511afc 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -3,6 +3,7 @@ import re from time import strptime, mktime, gmtime +from urlparse import urljoin from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -24,7 +25,7 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' @@ -38,31 +39,26 @@ class FshareVn(SimpleHoster): NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - LINK_PATTERN = r'action="(http://download.*?)[#"]' + LINK_FREE_PATTERN = r'action="(http://download.*?)[#"]' WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' - def process(self, pyfile): - self.html = self.load('http://www.fshare.vn/check_link.php', post={ - "action": "check_link", - "arrlinks": pyfile.url - }, decode=True) - self.getFileInfo() + def preload(self): + self.html = self.load("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': pyfile.url}, + decode=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - self.checkDownloadedFile() + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handleFree(self, pyfile): + self.html = self.load(pyfile.url, decode=True) self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = self.pyfile.url + action + self.url = urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -88,9 +84,9 @@ class FshareVn(SimpleHoster): m = re.search(r'var count = (\d+)', self.html) self.setWait(int(m.group(1)) if m else 30) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) @@ -98,10 +94,6 @@ class FshareVn(SimpleHoster): self.download(self.url) - def handlePremium(self): - self.download(self.pyfile.url) - - def checkErrors(self): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn không tồn" in self.html: self.offline() @@ -118,13 +110,3 @@ class FshareVn(SimpleHoster): self.retry(30, 2 * 60, msg) self.info.pop('error', None) - - - def checkDownloadedFile(self): - # check download - check = self.checkDownload({ - "not_found": "404 Not Found" - }) - - if check == "not_found": - self.fail(_("File not m on server")) -- cgit v1.2.3 From 031d86706aa13270793e31c21ad3f386ca62752b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 24 Jan 2015 03:50:33 +0100 Subject: Spare code improvements --- module/plugins/hoster/FshareVn.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 872511afc..4912974ad 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -25,7 +25,7 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' @@ -58,7 +58,7 @@ class FshareVn(SimpleHoster): self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = urljoin(pyfile.url, action) + url = urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -69,7 +69,7 @@ class FshareVn(SimpleHoster): if password: self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) if 'name="link_file_pwd_dl"' in self.html: self.fail(_("Incorrect password")) @@ -77,7 +77,7 @@ class FshareVn(SimpleHoster): self.fail(_("No password found")) else: - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) self.checkErrors() @@ -87,11 +87,9 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) - self.url = m.group(1) - self.logDebug("FREE DL URL: %s" % self.url) - + + self.link = m.group(1) self.wait() - self.download(self.url) def checkErrors(self): -- cgit v1.2.3 From 79725268402043906f619f7c09e848e02ab8a17b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 31 Jan 2015 22:00:59 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/FshareVn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 4912974ad..9a2b0c323 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -87,7 +87,7 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("LINK_FREE_PATTERN not found")) - + self.link = m.group(1) self.wait() -- cgit v1.2.3