diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-25 01:11:29 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-25 01:17:03 +0200 |
commit | 4da90891eb2544ac15a7d512aba8cb357f68ee5f (patch) | |
tree | 84eec3f9f27a880df052da43fb3a6a8112b39c24 /module/plugins/crypter | |
parent | Fix and improve plugins logging (diff) | |
download | pyload-4da90891eb2544ac15a7d512aba8cb357f68ee5f.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r-- | module/plugins/crypter/CzshareComFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/DuckCryptInfo.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/FileserveComFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/FreetexthostCom.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/LetitbitNetFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/LinkSaveIn.py | 5 | ||||
-rw-r--r-- | module/plugins/crypter/LinkdecrypterCom.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/LixIn.py | 6 | ||||
-rw-r--r-- | module/plugins/crypter/NCryptIn.py | 9 | ||||
-rw-r--r-- | module/plugins/crypter/QuickshareCzFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/RelinkUs.py | 7 | ||||
-rw-r--r-- | module/plugins/crypter/SafelinkingNet.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/ShareLinksBiz.py | 6 | ||||
-rw-r--r-- | module/plugins/crypter/UlozToFolder.py | 2 |
14 files changed, 23 insertions, 28 deletions
diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareComFolder.py index 9a3881617..2b4d736b7 100644 --- a/module/plugins/crypter/CzshareComFolder.py +++ b/module/plugins/crypter/CzshareComFolder.py @@ -23,7 +23,7 @@ class CzshareComFolder(Crypter): def decrypt(self, pyfile): html = self.load(pyfile.url) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: self.fail("Parse error (FOLDER)") diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 737ed59ec..54a2bd8b9 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -43,7 +43,7 @@ class DuckCryptInfo(Crypter): cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) self.logDebug("Redirectet to " + str(cryptlinks)) if not cryptlinks: - self.error("no links m") + self.error("No link found") for clink in cryptlinks: if clink.find("a"): self.handleLink(clink.find("a")['href']) diff --git a/module/plugins/crypter/FileserveComFolder.py b/module/plugins/crypter/FileserveComFolder.py index bdb07cbdc..fd4c28918 100644 --- a/module/plugins/crypter/FileserveComFolder.py +++ b/module/plugins/crypter/FileserveComFolder.py @@ -26,7 +26,7 @@ class FileserveComFolder(Crypter): new_links = [] - folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + folder = re.search(self.FOLDER_PATTERN, html, re.S) if folder is None: self.fail("Parse error (FOLDER)") diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py index 35ee7791c..402a04c22 100644 --- a/module/plugins/crypter/FreetexthostCom.py +++ b/module/plugins/crypter/FreetexthostCom.py @@ -18,7 +18,7 @@ class FreetexthostCom(SimpleCrypter): def getLinks(self): - m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.DOTALL) + m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.S) if m is None: self.fail('Unable to extract links | Plugin may be out-of-date') links = m.group(1) diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNetFolder.py index c7f6fc738..7f1f8f3d0 100644 --- a/module/plugins/crypter/LetitbitNetFolder.py +++ b/module/plugins/crypter/LetitbitNetFolder.py @@ -24,7 +24,7 @@ class LetitbitNetFolder(Crypter): def decrypt(self, pyfile): html = self.load(pyfile.url) - folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + folder = re.search(self.FOLDER_PATTERN, html, re.S) if folder is None: self.fail("Parse error (FOLDER)") diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index e601e8173..b22d87f38 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -125,7 +125,6 @@ class LinkSaveIn(SimpleCrypter): if self.captcha: if "Wrong code. Please retry" in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: @@ -140,7 +139,7 @@ class LinkSaveIn(SimpleCrypter): elif type_ == "web": return self.handleWebLinks() else: - self.error('unknown source type "%s" (this is probably a bug)' % type_) + self.error('Unknown source type "%s" (this is probably a bug)' % type_) def handleWebLinks(self): @@ -176,7 +175,7 @@ class LinkSaveIn(SimpleCrypter): type_ = type_.lower() self.logDebug("Seach for %s Container links" % type_.upper()) if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) - self.error('unknown container type "%s" (this is probably a bug)' % type_) + self.error('Unknown container type "%s" (this is probably a bug)' % type_) pattern = r'\(\'%s_link\'\).href=unescape\(\'(.*?\.%s)\'\)' % (type_, type_) containersLinks = re.findall(pattern, self.html) self.logDebug("Found %d %s Container links" % (len(containersLinks), type_.upper())) diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 0358d1308..98efd3d84 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -58,7 +58,7 @@ class LinkdecrypterCom(Crypter): self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) while self.passwords or retries: - m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL) + m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S) if m: return [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 32423e228..744066d19 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -27,7 +27,7 @@ class LixIn(Crypter): m = re.match(self.__pattern__, url) if m is None: - self.fail("couldn't identify file id") + self.error("Unable to identify file ID") id = m.group("ID") self.logDebug("File id is %s" % id) @@ -36,7 +36,7 @@ class LixIn(Crypter): m = re.search(self.SUBMIT_PATTERN, self.html) if m is None: - self.fail("link doesn't seem valid") + self.error("Link doesn't seem valid") m = re.search(self.CAPTCHA_PATTERN, self.html) if m: @@ -54,7 +54,7 @@ class LixIn(Crypter): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.fail("can't find destination url") + self.error("Unable to find destination url") else: self.urls = [m.group("link")] self.logDebug("Found link %s, adding to package" % self.urls[0]) diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 54b6eeba2..6c31a19f1 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -94,7 +94,7 @@ class NCryptIn(Crypter): r'<table class="global">(.*?)</table>', r'<iframe\s+style="display:none(.*?)</iframe>') for pattern in patterns: - rexpr = re.compile(pattern, re.DOTALL) + rexpr = re.compile(pattern, re.S) content = re.sub(rexpr, "", content) return content @@ -107,7 +107,7 @@ class NCryptIn(Crypter): def isProtected(self): - form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL) + form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.S) if form is not None: content = form.group(1) for keyword in ("password", "captcha"): @@ -133,7 +133,7 @@ class NCryptIn(Crypter): def unlockProtection(self): postData = {} - form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.DOTALL).group(1) + form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.S).group(1) # Submit package password if "password" in form: @@ -181,7 +181,6 @@ class NCryptIn(Crypter): if self.protection_type == "captcha": if "The securitycheck was wrong!" in self.cleanedHtml: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: @@ -205,7 +204,7 @@ class NCryptIn(Crypter): elif link_source_type == "web": return self.handleWebLinks() else: - self.error('unknown source type "%s" (this is probably a bug)' % link_source_type) + self.error('Unknown source type "%s" (this is probably a bug)' % link_source_type) def handleSingleLink(self): diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCzFolder.py index 60c2d1a40..c368353f7 100644 --- a/module/plugins/crypter/QuickshareCzFolder.py +++ b/module/plugins/crypter/QuickshareCzFolder.py @@ -23,7 +23,7 @@ class QuickshareCzFolder(Crypter): def decrypt(self, pyfile): html = self.load(pyfile.url) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: self.fail("Parse error (FOLDER)") self.urls.extend(re.findall(self.LINK_PATTERN, m.group(1))) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index b4ee31568..5c9d9e5ca 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -173,7 +173,6 @@ class RelinkUs(Crypter): if self.captcha: if self.CAPTCHA_ERROR_ROKEN in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.retry() else: @@ -194,7 +193,7 @@ class RelinkUs(Crypter): def handleCNL2Links(self): self.logDebug("Search for CNL2 links") package_links = [] - m = re.search(self.CNL2_FORM_REGEX, self.html, re.DOTALL) + m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) if m is not None: cnl2_form = m.group(1) try: @@ -248,11 +247,11 @@ class RelinkUs(Crypter): def _getCipherParams(self, cnl2_form): # Get jk jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY - vjk = re.findall(jk_re, cnl2_form, re.IGNORECASE) + vjk = re.findall(jk_re, cnl2_form, re.I) # Get crypted crypted_re = self.CNL2_FORMINPUT_REGEX % RelinkUs.CNL2_CRYPTED_KEY - vcrypted = re.findall(crypted_re, cnl2_form, re.IGNORECASE) + vcrypted = re.findall(crypted_re, cnl2_form, re.I) # Log and return self.logDebug("Detected %d crypted blocks" % len(vcrypted)) diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 9ef4529cb..fcc48ca22 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -31,7 +31,7 @@ class SafelinkingNet(Crypter): if re.match(self.__pattern__, url).group(1) == "d": self.req.http.c.setopt(FOLLOWLOCATION, 0) self.load(url) - m = re.search("^Location: (.+)$", self.req.http.header, re.MULTILINE) + m = re.search("^Location: (.+)$", self.req.http.header, re.M) if m: self.urls = [m.group(1)] else: diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 126a7e5dc..bc79c5f70 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -121,7 +121,6 @@ class ShareLinksBiz(Crypter): # Resolve captcha href = self._resolveCoords(coords, captchaMap) if href is None: - self.logDebug("Invalid captcha resolving, retrying") self.invalidCaptcha() self.setWait(5, False) self.wait() @@ -154,7 +153,6 @@ class ShareLinksBiz(Crypter): if self.captcha: if "Your choice was wrong" in self.html: - self.logDebug("Invalid captcha, retrying") self.invalidCaptcha() self.setWait(5) self.wait() @@ -168,7 +166,7 @@ class ShareLinksBiz(Crypter): # Extract from web package header title_re = r'<h2><img.*?/>(.*)</h2>' - m = re.search(title_re, self.html, re.DOTALL) + m = re.search(title_re, self.html, re.S) if m is not None: title = m.group(1).strip() if 'unnamed' not in title: @@ -202,7 +200,7 @@ class ShareLinksBiz(Crypter): fwLink = self.baseUrl + "/get/frm/" + code response = self.load(fwLink) jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', response, - re.DOTALL).group(1) + re.S).group(1) jscode = self.js.eval("f = %s" % jscode) jslauncher = "window=''; parent={frames:{Main:{location:{href:''}}},location:''}; %s; parent.frames.Main.location.href" dlLink = self.js.eval(jslauncher % jscode) diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index bc8571f7c..241f382ad 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -27,7 +27,7 @@ class UlozToFolder(Crypter): new_links = [] for i in xrange(1, 100): self.logInfo("Fetching links from page %i" % i) - m = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + m = re.search(self.FOLDER_PATTERN, html, re.S) if m is None: self.fail("Parse error (FOLDER)") |