diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-07-20 03:25:14 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-07-20 03:25:14 +0200 |
commit | 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 (patch) | |
tree | 20d379639d14a2b69deaa9e0376e33312b5bb994 /module/plugins/crypter | |
parent | [ShareRapidCom] Fix https://github.com/pyload/pyload/issues/694 (diff) | |
download | pyload-05d258d98dd8c2faf0b769840fa1e3c4acccdce8.tar.xz |
Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9
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/HoerbuchIn.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/LetitbitNetFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/LixIn.py | 26 | ||||
-rw-r--r-- | module/plugins/crypter/MultiloadCz.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/NCryptIn.py | 14 | ||||
-rw-r--r-- | module/plugins/crypter/QuickshareCzFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/ShareLinksBiz.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/UlozToFolder.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/YoutubeBatch.py | 6 |
13 files changed, 33 insertions, 33 deletions
diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareComFolder.py index e0c311ba8..76762b69b 100644 --- a/module/plugins/crypter/CzshareComFolder.py +++ b/module/plugins/crypter/CzshareComFolder.py @@ -23,7 +23,7 @@ class CzshareComFolder(Crypter): html = self.load(pyfile.url) found = re.search(self.FOLDER_PATTERN, html, re.DOTALL) - if not found: + if found is None: self.fail("Parse error (FOLDER)") self.urls.extend(re.findall(self.LINK_PATTERN, found.group(1))) diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index aa3a6d2a1..8203f0978 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -28,7 +28,7 @@ class DuckCryptInfo(Crypter): # self.logDebug("Sleeping for" % found.group(1)) # self.setWait(int(found.group(1)) ,False) found = re.match(self.__pattern__, url) - if not found: + if found is None: self.fail('Weird error in link') if str(found.group(1)) == "link": self.handleLink(url) diff --git a/module/plugins/crypter/FileserveComFolder.py b/module/plugins/crypter/FileserveComFolder.py index 28d89c75d..4a0d5a416 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) - if not folder: + if folder is None: self.fail("Parse error (FOLDER)") new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1))) diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py index d03805722..a6fb78d8e 100644 --- a/module/plugins/crypter/FreetexthostCom.py +++ b/module/plugins/crypter/FreetexthostCom.py @@ -33,7 +33,7 @@ class FreetexthostCom(SimpleCrypter): def getLinks(self): m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.DOTALL) - if not m: + if m is None: self.fail('Unable to extract links | Plugin may be out-of-date') links = m.group(1) return links.strip().split("<br />\r\n") diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index b46293bc7..88fc57244 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -39,7 +39,7 @@ class HoerbuchIn(Crypter): def decryptFolder(self, url): m = self.protection.search(url) - if not m: + if m is None: self.fail("Bad URL") url = m.group(0) diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNetFolder.py index 19e780690..adb2918a6 100644 --- a/module/plugins/crypter/LetitbitNetFolder.py +++ b/module/plugins/crypter/LetitbitNetFolder.py @@ -23,7 +23,7 @@ class LetitbitNetFolder(Crypter): html = self.load(pyfile.url) folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) - if not folder: + if folder is None: self.fail("Parse error (FOLDER)") self.urls.extend(re.findall(self.LINK_PATTERN, folder.group(0))) diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index e609c9da4..a39173903 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -24,26 +24,26 @@ class LixIn(Crypter): def decrypt(self, pyfile): url = pyfile.url - matches = re.match(self.__pattern__, url) - if not matches: + m = re.match(self.__pattern__, url) + if m is None: self.fail("couldn't identify file id") - id = matches.group("id") + id = m.group("id") self.logDebug("File id is %s" % id) self.html = self.req.load(url, decode=True) - matches = re.search(self.SUBMIT_PATTERN, self.html) - if not matches: + m = re.search(self.SUBMIT_PATTERN, self.html) + if m is None: self.fail("link doesn't seem valid") - matches = re.search(self.CAPTCHA_PATTERN, self.html) - if matches: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: for _ in xrange(5): - matches = re.search(self.CAPTCHA_PATTERN, self.html) - if matches: + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: self.logDebug("trying captcha") - captcharesult = self.decryptCaptcha("http://lix.in/" + matches.group("image")) + captcharesult = self.decryptCaptcha("http://lix.in/" + m.group("image")) self.html = self.req.load(url, decode=True, post={"capt": captcharesult, "submit": "submit", "tiny": id}) else: @@ -51,9 +51,9 @@ class LixIn(Crypter): else: self.html = self.req.load(url, decode=True, post={"submit": "submit", "tiny": id}) - matches = re.search(self.LINK_PATTERN, self.html) - if not matches: + m = re.search(self.LINK_PATTERN, self.html) + if m is None: self.fail("can't find destination url") else: - self.urls = [matches.group("link")] + self.urls = [m.group("link")] self.logDebug("Found link %s, adding to package" % self.urls[0]) diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index 0d5fa4c94..f93681be9 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -26,7 +26,7 @@ class MultiloadCz(Crypter): if re.match(self.__pattern__, pyfile.url).group(1) == "slozka": found = re.search(self.FOLDER_PATTERN, self.html) - if found is not None: + if found: self.urls.extend(found.group(1).split()) else: found = re.findall(self.LINK_PATTERN, self.html) diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index dc2f29519..f9953b994 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -100,20 +100,20 @@ class NCryptIn(Crypter): return True def isProtected(self): - form_match = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL) - if form_match: - form_content = form_match.group(1) + form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL) + if form is not None: + content = form.group(1) for keyword in ("password", "captcha"): - if keyword in form_content: + if keyword in content: self.protection_type = keyword self.logDebug("Links are %s protected" % self.protection_type) return True return False def getPackageInfo(self): - m = re.search(self.NAME_PATTERN, self.html) - if m: - name = folder = m.group('N').strip() + found = re.search(self.NAME_PATTERN, self.html) + if found: + name = folder = found.group('N').strip() self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) else: name = self.package.name diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCzFolder.py index b8db5d88c..e138b6f17 100644 --- a/module/plugins/crypter/QuickshareCzFolder.py +++ b/module/plugins/crypter/QuickshareCzFolder.py @@ -23,7 +23,7 @@ class QuickshareCzFolder(Crypter): html = self.load(pyfile.url) found = re.search(self.FOLDER_PATTERN, html, re.DOTALL) - if not found: + if found is None: self.fail("Parse error (FOLDER)") self.urls.extend(re.findall(self.LINK_PATTERN, found.group(1))) diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 13327dd2b..b56f90e15 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -113,7 +113,7 @@ class ShareLinksBiz(Crypter): # Resolve captcha href = self._resolveCoords(coords, captchaMap) - if not href: + if href is None: self.logDebug("Invalid captcha resolving, retrying") self.invalidCaptcha() self.setWait(5, False) diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index f9ddd3c84..43dbb4807 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -27,7 +27,7 @@ class UlozToFolder(Crypter): for i in xrange(1, 100): self.logInfo("Fetching links from page %i" % i) found = re.search(self.FOLDER_PATTERN, html, re.DOTALL) - if not found: + if found is None: self.fail("Parse error (FOLDER)") new_links.extend(re.findall(self.LINK_PATTERN, found.group(1))) diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py index dfac9140f..216fbb670 100644 --- a/module/plugins/crypter/YoutubeBatch.py +++ b/module/plugins/crypter/YoutubeBatch.py @@ -100,9 +100,9 @@ class YoutubeBatch(Crypter): return list(self._getVideosId(p_id)) def decrypt(self, pyfile): - match = re.match(self.__pattern__, pyfile.url) - m_id = match.group("ID") - m_type = match.group("TYPE") + m = re.match(self.__pattern__, pyfile.url) + m_id = m.group("ID") + m_type = m.group("TYPE") if m_type == "user": self.logDebug("Url recognized as Channel") |