diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-20 18:43:15 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-27 22:46:01 +0100 |
commit | 5deded62d94c04be64d34f6b67d07803eea9b6bf (patch) | |
tree | a33f82a6208b3a922bf5e1883f134a1fb86a9217 /module | |
parent | Update addons (diff) | |
download | pyload-5deded62d94c04be64d34f6b67d07803eea9b6bf.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module')
51 files changed, 256 insertions, 233 deletions
diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 33f7eeae9..d28cc830b 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -21,19 +21,20 @@ class FastixRu(MultiAccount): def grab_hosters(self, user, password, data): html = self.load("http://fastix.ru/api_v2", - get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", - 'sub' : "allowed_sources"}) + get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", + 'sub' : "allowed_sources"}) host_list = json.loads(html) host_list = host_list['allow'] return host_list def grab_info(self, user, password, data): - html = json.loads(self.load("http://fastix.ru/api_v2/", - get={'apikey': data['apikey'], - 'sub' : "getaccountdetails"})) + html = self.load("http://fastix.ru/api_v2/", + get={'apikey': data['apikey'], + 'sub' : "getaccountdetails"}) + json_data = json.loads(html) - points = html['points'] + points = json_data['points'] kb = float(points) * 1024 ** 2 / 1000 if points > 0: @@ -44,10 +45,11 @@ class FastixRu(MultiAccount): def signin(self, user, password, data): - api = json.loads(self.load("https://fastix.ru/api_v2/", - get={'sub' : "get_apikey", - 'email' : user, - 'password': password})) + html = self.load("https://fastix.ru/api_v2/", + get={'sub' : "get_apikey", + 'email' : user, + 'password': password}) + api = json.loads(html) if 'error' in api: self.fail_login(api['error_txt']) diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index b2759e63b..13807c99f 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -20,8 +20,8 @@ class HighWayMe(MultiAccount): def grab_hosters(self, user, password, data): - json_data = json.loads(self.load("https://high-way.me/api.php", - get={'hoster': 1})) + html = self.load("https://high-way.me/api.php", get={'hoster': 1}) + json_data = json.loads(html) return [element['name'] for element in json_data['hoster']] diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index ae2f71564..d61c7cbdd 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -32,7 +32,8 @@ class NoPremiumPl(MultiAccount): 'info' : "1" } def grab_hosters(self, user, password, data): - hostings = json.loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip()) + html = self.load("https://www.nopremium.pl/clipboard.php?json=3").strip() + hostings = json.loads(html) hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.log_debug(hostings_domains) diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index eeb2b1fd4..cb3342e49 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -35,9 +35,10 @@ class OboomCom(Account): salt = password[::-1] pbkdf2 = PBKDF2(password, salt, 1000).hexread(16) - result = json.loads(self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 - get={'auth': user, - 'pass': pbkdf2})) + html = self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 + get={'auth': user, + 'pass': pbkdf2}) + result = json.loads(html) if result[0] is not 200: self.log_warning(_("Failed to log in: %s") % result[1]) diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 1f12fde83..0155d4efc 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -41,11 +41,11 @@ class OverLoadMe(MultiAccount): def signin(self, user, password, data): - jsondata = self.load("https://api.over-load.me/account.php", - get={'user': user, - 'auth': password}).strip() + html = self.load("https://api.over-load.me/account.php", + get={'user': user, + 'auth': password}).strip() - data = json.loads(jsondata) + data = json.loads(html) if data['err'] is 1: self.fail_login() diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index a92b9e345..30e35dc39 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -32,7 +32,8 @@ class RapideoPl(MultiAccount): 'info' : "1" } def grab_hosters(self, user, password, data): - hostings = json.loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip()) + html = self.load("https://www.rapideo.pl/clipboard.php?json=3").strip() + hostings = json.loads(html) hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.log_debug(hostings_domains) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index e1f194afe..3057fb34c 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -34,17 +34,17 @@ class RapidgatorNet(Account): self.log_debug("API:USERINFO", html) - jso = json.loads(html) + json_data = json.loads(html) - if jso['response_status'] is 200: - if "reset_in" in jso['response']: - self._schedule_refresh(user, jso['response']['reset_in']) + if json_data['response_status'] is 200: + if "reset_in" in json_data['response']: + self._schedule_refresh(user, json_data['response']['reset_in']) - validuntil = jso['response']['expire_date'] - trafficleft = float(jso['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + validuntil = json_data['response']['expire_date'] + trafficleft = float(json_data['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 premium = True else: - self.log_error(jso['response_details']) + self.log_error(json_data['response_details']) except Exception, e: self.log_error(e, trace=True) @@ -63,13 +63,13 @@ class RapidgatorNet(Account): self.log_debug("API:LOGIN", html) - jso = json.loads(html) + json_data = json.loads(html) - if jso['response_status'] is 200: - data['sid'] = str(jso['response']['session_id']) + if json_data['response_status'] is 200: + data['sid'] = str(json_data['response']['session_id']) return else: - self.log_error(jso['response_details']) + self.log_error(json_data['response_details']) except Exception, e: self.log_error(e, trace=True) diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 985dd9b16..e9d16977d 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -53,14 +53,15 @@ class RapiduNet(Account): post={'_go' : "", 'lang': "en"}) - jso = json.loads(self.load("https://rapidu.net/ajax.php", - get={'a': "getUserLogin"}, - post={'_go' : "", - 'login' : user, - 'pass' : password, - 'remember': "1"})) + html = self.load("https://rapidu.net/ajax.php", + get={'a': "getUserLogin"}, + post={'_go' : "", + 'login' : user, + 'pass' : password, + 'remember': "1"}) + json_data = json.loads(html) - self.log_debug(jso) + self.log_debug(json_data) - if jso['message'] != "success": + if json_data['message'] != "success": self.fail_login() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index a1f6679b4..a6b9ba3be 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -83,6 +83,7 @@ class SmoozedCom(MultiAccount): salt = hashlib.sha256(password).hexdigest() encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) - return json.loads(self.load("http://www2.smoozed.com/api/login", - get={'auth': user, - 'password': encrypted})) + html = self.load("http://www2.smoozed.com/api/login", + get={'auth': user, + 'password': encrypted}) + return json.loads(html) diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index c2fca1ab4..517dc7652 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -119,7 +119,7 @@ class FilecryptCc(Crypter): elif m3: #: Solvemedia captcha self.log_debug("Solvemedia Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m3.group(1))) - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self.pyfile) captcha_key = solvemedia.detect_key() if captcha_key: @@ -134,12 +134,12 @@ class FilecryptCc(Crypter): self.retry() else: - recaptcha = ReCaptcha(self) - captcha_key = self.captcha.detect_key() + recaptcha = ReCaptcha(self.pyfile) + captcha_key = recaptcha.detect_key() if captcha_key: self.captcha = recaptcha - + try: response, challenge = recaptcha.challenge(captcha_key) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 65b671c11..ea8103ad7 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -72,7 +72,7 @@ class LinkCryptWs(Crypter): self.getunrarpw() #: Get package name and folder - package_name, folder_name = self.get_package_info() + pack_name, folder_name = self.get_package_info() #: Get the container definitions from script section self.get_container_html() @@ -86,7 +86,7 @@ class LinkCryptWs(Crypter): break if self.urls: - self.packages = [(package_name, self.urls, folder_name)] + self.packages = [(pack_name, self.urls, folder_name)] def is_online(self): @@ -187,7 +187,7 @@ class LinkCryptWs(Crypter): def handle_web_links(self): self.log_debug("Search for Web links ") - package_links = [] + pack_links = [] pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"' ids = re.findall(pattern, self.data, re.I | re.S) @@ -203,12 +203,12 @@ class LinkCryptWs(Crypter): link2 = res[indexs:indexe] link2 = html_unescape(link2) - package_links.append(link2) + pack_links.append(link2) except Exception, detail: self.log_debug("Error decrypting Web link %s, %s" % (weblink_id, detail)) - return package_links + return pack_links def get_container_html(self): @@ -227,7 +227,7 @@ class LinkCryptWs(Crypter): def handle_container(self, type): - package_links = [] + pack_links = [] type = type.lower() self.log_debug('Search for %s Container links' % type.upper()) @@ -245,18 +245,18 @@ class LinkCryptWs(Crypter): self.log_debug("clink found") - package_name, folder_name = self.get_package_info() - self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) - self.pyload.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) + pack_name, folder_name = self.get_package_info() + self.log_debug("Added package with name %s.%s and container link %s" %( pack_name, type, clink.group(1))) + self.pyload.api.uploadContainer('.'.join([pack_name, type]), self.load(clink.group(1))) return "Found it" - return package_links + return pack_links def handle_CNL2(self): self.log_debug("Search for CNL links") - package_links = [] + pack_links = [] cnl_line = None for line in self.container_html: @@ -271,13 +271,13 @@ class LinkCryptWs(Crypter): cnl_section = self.handle_javascript(cnl_line) (vcrypted, vjk) = self._get_cipher_params(cnl_section) for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"), trace=True) return self.handle_web_links() - return package_links + return pack_links def _get_cipher_params(self, cnl_section): diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 464552c97..d75b5946a 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -73,16 +73,17 @@ class MediafireComFolder(Crypter): folder_key = m.group(1) self.log_debug("FOLDER KEY: %s" % folder_key) - json_resp = json.loads(self.load("http://www.mediafire.com/api/folder/get_info.php", - get={'folder_key' : folder_key, - 'response_format': "json", - 'version' : 1})) - # self.log_info(json_resp) - if json_resp['response']['result'] == "Success": - for link in json_resp['response']['folder_info']['files']: + html = self.load("http://www.mediafire.com/api/folder/get_info.php", + get={'folder_key' : folder_key, + 'response_format': "json", + 'version' : 1}) + json_data = json.loads(html) + # self.log_info(json_data) + if json_data['response']['result'] == "Success": + for link in json_data['response']['folder_info']['files']: self.links.append("http://www.mediafire.com/file/%s" % link['quickkey']) else: - self.fail(json_resp['response']['message']) + self.fail(json_data['response']['message']) elif result is 1: self.offline() diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 2ebdd5de8..c0e48ba25 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -43,13 +43,13 @@ class NCryptIn(Crypter): def decrypt(self, pyfile): #: Init self.package = pyfile.package() - package_links = [] - package_name = self.package.name + pack_links = [] + pack_name = self.package.name folder_name = self.package.folder #: Deal with single links if self.is_single_link(): - package_links.extend(self.handle_single_link()) + pack_links.extend(self.handle_single_link()) #: Deal with folders else: @@ -67,18 +67,18 @@ class NCryptIn(Crypter): self.handle_errors() #: Prepare package name and folder - (package_name, folder_name) = self.get_package_info() + (pack_name, folder_name) = self.get_package_info() #: Extract package links for link_source_type in self.links_source_order: - package_links.extend(self.handle_link_source(link_source_type)) - if package_links: #: Use only first source which provides links + pack_links.extend(self.handle_link_source(link_source_type)) + if pack_links: #: Use only first source which provides links break - package_links = set(package_links) + pack_links = set(pack_links) #: Pack and return links - if package_links: - self.packages = [(package_name, package_links, folder_name)] + if pack_links: + self.packages = [(pack_name, pack_links, folder_name)] def is_single_link(self): @@ -157,8 +157,8 @@ class NCryptIn(Crypter): self.log_debug("ReCaptcha protected") captcha_key = re.search(r'\?k=(.*?)"', form).group(1) self.log_debug("Resolving ReCaptcha with key [%s]" % captcha_key) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(captcha_key) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(captcha_key) postData['recaptcha_challenge_field'] = challenge postData['recaptcha_response_field'] = response @@ -210,44 +210,44 @@ class NCryptIn(Crypter): def handle_single_link(self): self.log_debug("Handling Single link") - package_links = [] + pack_links = [] #: Decrypt single link decrypted_link = self.decrypt_link(self.pyfile.url) if decrypted_link: - package_links.append(decrypted_link) + pack_links.append(decrypted_link) - return package_links + return pack_links def handle_CNL2(self): self.log_debug("Handling CNL2 links") - package_links = [] + pack_links = [] if 'cnl2_output' in self.cleaned_html: try: (vcrypted, vjk) = self._get_cipher_params() for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.fail(_("Unable to decrypt CNL2 links")) - return package_links + return pack_links def handle_containers(self): self.log_debug("Handling Container links") - package_links = [] + pack_links = [] pattern = r'/container/(rsdf|dlc|ccf)/(\w+)' containersLinks = re.findall(pattern, self.data) self.log_debug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: link = "http://ncrypt.in/container/%s/%s.%s" % (containerLink[0], containerLink[1], containerLink[0]) - package_links.append(link) + pack_links.append(link) - return package_links + return pack_links def handle_web_links(self): @@ -255,15 +255,15 @@ class NCryptIn(Crypter): pattern = r'(http://ncrypt\.in/link-.*?=)' links = re.findall(pattern, self.data) - package_links = [] + pack_links = [] self.log_debug("Decrypting %d Web links" % len(links)) for i, link in enumerate(links): self.log_debug("Decrypting Web link %d, %s" % (i + 1, link)) decrypted_link = self.decrypt(link) if decrypted_link: - package_links.append(decrypted_link) + pack_links.append(decrypted_link) - return package_links + return pack_links def decrypt_link(self, link): diff --git a/module/plugins/crypter/NitroflareComFolder.py b/module/plugins/crypter/NitroflareComFolder.py index 80d0e9270..db80c4234 100644 --- a/module/plugins/crypter/NitroflareComFolder.py +++ b/module/plugins/crypter/NitroflareComFolder.py @@ -23,11 +23,12 @@ class NitroflareComFolder(SimpleCrypter): def get_links(self): - res = json.loads(self.load("http://nitroflare.com/ajax/folder.php", - post={'userId' : self.info['pattern']['USER'], - 'folder' : self.info['pattern']['ID'], - 'page' : 1, - 'perPage': 10000})) + html = self.load("http://nitroflare.com/ajax/folder.php", + post={'userId' : self.info['pattern']['USER'], + 'folder' : self.info['pattern']['ID'], + 'page' : 1, + 'perPage': 10000}) + res = json.loads(html) if res['name']: self.pyfile.name = res['name'] else: diff --git a/module/plugins/crypter/PastedCo.py b/module/plugins/crypter/PastedCo.py index ac55049fc..f6988ed11 100644 --- a/module/plugins/crypter/PastedCo.py +++ b/module/plugins/crypter/PastedCo.py @@ -27,8 +27,8 @@ class PastedCo(Crypter): def decrypt(self, pyfile): package = pyfile.package() - package_name = package.name - package_folder = package.folder + pack_name = package.name + pack_folder = package.folder html = self.load(pyfile.url, decode = True).splitlines() fs_url = None FS_URL_RE = re.compile('%s/fullscreen\.php\?hash=[0-9a-f]*' % pyfile.url) @@ -42,4 +42,4 @@ class PastedCo(Crypter): urls = self.load(fs_url, decode = True) urls = urls[urls.find(PastedCo.FS_URL_PREFIX) + len(PastedCo.FS_URL_PREFIX):] urls = urls[:urls.find(PastedCo.FS_URL_SUFFIX)].splitlines() - self.packages.append((package_name, urls, package_folder)) + self.packages.append((pack_name, urls, pack_folder)) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 13bb0d0b2..16a0ac234 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -87,19 +87,19 @@ class RelinkUs(Crypter): self.handle_errors() #: Get package name and folder - (package_name, folder_name) = self.get_package_info() + (pack_name, folder_name) = self.get_package_info() #: Extract package links - package_links = [] + pack_links = [] for sources in self.PREFERRED_LINK_SOURCES: - package_links.extend(self.handle_link_source(sources)) - if package_links: #: Use only first source which provides links + pack_links.extend(self.handle_link_source(sources)) + if pack_links: #: Use only first source which provides links break - package_links = set(package_links) + pack_links = set(pack_links) #: Pack - if package_links: - self.packages = [(package_name, package_links, folder_name)] + if pack_links: + self.packages = [(pack_name, pack_links, folder_name)] def init_package(self, pyfile): @@ -197,24 +197,24 @@ class RelinkUs(Crypter): def handle_CNL2Links(self): self.log_debug("Search for CNL2 links") - package_links = [] + pack_links = [] m = re.search(self.CNL2_FORM_REGEX, self.data, re.S) if m is not None: cnl2_form = m.group(1) try: (vcrypted, vjk) = self._get_cipher_params(cnl2_form) for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.log_debug("Unable to decrypt CNL2 links", trace=True) - return package_links + return pack_links def handle_DLC_links(self): self.log_debug("Search for DLC links") - package_links = [] + pack_links = [] m = re.search(self.DLC_LINK_REGEX, self.data) if m is not None: container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid @@ -225,18 +225,18 @@ class RelinkUs(Crypter): dlc_filepath = fsjoin(self.pyload.config.get("general", "download_folder"), dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) - package_links.append(dlc_filepath) + pack_links.append(dlc_filepath) except Exception: self.fail(_("Unable to download DLC container")) - return package_links + return pack_links def handle_WEB_links(self): self.log_debug("Search for WEB links") - package_links = [] + pack_links = [] params = re.findall(self.WEB_FORWARD_REGEX, self.data) self.log_debug("Decrypting %d Web links" % len(params)) @@ -250,14 +250,14 @@ class RelinkUs(Crypter): res = self.load(url) link = re.search(self.WEB_LINK_REGEX, res).group(1) - package_links.append(link) + pack_links.append(link) except Exception, detail: self.log_debug("Error decrypting Web link %s, %s" % (index, detail)) self.wait(4) - return package_links + return pack_links def _get_cipher_params(self, cnl2_form): diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 9ec91b45a..a41d1e8d1 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -52,7 +52,7 @@ class SafelinkingNet(Crypter): m = re.search(self.SOLVEMEDIA_PATTERN, self.data) if m is not None: captchaKey = m.group(1) - captcha = SolveMedia(self) + captcha = SolveMedia(pyfile) captchaProvider = "Solvemedia" else: self.fail(_("Error parsing captcha")) diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index c19f4ffd4..2ae17019e 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -36,10 +36,10 @@ class SexuriaCom(Crypter): self.package = pyfile.package() #: Decrypt and add links - package_name, self.urls, folder_name, package_pwd = self.decrypt_links(self.pyfile.url) - if package_pwd: - self.pyfile.package().password = package_pwd - self.packages = [(package_name, self.urls, folder_name)] + pack_name, self.urls, folder_name, pack_pwd = self.decrypt_links(self.pyfile.url) + if pack_pwd: + self.pyfile.package().password = pack_pwd + self.packages = [(pack_name, self.urls, folder_name)] def decrypt_links(self, url): diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 12d647e7a..d62eba779 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -54,17 +54,17 @@ class ShareLinksBiz(Crypter): self.handle_errors() #: Extract package links - package_links = [] - package_links.extend(self.handle_web_links()) - package_links.extend(self.handle_containers()) - package_links.extend(self.handle_CNL2()) - package_links = set(package_links) + pack_links = [] + pack_links.extend(self.handle_web_links()) + pack_links.extend(self.handle_containers()) + pack_links.extend(self.handle_CNL2()) + pack_links = set(pack_links) #: Get package info - package_name, package_folder = self.get_package_info() + pack_name, pack_folder = self.get_package_info() #: Pack - self.packages = [(package_name, package_links, package_folder)] + self.packages = [(pack_name, pack_links, pack_folder)] def init_file(self, pyfile): @@ -201,7 +201,7 @@ class ShareLinksBiz(Crypter): def handle_web_links(self): - package_links = [] + pack_links = [] self.log_debug("Handling Web links") #@TODO: Gather paginated web links @@ -227,16 +227,16 @@ class ShareLinksBiz(Crypter): self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink) - package_links.append(dlLink) + pack_links.append(dlLink) except Exception, detail: self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail)) - return package_links + return pack_links def handle_containers(self): - package_links = [] + pack_links = [] self.log_debug("Handling Container links") pattern = r'javascript:_get\(\'(.*?)\', 0, \'(rsdf|ccf|dlc)\'\)' @@ -244,23 +244,23 @@ class ShareLinksBiz(Crypter): self.log_debug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: link = "%s/get/%s/%s" % (self.base_url, containerLink[1], containerLink[0]) - package_links.append(link) - return package_links + pack_links.append(link) + return pack_links def handle_CNL2(self): - package_links = [] + pack_links = [] self.log_debug("Handling CNL2 links") if '/lib/cnl2/ClicknLoad.swf' in self.data: try: (crypted, jk) = self._get_cipher_params() - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.fail(_("Unable to decrypt CNL2 links")) - return package_links + return pack_links def _get_cipher_params(self): diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 6ba2cb4e7..e8a587532 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -33,8 +33,9 @@ class AlldebridCom(MultiHoster): def handle_premium(self, pyfile): password = self.get_password() - data = json.loads(self.load("http://www.alldebrid.com/service.php", - get={'link': pyfile.url, 'json': "true", 'pw': password})) + html = self.load("http://www.alldebrid.com/service.php", + get={'link': pyfile.url, 'json': "true", 'pw': password}) + data = json.loads(html) self.log_debug("Json data", data) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 9562e0724..951920444 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -116,9 +116,9 @@ class BitshareCom(SimpleHoster): #: Resolve captcha if captcha is 1: self.log_debug("File is captcha protected") - recaptcha = ReCaptcha(self.pyfile) + self.captcha = ReCaptcha(self.pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={'request' : "validateCaptcha", 'ajaxid' : self.ajaxid, diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 37b194054..0efe0717c 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -42,9 +42,9 @@ class CatShareNet(SimpleHoster): def handle_free(self, pyfile): - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() self.data = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 59543e6c0..2205759e8 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -56,10 +56,10 @@ class CrockoCom(SimpleHoster): action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = self.captcha.challenge() self.download(action, post=inputs) - if self.scan_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): + if self.scan_download({'captcha': self.captcha.KEY_AJAX_PATTERN}): self.retry_captcha() diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 3a584f8c7..a7ffb6548 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -37,7 +37,7 @@ class DateiTo(SimpleHoster): def handle_free(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) for _i in xrange(3): self.log_debug("URL", url, "POST", data) @@ -58,8 +58,8 @@ class DateiTo(SimpleHoster): url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) - if url.endswith('recaptcha.php'): - data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() + if url.endswith('self.captcha.php'): + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = self.captcha.challenge() else: return diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 621d73151..06630d763 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -58,15 +58,15 @@ class DepositfilesCom(SimpleHoster): self.check_errors() - recaptcha = ReCaptcha(pyfile) - captcha_key = recaptcha.detect_key() + self.captcha = ReCaptcha(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key is None: return self.data = self.load("https://dfiles.eu/get_file.php", get=params) if '<input type=button value="Continue" onclick="check_recaptcha' in self.data: - params['response'], params['challenge'] = recaptcha.challenge(captcha_key) + params['response'], params['challenge'] = self.captcha.challenge(captcha_key) self.data = self.load("https://dfiles.eu/get_file.php", get=params) m = re.search(self.LINK_FREE_PATTERN, self.data) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 10dd476ca..436d31041 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -52,13 +52,14 @@ class ExtabitCom(SimpleHoster): m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.data) if m is not None: - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) captcha_key = m.group(1) get_data = {'type': "recaptcha"} - get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) + get_data['capture'], get_data['challenge'] = self.captcha.challenge(captcha_key) - res = json.loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + html = self.load("http://extabit.com/file/%s/" % fileID, get=get_data) + res = json.loads(html) if "ok" in res: self.captcha.correct() diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 7f551ef0c..b245e449d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -57,15 +57,15 @@ class FilecloudIo(SimpleHoster): self.error(_("__AB1")) data['__ab1'] = m.group(1) - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) m = re.search(self.RECAPTCHA_PATTERN, self.data) - captcha_key = m.group(1) if m else recaptcha.detect_key() + captcha_key = m.group(1) if m else self.captcha.detect_key() if captcha_key is None: self.error(_("ReCaptcha key not found")) - response, challenge = recaptcha.challenge(captcha_key) + response, challenge = self.captcha.challenge(captcha_key) self.account.form_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response} self.account.relogin() @@ -82,7 +82,7 @@ class FilecloudIo(SimpleHoster): self.log_debug(res) if res['captcha']: data['ctype'] = "recaptcha" - data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) + data['recaptcha_response'], data['recaptcha_challenge'] = self.captcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 963bdbac4..c47684522 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -77,14 +77,15 @@ class FilepostCom(SimpleHoster): self.link = self.get_json_response(get_dict, post_dict, 'link') if not self.link: - #: Solve recaptcha - recaptcha = ReCaptcha(pyfile) - post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) + #: Solve ReCaptcha + self.captcha = ReCaptcha(pyfile) + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = self.captcha.challenge(captcha_key) self.link = self.get_json_response(get_dict, post_dict, 'link') def get_json_response(self, get_dict, post_dict, field): - res = json.loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) + html = self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict) + res = json.loads(html) self.log_debug(res) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 7c0b7bb5d..a1ad5d8c9 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -48,8 +48,8 @@ class FilerNet(SimpleHoster): if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() header = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 58db17381..d682134ee 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -157,13 +157,14 @@ class FileserveCom(Hoster): def do_captcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.data).group(1) - recaptcha = ReCaptcha(self.pyfile) - - response, challenge = recaptcha.challenge(captcha_key) - res = json.loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field' : challenge, - 'recaptcha_response_field' : response, - 'recaptcha_shortencode_field': self.file_id})) + self.captcha = ReCaptcha(self.pyfile) + + response, challenge = self.captcha.challenge(captcha_key) + html = self.load(self.URLS[2], + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, + 'recaptcha_shortencode_field': self.file_id}) + res = json.loads(html) if res['success']: self.captcha.correct() else: diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 8c5cc53cd..43c89176b 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -114,7 +114,7 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.data) self.log_debug("CAPTCHA_PATTERN found %s" % m) - + if m is not None: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 14ba59fc7..e1d44d63c 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -51,8 +51,8 @@ class KingfilesNet(SimpleHoster): self.data = self.load(pyfile.url, post=post_data) - solvemedia = SolveMedia(pyfile) - response, challenge = solvemedia.challenge() + self.captcha = SolveMedia(pyfile) + response, challenge = self.captcha.challenge() #: Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.data) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 199057b48..805e15bf9 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -91,8 +91,8 @@ class LetitbitNet(SimpleHoster): self.log_debug(res) - recaptcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index af5032b00..d33f1c9ef 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -57,12 +57,12 @@ class LoadTo(SimpleHoster): if m is not None: self.wait(m.group(1)) - #: Load.to is using solvemedia captchas since ~july 2014: - solvemedia = SolveMedia(pyfile) - captcha_key = solvemedia.detect_key() + #: Load.to is using SolveMedia captchas since ~july 2014: + self.captcha = SolveMedia(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key: - response, challenge = solvemedia.challenge(captcha_key) + response, challenge = self.captcha.challenge(captcha_key) self.download(self.link, post={'adcopy_challenge': challenge, 'adcopy_response' : response, diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 96fd0f829..1aa5501d5 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -51,14 +51,14 @@ class LuckyShareNet(SimpleHoster): self.log_debug("JSON: " + rep) - jso = self.parse_json(rep) - self.wait(jso['time']) + json_data = self.parse_json(rep) + self.wait(json_data['time']) - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % - (challenge, response, jso['hash'])) + (challenge, response, json_data['hash'])) self.log_debug("JSON: " + rep) @@ -67,6 +67,6 @@ class LuckyShareNet(SimpleHoster): elif 'link' in rep: self.captcha.correct() - jso.update(self.parse_json(rep)) - if jso['link']: - self.link = jso['link'] + json_data.update(self.parse_json(rep)) + if json_data['link']: + self.link = json_data['link'] diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 304b7a87d..09ddc5ba8 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -57,8 +57,8 @@ class NitroflareCom(SimpleHoster): self.wait(wait_time) - recaptcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) self.data = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method' : "fetchDownload", diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 340ca170d..bb823256f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -47,9 +47,7 @@ class OboomCom(Hoster): self.download("http://%s/1.0/dlh" % self.download_domain, get={'ticket': self.download_ticket, 'http_errors': 0}) - def load_url(self, url, get=None): - if get is None: - get = {} + def load_url(self, url, get={}): return json.loads(self.load(url, get)) @@ -74,8 +72,8 @@ class OboomCom(Hoster): def solve_captcha(self): - recaptcha = ReCaptcha(self.pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) apiUrl = "http://www.oboom.com/1.0/download/ticket" params = {'recaptcha_challenge_field': challenge, diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index ce909cc64..1f98aa0fe 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -38,11 +38,12 @@ class PremiumizeMe(MultiHoster): user, info = self.account.select() #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) - data = json.loads(self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 - get={'method' : "directdownloadlink", - 'params[login]': user, - 'params[pass]' : info['login']['password'], - 'params[link]' : pyfile.url})) + html = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 + get={'method' : "directdownloadlink", + 'params[login]': user, + 'params[pass]' : info['login']['password'], + 'params[link]' : pyfile.url}) + data = json.loads(html) #: Check status and decide what to do status = data['status'] diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index a4f6f4190..27fb4fda0 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -73,9 +73,9 @@ class RapidgatorNet(SimpleHoster): get={'sid': self.sid, 'url': self.pyfile.url}) self.log_debug("API:%s" % cmd, html, "SID: %s" % self.sid) - jso = json.loads(html) - status = jso['response_status'] - msg = jso['response_details'] + json_data = json.loads(html) + status = json_data['response_status'] + msg = json_data['response_details'] except BadHeader, e: self.log_error("API: %s" % cmd, e, "SID: %s" % self.sid) @@ -83,7 +83,7 @@ class RapidgatorNet(SimpleHoster): msg = e if status is 200: - return jso['response'] + return json_data['response'] elif status is 423: self.account.empty() diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 9a1501c8d..dea828274 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -60,8 +60,8 @@ class RapiduNet(SimpleHoster): else: self.wait(int(jsvars['timeToDownload']) - int(time.time())) - recaptcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getCheckCaptcha"}, diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 8cf9ab8ce..41208df89 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -32,11 +32,12 @@ class RealdebridCom(MultiHoster): def handle_premium(self, pyfile): - data = json.loads(self.load("https://real-debrid.com/ajax/unrestrict.php", - get={'lang' : "en", - 'link' : pyfile.url, - 'password': self.get_password(), - 'time' : int(time.time() * 1000)})) + html = self.load("https://real-debrid.com/ajax/unrestrict.php", + get={'lang' : "en", + 'link' : pyfile.url, + 'password': self.get_password(), + 'time' : int(time.time() * 1000)}) + data = json.loads(html) self.log_debug("Returned Data: %s" % data) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 73dfd9caf..c2cc1f987 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -43,7 +43,8 @@ class SmoozedCom(MultiHoster): get_data = {'session_key': self.account.get_data('session'), 'url' : pyfile.url} - data = json.loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + html = self.load("http://www2.smoozed.com/api/check", get=get_data) + data = json.loads(html) if data['state'] != "ok": self.fail(data['message']) diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 6c74840f9..854e98d54 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -42,8 +42,9 @@ class SoundcloudCom(SimpleHoster): client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" #: Url to retrieve the actual song url - streams = json.loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, - get={'client_id': client_id})) + html = self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, + get={'client_id': client_id}) + streams = json.loads(html) regex = re.compile(r'[^\d]') http_streams = sorted([(key, value) for key, value in streams.items() if key.startswith('http_')], diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 2cf9a80ad..724ac0916 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -79,8 +79,8 @@ class TurbobitNet(SimpleHoster): self.log_debug(inputs) if inputs['captcha_type'] == "recaptcha": - recaptcha = ReCaptcha(self.pyfile) - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + self.captcha = ReCaptcha(self.pyfile) + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = self.captcha.challenge() else: m = re.search(self.CAPTCHA_PATTERN, self.data) if m is None: diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 2122f7837..70ff60eda 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -44,13 +44,13 @@ class UploadableCh(SimpleHoster): self.wait(30) - #: Make the recaptcha appear and show it the pyload interface + #: Make the ReCaptcha appear and show it the pyload interface b = self.load(pyfile.url, post={'checkDownload': "check"}) self.log_debug(b) #: Expected output: {'success': "showCaptcha"} - recaptcha = ReCaptcha(pyfile) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) #: Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 06f5cb662..2fe1c9744 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -75,8 +75,8 @@ class UploadedTo(SimpleHoster): self.data = self.load("http://uploaded.net/js/download.js") - recaptcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() self.data = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], post={'recaptcha_challenge_field': challenge, diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index f44fc9ea3..d8447e964 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -75,7 +75,10 @@ class UploadingCom(SimpleHoster): self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url - res = json.loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) + html = self.load(ajax_url, + post={'action': 'second_page', + 'code' : self.info['pattern']['ID']}) + res = json.loads(html) if 'answer' in res and 'wait_time' in res['answer']: wait_time = int(res['answer']['wait_time']) @@ -84,7 +87,11 @@ class UploadingCom(SimpleHoster): else: self.error(_("No AJAX/WAIT")) - res = json.loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['pattern']['ID'], 'pass': 'false'})) + html = self.load(ajax_url, + post={'action': 'get_link', + 'code' : self.info['pattern']['ID'], + 'pass' : 'false'}) + res = json.loads(html) if 'answer' in res and 'link' in res['answer']: url = res['answer']['link'] diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index fbf03b7d3..ca8a85c6d 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -42,8 +42,8 @@ class UpstoreNet(SimpleHoster): self.check_errors() #: STAGE 2: solv captcha and wait - #: First get the infos we need: recaptcha key and wait time - recaptcha = ReCaptcha(pyfile) + #: First get the infos we need: self.captcha key and wait time + self.captcha = ReCaptcha(pyfile) #: Try the captcha 5 times for i in xrange(5): @@ -56,7 +56,7 @@ class UpstoreNet(SimpleHoster): self.wait(wait_time) #: then, handle the captcha - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -85,4 +85,4 @@ class UpstoreNet(SimpleHoster): self.wantReconnect = True self.retry(wait_time=3600, reason=_("Upstore doesn't like us today")) - + diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 9d6e28b79..24c90a856 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -41,7 +41,8 @@ class YibaishiwuCom(SimpleHoster): self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url) - res = json.loads(self.load(urlparse.urljoin("http://115.com/", url), decode=False)) + html = self.load(urlparse.urljoin("http://115.com/", url), decode=False) + res = json.loads(html) if "urls" in res: mirrors = res['urls'] diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 8026fc0ea..b1b084ee8 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -45,13 +45,13 @@ class ZippyshareCom(SimpleHoster): def handle_free(self, pyfile): - recaptcha = ReCaptcha(pyfile) - captcha_key = recaptcha.detect_key() + self.captcha = ReCaptcha(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key: try: self.link = re.search(self.LINK_PREMIUM_PATTERN, self.data) - recaptcha.challenge() + self.captcha.challenge() except Exception, e: self.error(e) diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index 9179f59ec..183186fd2 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -20,7 +20,7 @@ class Expose(object): def __new__(cls, fn, *args, **kwargs): hookManager.addRPC(fn.__module__, fn.func_name, fn.func_doc) return fn - + class Addon(Plugin): __name__ = "Addon" @@ -34,7 +34,7 @@ class Addon(Plugin): __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - + def __init__(self, core, manager): self._init(core) |