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/NowDownloadEu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index cc1a10da0..4619c035d 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -32,7 +32,7 @@ class NowDownloadEu(SimpleHoster): __author_mail__ = ("soilfiction@gmail.com", "vuolter@gmail.com") FILE_INFO_PATTERN = r'Downloading
(?P.*) (?P[0-9,.]+) (?P[kKMG])i?B ' - FILE_OFFLINE_PATTERN = r'(This file does not exist!)' + OFFLINE_PATTERN = r'(This file does not exist!)' FILE_TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"' FILE_CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"' FILE_WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' -- 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/NowDownloadEu.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index 4619c035d..c6154c0e0 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -33,24 +33,26 @@ class NowDownloadEu(SimpleHoster): FILE_INFO_PATTERN = r'Downloading
(?P.*) (?P[0-9,.]+) (?P[kKMG])i?B ' OFFLINE_PATTERN = r'(This file does not exist!)' - FILE_TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"' - FILE_CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"' - FILE_WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - FILE_DOWNLOAD_LINK = r'"(http://f\d+\.nowdownload\.ch/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"' + + TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"' + CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"' + WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' + LINK_PATTERN = r'"(http://f\d+\.nowdownload\.ch/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"' FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] + def setup(self): self.multiDL = self.resumeDownload = True self.chunkLimit = -1 def handleFree(self): - tokenlink = re.search(self.FILE_TOKEN_PATTERN, self.html) - continuelink = re.search(self.FILE_CONTINUE_PATTERN, self.html) + tokenlink = re.search(self.TOKEN_PATTERN, self.html) + continuelink = re.search(self.CONTINUE_PATTERN, self.html) if not tokenlink or not continuelink: self.fail('Plugin out of Date') - found = re.search(self.FILE_WAIT_PATTERN, self.html) + found = re.search(self.WAIT_PATTERN, self.html) if found: wait = int(found.group(1)) else: @@ -62,7 +64,7 @@ class NowDownloadEu(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.FILE_DOWNLOAD_LINK, self.html) + url = re.search(self.LINK_PATTERN, self.html) if not url: self.fail('Download Link not Found (Plugin out of Date?)') self.logDebug('Download link: ' + str(url.group(1))) -- 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/NowDownloadEu.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index c6154c0e0..d5cd7f1c6 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.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 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/NowDownloadEu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index d5cd7f1c6..20153d356 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -47,7 +47,7 @@ class NowDownloadEu(SimpleHoster): def handleFree(self): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) - if not tokenlink or not continuelink: + if tokenlink is None or continuelink is None: self.fail('Plugin out of Date') found = re.search(self.WAIT_PATTERN, self.html) @@ -63,7 +63,7 @@ class NowDownloadEu(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) url = re.search(self.LINK_PATTERN, self.html) - if not url: + if url is None: self.fail('Download Link not Found (Plugin out of Date?)') self.logDebug('Download link: ' + str(url.group(1))) self.download(str(url.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/NowDownloadEu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index 20153d356..cf4f46805 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -50,9 +50,9 @@ class NowDownloadEu(SimpleHoster): if tokenlink is None or continuelink is None: self.fail('Plugin out of Date') - found = re.search(self.WAIT_PATTERN, self.html) - if found: - wait = int(found.group(1)) + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait = int(m.group(1)) else: wait = 60 -- 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/NowDownloadEu.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/NowDownloadEu.py') diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index cf4f46805..193698f17 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -1,21 +1,7 @@ # -*- 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.utils import fixup @@ -23,8 +9,10 @@ from module.utils import fixup class NowDownloadEu(SimpleHoster): __name__ = "NowDownloadEu" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?nowdownload\.(ch|co|eu|sx)/(dl/|download\.php\?id=)(?P\w+)' __version__ = "0.05" + + __pattern__ = r'http://(?:www\.)?nowdownload\.(ch|co|eu|sx)/(dl/|download\.php\?id=)(?P\w+)' + __description__ = """NowDownload.ch hoster plugin""" __author_name__ = ("godofdream", "Walter Purcaro") __author_mail__ = ("soilfiction@gmail.com", "vuolter@gmail.com") -- cgit v1.2.3