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/DataportCz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 291dcaf55..a5ff05f39 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -31,7 +31,7 @@ class DataportCz(SimpleHoster): FILE_NAME_PATTERN = r'(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost\s*(?P[^<]+)' - FILE_OFFLINE_PATTERN = r'

Soubor nebyl nalezen

' + OFFLINE_PATTERN = r'

Soubor nebyl nalezen

' FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] CAPTCHA_URL_PATTERN = r'
\s* 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/DataportCz.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index a5ff05f39..582312b29 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -17,7 +17,7 @@ @author: zoidberg """ -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): @@ -32,11 +32,13 @@ class DataportCz(SimpleHoster): FILE_NAME_PATTERN = r'(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost\s*(?P[^<]+)' OFFLINE_PATTERN = r'

Soubor nebyl nalezen

' + FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] CAPTCHA_URL_PATTERN = r'
\s*(\d+)
' + def handleFree(self): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} @@ -44,19 +46,19 @@ class DataportCz(SimpleHoster): action, inputs = self.parseHtmlForm('free_download_form') self.logDebug(action, inputs) if not action or not inputs: - raise PluginParseError('free_download_form') + self.parseError('free_download_form') if "captchaId" in inputs and inputs["captchaId"] in captchas: inputs['captchaCode'] = captchas[inputs["captchaId"]] else: - raise PluginParseError('captcha') + self.parseError('captcha') self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": - raise PluginParseError('invalid captcha') + self.parseError('invalid captcha') elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) -- 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/DataportCz.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 582312b29..ddcb13153 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.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 """ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -- 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/DataportCz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ddcb13153..19be45f44 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -46,8 +46,8 @@ class DataportCz(SimpleHoster): if not action or not inputs: self.parseError('free_download_form') - if "captchaId" in inputs and inputs["captchaId"] in captchas: - inputs['captchaCode'] = captchas[inputs["captchaId"]] + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] else: self.parseError('captcha') -- 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/DataportCz.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster/DataportCz.py') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 19be45f44..56b2c2398 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -1,28 +1,15 @@ # -*- 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 . -""" - from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?dataport.cz/file/(.*)' __version__ = "0.37" + + __pattern__ = r'http://(?:www\.)?dataport.cz/file/(.*)' + __description__ = """Dataport.cz hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" -- cgit v1.2.3