From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/crypter/DataHuFolder.py | 4 +-- module/plugins/crypter/DlProtectCom.py | 2 +- module/plugins/crypter/FilecryptCc.py | 6 ++-- module/plugins/crypter/LinkCryptWs.py | 28 ++++++++-------- module/plugins/crypter/MediafireComFolder.py | 6 ++-- module/plugins/crypter/NCryptIn.py | 48 ++++++++++++++-------------- module/plugins/crypter/RelinkUs.py | 36 ++++++++++----------- module/plugins/crypter/SexuriaCom.py | 14 ++++---- module/plugins/crypter/ShareLinksBiz.py | 42 ++++++++++++------------ module/plugins/crypter/YoutubeComFolder.py | 2 +- 10 files changed, 94 insertions(+), 94 deletions(-) (limited to 'module/plugins/crypter') diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index fcbc5b2af..0b241bf66 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -28,7 +28,7 @@ class DataHuFolder(SimpleCrypter): def prepare(self): super(DataHuFolder, self).prepare() - if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected + if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: #: Password protected password = self.getPassword() if not password: self.fail(_("Password required")) @@ -37,7 +37,7 @@ class DataHuFolder(SimpleCrypter): self.html = self.load(self.pyfile.url, post={'mappa_pass': password}) - if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password + if u'Hib\xe1s jelsz\xf3' in self.html: #: Wrong password self.fail(_("Wrong password")) diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index fde43ff43..6ced6a706 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -29,7 +29,7 @@ class DlProtectCom(SimpleCrypter): def getLinks(self): - # Direct link with redirect + #: Direct link with redirect if not re.match(r"https?://(?:www\.)?dl-protect\.com/.+", self.req.http.lastEffectiveURL): return [self.req.http.lastEffectiveURL] diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 7ca5659fb..769877802 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -160,16 +160,16 @@ class FilecryptCc(Crypter): def _getLinks(self, crypted, jk): - # Get key + #: Get key key = binascii.unhexlify(str(jk)) - # Decrypt + #: Decrypt Key = key IV = key obj = AES.new(Key, AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) - # Extract links + #: Extract links text = text.replace("\x00", "").replace("\r", "") links = filter(bool, text.split('\n')) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 28c431e80..b9abb08d2 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -36,12 +36,12 @@ class LinkCryptWs(Crypter): def prepare(self): - # Init + #: Init self.fileid = re.match(self.__pattern__, self.pyfile.url).group('ID') self.req.cj.setCookie("linkcrypt.ws", "language", "en") - # Request package + #: Request package self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: better chance to not get those key-captchas self.html = self.load(self.pyfile.url) @@ -63,21 +63,21 @@ class LinkCryptWs(Crypter): self.unlockCaptchaProtection() self.handleCaptchaErrors() - # Check for protection + #: Check for protection if self.isPasswordProtected(): self.unlockPasswordProtection() self.handleErrors() - # get unrar password + #: get unrar password self.getunrarpw() - # Get package name and folder + #: Get package name and folder package_name, folder_name = self.getPackageInfo() #get the container definitions from script section self.get_container_html() - # Extract package links + #: Extract package links for type in self.sources: links = self.handleLinkSource(type) @@ -234,7 +234,7 @@ class LinkCryptWs(Crypter): self.logDebug('Search 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) + if not type.isalnum(): #: check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) self.fail(_("Unknown container type: %s") % type) #@TODO: Replace with self.error in 0.4.10 for line in self.container_html: @@ -282,37 +282,37 @@ class LinkCryptWs(Crypter): def _getCipherParams(self, cnl_section): - # Get jk + #: Get jk jk_re = r'', self.cleanedHtml, re.S).group(1) - # Submit package password + #: Submit package password if "password" in form: password = self.getPassword() self.logDebug("Submitting password [%s] for protected links" % password) postData['password'] = password - # Resolve anicaptcha + #: Resolve anicaptcha if "anicaptcha" in form: self.logDebug("Captcha protected") captchaUri = re.search(r'src="(/temp/anicaptcha/.+?)"', form).group(1) @@ -149,7 +149,7 @@ class NCryptIn(Crypter): self.logDebug("Captcha resolved [%s]" % captcha) postData['captcha'] = captcha - # Resolve recaptcha + #: Resolve recaptcha if "recaptcha" in form: self.logDebug("ReCaptcha protected") captcha_key = re.search(r'\?k=(.*?)"', form).group(1) @@ -159,7 +159,7 @@ class NCryptIn(Crypter): postData['recaptcha_challenge_field'] = challenge postData['recaptcha_response_field'] = response - # Resolve circlecaptcha + #: Resolve circlecaptcha if "circlecaptcha" in form: self.logDebug("CircleCaptcha protected") captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" @@ -168,7 +168,7 @@ class NCryptIn(Crypter): postData['circle.x'] = coords[0] postData['circle.y'] = coords[1] - # Unlock protection + #: Unlock protection postData['submit_protected'] = 'Continue to folder' return self.load(self.pyfile.url, post=postData) @@ -188,13 +188,13 @@ class NCryptIn(Crypter): def handleLinkSource(self, link_source_type): - # Check for JS engine + #: Check for JS engine require_js_engine = link_source_type in ("cnl2", "rsdf", "ccf", "dlc") if require_js_engine and not self.js: self.logDebug("No JS engine available, skip %s links" % link_source_type) return [] - # Select suitable handler + #: Select suitable handler if link_source_type == 'single': return self.handleSingleLink() if link_source_type == 'cnl2': @@ -211,7 +211,7 @@ class NCryptIn(Crypter): self.logDebug("Handling Single link") package_links = [] - # Decrypt single link + #: Decrypt single link decrypted_link = self.decryptLink(self.pyfile.url) if decrypted_link: package_links.append(decrypted_link) @@ -276,35 +276,35 @@ class NCryptIn(Crypter): def _getCipherParams(self): pattern = r'(.*)' m = re.search(title_re, self.html, re.S) if m: @@ -170,13 +170,13 @@ class ShareLinksBiz(Crypter): name = folder = title self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) - # Fallback to defaults + #: Fallback to defaults if not name or not folder: name = self.package.name folder = self.package.folder self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) - # Return package info + #: Return package info return name, folder @@ -240,40 +240,40 @@ class ShareLinksBiz(Crypter): def _getCipherParams(self): - # Request CNL2 + #: Request CNL2 code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) url = "%s/get/cnl2/%s" % (self.baseUrl, code) res = self.load(url) params = res.split(";;") - # Get jk + #: Get jk strlist = list(params[1].decode('base64')) jk = ''.join(strlist[::-1]) - # Get crypted + #: Get crypted strlist = list(params[2].decode('base64')) crypted = ''.join(strlist[::-1]) - # Log and return + #: Log and return return crypted, jk def _getLinks(self, crypted, jk): - # Get key + #: Get key jreturn = self.js.eval("%s f()" % jk) self.logDebug("JsEngine returns value [%s]" % jreturn) key = binascii.unhexlify(jreturn) - # Decrypt + #: Decrypt Key = key IV = key obj = AES.new(Key, AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) - # Extract links + #: Extract links text = text.replace("\x00", "").replace("\r", "") links = filter(bool, text.split('\n')) - # Log and return + #: Log and return self.logDebug("Block has %d links" % len(links)) return links diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index c6f86113d..fed832b7d 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -42,7 +42,7 @@ class YoutubeComFolder(Crypter): return {"id": channel['id'], "title": channel['snippet']['title'], "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], - "user": user} # One lone channel for user? + "user": user} #: One lone channel for user? def getPlaylist(self, p_id): -- cgit v1.2.3