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/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 f9a9b6c16..63cc69161 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -33,7 +33,7 @@ class FshareVn(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" FILE_INFO_PATTERN = r'

(?P[^<]+)<\\/p>[\\trn\s]*

(?P[0-9,.]+)\s*(?P[kKMG])i?B<\\/p>' - FILE_OFFLINE_PATTERN = r'

\\t\\t\\t\\t\\r\\n\\t\\t

<\\/p>\\t\\t\\r\\n\\t\\t

0 KB<\\/p>' + OFFLINE_PATTERN = r'

\\t\\t\\t\\t\\r\\n\\t\\t

<\\/p>\\t\\t\\r\\n\\t\\t

0 KB<\\/p>' FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]' VIP_URL_PATTERN = r'

' -- 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/FshareVn.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 63cc69161..75b37b4c3 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -34,11 +34,13 @@ class FshareVn(SimpleHoster): FILE_INFO_PATTERN = r'

(?P[^<]+)<\\/p>[\\trn\s]*

(?P[0-9,.]+)\s*(?P[kKMG])i?B<\\/p>' OFFLINE_PATTERN = r'

\\t\\t\\t\\t\\r\\n\\t\\t

<\\/p>\\t\\t\\r\\n\\t\\t

0 KB<\\/p>' + FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]' - VIP_URL_PATTERN = r'' + + LINK_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", @@ -79,7 +81,7 @@ class FshareVn(SimpleHoster): found = re.search(r'var count = (\d+)', self.html) self.setWait(int(found.group(1)) if found else 30) - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if not found: self.parseError('FREE DL URL') self.url = found.group(1) -- 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/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 75b37b4c3..ec76d85b8 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -82,7 +82,7 @@ class FshareVn(SimpleHoster): self.setWait(int(found.group(1)) if found else 30) found = re.search(self.LINK_PATTERN, self.html) - if not found: + if found is None: self.parseError('FREE DL URL') self.url = found.group(1) self.logDebug("FREE DL URL: %s" % self.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/FshareVn.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index ec76d85b8..0b728495a 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -78,13 +78,13 @@ class FshareVn(SimpleHoster): self.checkErrors() - found = re.search(r'var count = (\d+)', self.html) - self.setWait(int(found.group(1)) if found else 30) + m = re.search(r'var count = (\d+)', self.html) + self.setWait(int(m.group(1)) if m else 30) - found = re.search(self.LINK_PATTERN, self.html) - if found is None: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.parseError('FREE DL URL') - self.url = found.group(1) + self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) self.wait() @@ -97,10 +97,10 @@ class FshareVn(SimpleHoster): 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() - found = re.search(self.WAIT_PATTERN, self.html) - if found: - self.logInfo("Wait until %s ICT" % found.group(1)) - wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M")) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.logInfo("Wait until %s ICT" % m.group(1)) + wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) self.retry() elif '

    ' in self.html: @@ -114,4 +114,4 @@ class FshareVn(SimpleHoster): }) if check == "not_found": - self.fail("File not found on server") + self.fail("File not m on server") -- 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/FshareVn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FshareVn.py') diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 0b728495a..bc042cbcc 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- import re + from time import strptime, mktime, gmtime -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo from module.network.RequestFactory import getURL +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): @@ -26,8 +27,10 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?fshare.vn/file/.*' __version__ = "0.16" + + __pattern__ = r'http://(?:www\.)?fshare.vn/file/.*' + __description__ = """FshareVn hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" -- cgit v1.2.3