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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index a462deaff..5fab87157 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -36,7 +36,7 @@ class CzshareCom(SimpleHoster): FILE_NAME_PATTERN = r'
\s*

\s*Cel. n.zev: ]*>(?P[^<]+)' FILE_SIZE_PATTERN = r'

(?:\s*

[^\n]*

)*\s*Velikost:\s*(?P[0-9., ]+)(?P[kKMG])i?B\s*
' - FILE_OFFLINE_PATTERN = r'
\s*

' + OFFLINE_PATTERN = r'
\s*

' FILE_SIZE_REPLACEMENTS = [(' ', '')] FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] -- 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/CzshareCom.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 5fab87157..ba43d8054 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -21,7 +21,7 @@ # http://czshare.com/5278880/random.bin import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.utils import parseFileSize @@ -40,6 +40,7 @@ class CzshareCom(SimpleHoster): FILE_SIZE_REPLACEMENTS = [(' ', '')] FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + SH_CHECK_TRAFFIC = True FREE_URL_PATTERN = r'[^>]*alt="([^"]+)" />' @@ -49,6 +50,7 @@ class CzshareCom(SimpleHoster): MULTIDL_PATTERN = r"

Z[^<]*PROFI.

" USER_CREDIT_PATTERN = r'
\s*kredit: ([0-9., ]+)([kKMG]i?B)\s*
' + def checkTrafficLeft(self): # check if user logged in found = re.search(self.USER_CREDIT_PATTERN, self.html) @@ -90,7 +92,7 @@ class CzshareCom(SimpleHoster): # get free url found = re.search(self.FREE_URL_PATTERN, self.html) if found is None: - raise PluginParseError('Free URL') + self.parseError('Free URL') parsed_url = "http://sdilej.cz" + found.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -105,7 +107,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - raise PluginParseError('Form') + self.parseError('Form') # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -129,7 +131,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if not found: - raise PluginParseError('Download URL') + self.parseError('Download URL') url = "http://%s/download.php?%s" % (found.group(1), found.group(2)) -- 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/CzshareCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index ba43d8054..b4a1d77cc 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.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 """ # Test links (random.bin): -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hoster/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index b4a1d77cc..7866a771e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -89,7 +89,7 @@ class CzshareCom(SimpleHoster): def handleFree(self): # get free url found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + if not found: self.parseError('Free URL') parsed_url = "http://sdilej.cz" + found.group(1) self.logDebug("PARSED_URL:" + parsed_url) -- 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/CzshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 7866a771e..f66f1b5a2 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -52,11 +52,11 @@ class CzshareCom(SimpleHoster): def checkTrafficLeft(self): # check if user logged in found = re.search(self.USER_CREDIT_PATTERN, self.html) - if not found: + if found is None: self.account.relogin(self.user) self.html = self.load(self.pyfile.url, cookies=True, decode=True) found = re.search(self.USER_CREDIT_PATTERN, self.html) - if not found: + if found is None: return False # check user credit @@ -89,7 +89,7 @@ class CzshareCom(SimpleHoster): def handleFree(self): # get free url found = re.search(self.FREE_URL_PATTERN, self.html) - if not found: + if found is None: self.parseError('Free URL') parsed_url = "http://sdilej.cz" + found.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -128,7 +128,7 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) - if not found: + if found is None: self.parseError('Download URL') url = "http://%s/download.php?%s" % (found.group(1), found.group(2)) -- 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/CzshareCom.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index f66f1b5a2..c34e73ff4 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -51,17 +51,17 @@ class CzshareCom(SimpleHoster): def checkTrafficLeft(self): # check if user logged in - found = re.search(self.USER_CREDIT_PATTERN, self.html) - if found is None: + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: self.account.relogin(self.user) self.html = self.load(self.pyfile.url, cookies=True, decode=True) - found = re.search(self.USER_CREDIT_PATTERN, self.html) - if found is None: + m = re.search(self.USER_CREDIT_PATTERN, self.html) + if m is None: return False # check user credit try: - credit = parseFileSize(found.group(1).replace(' ', ''), found.group(2)) + credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) if credit < self.pyfile.size: @@ -88,10 +88,10 @@ class CzshareCom(SimpleHoster): def handleFree(self): # get free url - found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + m = re.search(self.FREE_URL_PATTERN, self.html) + if m is None: self.parseError('Free URL') - parsed_url = "http://sdilej.cz" + found.group(1) + parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html @@ -122,16 +122,16 @@ class CzshareCom(SimpleHoster): else: self.fail("No valid captcha code entered") - found = re.search("countdown_number = (\d+);", self.html) - self.setWait(int(found.group(1)) if found else 50) + m = re.search("countdown_number = (\d+);", self.html) + self.setWait(int(m.group(1)) if m else 50) # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) - found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) - if found is None: + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) + if m is None: self.parseError('Download URL') - url = "http://%s/download.php?%s" % (found.group(1), found.group(2)) + url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) self.wait() self.download(url) -- 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/CzshareCom.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index c34e73ff4..4f581651b 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -1,24 +1,10 @@ # -*- 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 . -""" - -# Test links (random.bin): +# +# Test links: # http://czshare.com/5278880/random.bin import re + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.utils import parseFileSize @@ -26,8 +12,10 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' __version__ = "0.94" + + __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' + __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" @@ -107,7 +95,7 @@ class CzshareCom(SimpleHoster): self.logError(e) self.parseError('Form') - # get and decrypt captcha + # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' for _ in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) -- cgit v1.2.3 From 4709a41c176dd2947709b7f35ccc84213d574624 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Sep 2014 16:59:26 +0200 Subject: Rename SH flags --- module/plugins/hoster/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 4f581651b..51627dc33 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -27,7 +27,7 @@ class CzshareCom(SimpleHoster): FILE_SIZE_REPLACEMENTS = [(' ', '')] FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] - SH_CHECK_TRAFFIC = True + FORCE_CHECK_TRAFFIC = True FREE_URL_PATTERN = r'[^>]*alt="([^"]+)" />' FREE_FORM_PATTERN = r'
\s*(.*?)
' -- 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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 51627dc33..df8cfea9e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -57,7 +57,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError('Parse error (CREDIT): %s' % e) + self.logError("Parse error (CREDIT): %s" % e) return True -- cgit v1.2.3 From ff91b58bf9ee65aaeb048426295af6ad122b119e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:14:53 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index df8cfea9e..f7fb119ac 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -128,13 +128,13 @@ class CzshareCom(SimpleHoster): def checkDownloadedFile(self): # check download check = self.checkDownload({ - "tempoffline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "temp_offline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi_dl": re.compile(self.MULTIDL_PATTERN), "captcha_err": "
  • Zadaný ověřovací kód nesouhlasí!
  • " }) - if check == "tempoffline": + if check == "temp_offline": self.fail("File not available - try later") if check == "credit": self.resetAccount() -- 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/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index f7fb119ac..fd06f246b 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -17,8 +17,8 @@ class CzshareCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + FILE_NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' FILE_SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[0-9., ]+)(?P[kKMG])i?B\s*
    ' -- 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/CzshareCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index fd06f246b..9e965b972 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -17,6 +17,7 @@ class CzshareCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" + __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/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 9e965b972..0ec60b5d1 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -22,7 +22,7 @@ class CzshareCom(SimpleHoster): FILE_NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' - FILE_SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[0-9., ]+)(?P[kKMG])i?B\s*
    ' + FILE_SIZE_PATTERN = r'
    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P\w+)\s*
    ' OFFLINE_PATTERN = r'
    \s*

    ' FILE_SIZE_REPLACEMENTS = [(' ', '')] @@ -35,7 +35,7 @@ class CzshareCom(SimpleHoster): PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]+)"[^>]*/>' MULTIDL_PATTERN = r"

    Z[^<]*PROFI.

    " - USER_CREDIT_PATTERN = r'
    \s*kredit: ([0-9., ]+)([kKMG]i?B)\s*
    ' + USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' def checkTrafficLeft(self): -- 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/CzshareCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 0ec60b5d1..8ca4fd8a5 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -14,7 +14,7 @@ class CzshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.94" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download.php\?).*' + __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -31,8 +31,8 @@ class CzshareCom(SimpleHoster): FORCE_CHECK_TRAFFIC = True FREE_URL_PATTERN = r'[^>]*alt="([^"]+)" />' - FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' - PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' + FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' + PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]+)"[^>]*/>' MULTIDL_PATTERN = r"

    Z[^<]*PROFI.

    " USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' -- 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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 8ca4fd8a5..9d2b8b35f 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -34,7 +34,7 @@ class CzshareCom(SimpleHoster): FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]+)"[^>]*/>' - MULTIDL_PATTERN = r"

    Z[^<]*PROFI.

    " + MULTIDL_PATTERN = r'

    Z[^<]*PROFI.

    ' USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' -- 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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 9d2b8b35f..0ddca1473 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -22,7 +22,7 @@ class CzshareCom(SimpleHoster): FILE_NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' - FILE_SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P\w+)\s*
    ' + FILE_SIZE_PATTERN = r'
    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' OFFLINE_PATTERN = r'
    \s*

    ' FILE_SIZE_REPLACEMENTS = [(' ', '')] -- 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/CzshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 0ddca1473..9f2f23d9e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.94" + __version__ = "0.95" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' @@ -79,7 +79,7 @@ class CzshareCom(SimpleHoster): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.parseError('Free URL') + self.error('Free URL') parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -94,7 +94,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - self.parseError('Form') + self.error('Form') # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -118,7 +118,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: - self.parseError('Download URL') + self.error('Download URL') url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) -- 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/CzshareCom.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 9f2f23d9e..2b8278a7e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -62,6 +62,7 @@ class CzshareCom(SimpleHoster): return True + def handlePremium(self): # parse download link try: @@ -75,6 +76,7 @@ class CzshareCom(SimpleHoster): self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) self.checkDownloadedFile() + def handleFree(self): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) @@ -126,6 +128,7 @@ class CzshareCom(SimpleHoster): self.download(url) self.checkDownloadedFile() + def checkDownloadedFile(self): # check download check = self.checkDownload({ -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 2b8278a7e..be1c3ab97 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -66,7 +66,7 @@ class CzshareCom(SimpleHoster): def handlePremium(self): # parse download link try: - form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1) + form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: self.logError("Parse error (FORM): %s" % e) @@ -91,7 +91,7 @@ class CzshareCom(SimpleHoster): self.longWait(5 * 60, 12) try: - form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).group(1) + form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) self.pyfile.size = int(inputs['size']) except Exception, e: -- 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/CzshareCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index be1c3ab97..5c31958d7 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -81,7 +81,7 @@ class CzshareCom(SimpleHoster): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.error('Free URL') + self.error("Free URL") parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -96,7 +96,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - self.error('Form') + self.error("Form") # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -120,7 +120,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: - self.error('Download URL') + self.error("Download URL") url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) -- cgit v1.2.3 From 1c4bf83881d2a22da3773666a580d51f6b57bfd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 03:07:21 +0200 Subject: Avoid gettext conflict due variable `_` --- module/plugins/hoster/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 5c31958d7..cb450425b 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -100,7 +100,7 @@ class CzshareCom(SimpleHoster): # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' - for _ in xrange(5): + for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) if u"
  • Zadaný ověřovací kód nesouhlasí!
  • " in self.html: -- 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/CzshareCom.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index cb450425b..5396a7826 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -51,14 +51,14 @@ class CzshareCom(SimpleHoster): # check user credit try: credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) - self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) - self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) + self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) + self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) if credit < self.pyfile.size: - self.logInfo("Not enough credit to download file %s" % self.pyfile.name) + self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) return False except Exception, e: # let's continue and see what happens... - self.logError("Parse error (CREDIT): %s" % e) + self.logError(repr(e)) return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster): form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError("Parse error (FORM): %s" % e) + self.logError(repr(e)) self.resetAccount() # download the file, destination is determined by pyLoad @@ -81,7 +81,7 @@ class CzshareCom(SimpleHoster): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.error("Free URL") + self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -96,7 +96,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - self.error("Form") + self.error(_("Form")) # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -111,7 +111,7 @@ class CzshareCom(SimpleHoster): self.correctCaptcha() break else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) m = re.search("countdown_number = (\d+);", self.html) self.setWait(int(m.group(1)) if m else 50) @@ -120,7 +120,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: - self.error("Download URL") + self.error(_("Download URL not found")) url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) @@ -139,7 +139,7 @@ class CzshareCom(SimpleHoster): }) if check == "temp_offline": - self.fail("File not available - try later") + self.fail(_("File not available - try later")) if check == "credit": self.resetAccount() elif check == "multi_dl": -- cgit v1.2.3 From 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Oct 2014 01:18:45 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 5396a7826..91c3877f8 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -58,7 +58,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError(repr(e)) + self.logError(str(e)) return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster): form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError(repr(e)) + self.logError(str(e)) self.resetAccount() # download the file, destination is determined by pyLoad -- 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/CzshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 91c3877f8..fd02c0f77 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -10,15 +10,15 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): - __name__ = "CzshareCom" - __type__ = "hoster" + __name__ = "CzshareCom" + __type__ = "hoster" __version__ = "0.95" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] FILE_NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' -- 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/CzshareCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index fd02c0f77..76efda3b9 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -21,12 +21,12 @@ class CzshareCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_NAME_PATTERN = r'

    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' - FILE_SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' + NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' + SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' OFFLINE_PATTERN = r'
    \s*

    ' - FILE_SIZE_REPLACEMENTS = [(' ', '')] - FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + SIZE_REPLACEMENTS = [(' ', '')] + URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] FORCE_CHECK_TRAFFIC = True -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/CzshareCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 76efda3b9..72f1bb45d 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -58,7 +58,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError(str(e)) + self.logError(e) return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster): form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError(str(e)) + self.logError(e) self.resetAccount() # download the file, destination is determined by pyLoad -- cgit v1.2.3 From e1d4186c62512d8bb76d35b6f8d1828d8d0aa94e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:26:32 +0100 Subject: [SimpleHoster] Improve multi-hoster feature --- module/plugins/hoster/CzshareCom.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 72f1bb45d..914849879 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.95" + __version__ = "0.96" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' @@ -21,21 +21,21 @@ class CzshareCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' - SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' + NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: ]*>(?P[^<]+)' + SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' OFFLINE_PATTERN = r'
    \s*

    ' SIZE_REPLACEMENTS = [(' ', '')] - URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] - FORCE_CHECK_TRAFFIC = True + CHECK_TRAFFIC = True - FREE_URL_PATTERN = r'[^>]*alt="([^"]+)" />' - FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' + FREE_URL_PATTERN = r'[^>]*alt="([^"]+)" />' + FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' - FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]+)"[^>]*/>' - MULTIDL_PATTERN = r'

    Z[^<]*PROFI.

    ' - USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' + FORM_INPUT_PATTERN = r']* name="([^"]+)" value="([^"]+)"[^>]*/>' + MULTIDL_PATTERN = r'

    Z[^<]*PROFI.

    ' + USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' def checkTrafficLeft(self): -- 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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/CzshareCom.py') diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 914849879..aa381d712 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -14,7 +14,7 @@ class CzshareCom(SimpleHoster): __type__ = "hoster" __version__ = "0.96" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' + __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" __license__ = "GPLv3" -- cgit v1.2.3