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