summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-09 16:58:35 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-09 16:58:35 +0100
commit4d578cb15f3d6edd036e438e504739b97660f93e (patch)
treeea8fd0a2a62466204feebb046525226f4297c962
parentFix __version__ format in some plugins (diff)
downloadpyload-4d578cb15f3d6edd036e438e504739b97660f93e.tar.xz
Spare code cosmetics
-rw-r--r--module/plugins/captcha/captcha.py25
-rw-r--r--module/plugins/container/CCF.py7
-rw-r--r--module/plugins/crypter/FilecryptCc.py8
-rw-r--r--module/plugins/crypter/NCryptIn.py4
-rw-r--r--module/plugins/crypter/RelinkUs.py25
-rw-r--r--module/plugins/crypter/SafelinkingNet.py2
-rw-r--r--module/plugins/hooks/MergeFiles.py61
-rw-r--r--module/plugins/hoster/BitshareCom.py8
-rw-r--r--module/plugins/hoster/CatShareNet.py4
-rw-r--r--module/plugins/hoster/DlFreeFr.py8
-rw-r--r--module/plugins/hoster/FilecloudIo.py6
-rw-r--r--module/plugins/hoster/FilepostCom.py37
-rw-r--r--module/plugins/hoster/FileserveCom.py6
-rw-r--r--module/plugins/hoster/IfileIt.py27
-rw-r--r--module/plugins/hoster/KingfilesNet.py30
-rw-r--r--module/plugins/hoster/LoadTo.py7
-rw-r--r--module/plugins/hoster/MediafireCom.py8
-rw-r--r--module/plugins/hoster/RapidgatorNet.py10
-rw-r--r--module/plugins/hoster/RapiduNet.py12
-rw-r--r--module/plugins/hoster/UploadableCh.py4
-rw-r--r--module/plugins/hoster/UploadedTo.py4
-rw-r--r--module/plugins/hoster/UpstoreNet.py6
22 files changed, 168 insertions, 141 deletions
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py
index 5dcde33fb..0f233ec00 100644
--- a/module/plugins/captcha/captcha.py
+++ b/module/plugins/captcha/captcha.py
@@ -81,18 +81,19 @@ class OCR(object):
if subset and (digits or lowercase or uppercase):
#tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
- tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb")
- tmpSub.write("tessedit_char_whitelist ")
- if digits:
- tmpSub.write("0123456789")
- if lowercase:
- tmpSub.write("abcdefghijklmnopqrstuvwxyz")
- if uppercase:
- tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
- tmpSub.write("\n")
- tessparams.append("nobatch")
- tessparams.append(abspath(tmpSub.name))
- tmpSub.close()
+ with open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") as tmpSub:
+ tmpSub.write("tessedit_char_whitelist ")
+
+ if digits:
+ tmpSub.write("0123456789")
+ if lowercase:
+ tmpSub.write("abcdefghijklmnopqrstuvwxyz")
+ if uppercase:
+ tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+
+ tmpSub.write("\n")
+ tessparams.append("nobatch")
+ tessparams.append(abspath(tmpSub.name))
self.logger.debug("run tesseract")
self.run(tessparams)
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py
index ff7d43e08..bca535175 100644
--- a/module/plugins/container/CCF.py
+++ b/module/plugins/container/CCF.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+from __future__ import with_statement
+
import re
from os import makedirs
@@ -35,8 +37,7 @@ class CCF(Container):
download_folder = self.config['general']['download_folder']
tempdlc_name = save_join(download_folder, "tmp_%s.dlc" % pyfile.name)
- tempdlc = open(tempdlc_name, "w")
- tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1))
- tempdlc.close()
+ with open(tempdlc_name, "w") as tempdlc:
+ tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1))
self.urls = [tempdlc_name]
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py
index fb53e616b..0aa730744 100644
--- a/module/plugins/crypter/FilecryptCc.py
+++ b/module/plugins/crypter/FilecryptCc.py
@@ -107,10 +107,10 @@ class FilecryptCc(Crypter):
weblinks = re.findall(self.WEBLINK_PATTERN, self.siteWithLinks)
for link in weblinks:
- response = self.load("http://filecrypt.cc/Link/%s.html" % link, cookies=True)
- link2 = re.search('<iframe noresize src="(.*)"></iframe>', response)
- response2 = self.load(link2.group(1), just_header=True, cookies=True)
- self.links.append(response2['location'])
+ res = self.load("http://filecrypt.cc/Link/%s.html" % link, cookies=True)
+ link2 = re.search('<iframe noresize src="(.*)"></iframe>', res)
+ res2 = self.load(link2.group(1), just_header=True, cookies=True)
+ self.links.append(res2['location'])
except Exception, e:
self.logDebug("Error decrypting weblinks: %s" % e)
diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py
index 3c08e26c1..1d572e538 100644
--- a/module/plugins/crypter/NCryptIn.py
+++ b/module/plugins/crypter/NCryptIn.py
@@ -156,9 +156,9 @@ class NCryptIn(Crypter):
captcha_key = re.search(r'\?k=(.*?)"', form).group(1)
self.logDebug("Resolving ReCaptcha with key [%s]" % captcha_key)
recaptcha = ReCaptcha(self)
- challenge, code = recaptcha.challenge(captcha_key)
+ challenge, response = recaptcha.challenge(captcha_key)
postData['recaptcha_challenge_field'] = challenge
- postData['recaptcha_response_field'] = code
+ postData['recaptcha_response_field'] = response
# Resolve circlecaptcha
if "circlecaptcha" in form:
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index 1111118b2..94a73cded 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -228,20 +228,29 @@ class RelinkUs(Crypter):
def handleWEBLinks(self):
self.logDebug("Search for WEB links")
+
package_links = []
- fw_params = re.findall(self.WEB_FORWARD_REGEX, self.html)
- self.logDebug("Decrypting %d Web links" % len(fw_params))
- for index, fw_param in enumerate(fw_params):
+ params = re.findall(self.WEB_FORWARD_REGEX, self.html)
+
+ self.logDebug("Decrypting %d Web links" % len(params))
+
+ for index, param in enumerate(params):
try:
- fw_url = self.WEB_FORWARD_URL + "?%s" % fw_param
- self.logDebug("Decrypting Web link %d, %s" % (index + 1, fw_url))
- fw_response = self.load(fw_url, decode=True)
- dl_link = re.search(self.WEB_LINK_REGEX, fw_response).group('link')
- package_links.append(dl_link)
+ url = self.WEB_FORWARD_URL + "?%s" % param
+
+ self.logDebug("Decrypting Web link %d, %s" % (index + 1, url))
+
+ res = self.load(url, decode=True)
+ link = re.search(self.WEB_LINK_REGEX, res).group('link')
+
+ package_links.append(link)
+
except Exception, detail:
self.logDebug("Error decrypting Web link %s, %s" % (index, detail))
+
self.setWait(4)
self.wait()
+
return package_links
diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py
index 9bb6c3229..709083b51 100644
--- a/module/plugins/crypter/SafelinkingNet.py
+++ b/module/plugins/crypter/SafelinkingNet.py
@@ -57,7 +57,7 @@ class SafelinkingNet(Crypter):
challenge, response = captcha.challenge(captchaKey)
postData['adcopy_challenge'] = challenge
- postData['adcopy_response'] = response
+ postData['adcopy_response'] = response
self.html = self.load(url, post=postData)
if "The password you entered was incorrect" in self.html:
diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py
index 767209d21..4de45f958 100644
--- a/module/plugins/hooks/MergeFiles.py
+++ b/module/plugins/hooks/MergeFiles.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+from __future__ import with_statement
+
import os
import re
@@ -53,32 +55,35 @@ class MergeFiles(Hook):
for name, file_list in files.iteritems():
self.logInfo(_("Starting merging of"), name)
- final_file = open(save_join(download_folder, name), "wb")
-
- for splitted_file in file_list:
- self.logDebug("Merging part", splitted_file)
- pyfile = self.core.files.getFile(fid_dict[splitted_file])
- pyfile.setStatus("processing")
- try:
- s_file = open(os.path.join(download_folder, splitted_file), "rb")
- size_written = 0
- s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file)))
- while True:
- f_buffer = s_file.read(self.BUFFER_SIZE)
- if f_buffer:
- final_file.write(f_buffer)
- size_written += self.BUFFER_SIZE
- pyfile.setProgress((size_written * 100) / s_file_size)
- else:
- break
- s_file.close()
- self.logDebug("Finished merging part", splitted_file)
- except Exception, e:
- print_exc()
- finally:
- pyfile.setProgress(100)
- pyfile.setStatus("finished")
- pyfile.release()
-
- final_file.close()
+
+ with open(save_join(download_folder, name), "wb") as final_file:
+ for splitted_file in file_list:
+ self.logDebug("Merging part", splitted_file)
+
+ pyfile = self.core.files.getFile(fid_dict[splitted_file])
+
+ pyfile.setStatus("processing")
+
+ try:
+ with open(os.path.join(download_folder, splitted_file), "rb") as s_file:
+ size_written = 0
+ s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file)))
+ while True:
+ f_buffer = s_file.read(self.BUFFER_SIZE)
+ if f_buffer:
+ final_file.write(f_buffer)
+ size_written += self.BUFFER_SIZE
+ pyfile.setProgress((size_written * 100) / s_file_size)
+ else:
+ break
+ self.logDebug("Finished merging part", splitted_file)
+
+ except Exception, e:
+ print_exc()
+
+ finally:
+ pyfile.setProgress(100)
+ pyfile.setStatus("finished")
+ pyfile.release()
+
self.logInfo(_("Finished merging of"), name)
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 1483e5d1e..17d29680e 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -115,10 +115,12 @@ class BitshareCom(SimpleHoster):
# Try up to 3 times
for i in xrange(3):
- challenge, code = recaptcha.challenge()
+ challenge, response = recaptcha.challenge()
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request": "validateCaptcha", "ajaxid": self.ajaxid,
- "recaptcha_challenge_field": challenge, "recaptcha_response_field": code})
+ post={"request" : "validateCaptcha",
+ "ajaxid" : self.ajaxid,
+ "recaptcha_challenge_field": challenge,
+ "recaptcha_response_field" : response})
if self.handleCaptchaErrors(res):
break
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py
index 0caac5913..949a021dd 100644
--- a/module/plugins/hoster/CatShareNet.py
+++ b/module/plugins/hoster/CatShareNet.py
@@ -50,10 +50,10 @@ class CatShareNet(SimpleHoster):
recaptcha = ReCaptcha(self)
- challenge, code = recaptcha.challenge()
+ challenge, response = recaptcha.challenge()
self.html = self.load(self.pyfile.url,
post={'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': code})
+ 'recaptcha_response_field' : response})
m = re.search(self.LINK_PATTERN, self.html)
if m is None:
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index f07d46768..14b74c779 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -103,11 +103,11 @@ class AdYouLike:
if not response:
self.plugin.fail("AdYouLike result failed")
- return {"_ayl_captcha_engine": self.engine,
- "_ayl_env": ayl['all']['env'],
- "_ayl_tid": challenge['tid'],
+ return {"_ayl_captcha_engine" : self.engine,
+ "_ayl_env" : ayl['all']['env'],
+ "_ayl_tid" : challenge['tid'],
"_ayl_token_challenge": challenge['token'],
- "_ayl_response": response}
+ "_ayl_response" : response}
class DlFreeFr(SimpleHoster):
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 495f2268d..cb9782f23 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -58,9 +58,9 @@ class FilecloudIo(SimpleHoster):
if not self.account:
self.fail(_("User not logged in"))
elif not self.account.logged_in:
- captcha_challenge, captcha_response = recaptcha.challenge(captcha_key)
- self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
- "recaptcha_response_field": captcha_response}
+ challenge, response = recaptcha.challenge(captcha_key)
+ self.account.form_data = {"recaptcha_challenge_field": challenge,
+ "recaptcha_response_field" : response}
self.account.relogin(self.user)
self.retry(2)
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index db5ea20d3..b94892ef4 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -92,36 +92,39 @@ class FilepostCom(SimpleHoster):
def getJsonResponse(self, get_dict, post_dict, field):
- json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))
- self.logDebug(json_response)
+ res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))
- if not 'js' in json_response:
+ self.logDebug(res)
+
+ if not 'js' in res:
self.error(_("JSON %s 1") % field)
- # i changed js_answer to json_response['js'] since js_answer is nowhere set.
+ # i changed js_answer to res['js'] since js_answer is nowhere set.
# i don't know the JSON-HTTP specs in detail, but the previous author
- # accessed json_response['js']['error'] as well as js_answer['error'].
+ # accessed res['js']['error'] as well as js_answer['error'].
# see the two lines commented out with "# ~?".
- if 'error' in json_response['js']:
- if json_response['js']['error'] == 'download_delay':
- self.retry(wait_time=json_response['js']['params']['next_download'])
+ if 'error' in res['js']:
+
+ if res['js']['error'] == 'download_delay':
+ self.retry(wait_time=res['js']['params']['next_download'])
# ~? self.retry(wait_time=js_answer['params']['next_download'])
- elif 'Wrong file password' in json_response['js']['error']:
- return None
- elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']:
- return None
- elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']:
+
+ elif ('Wrong file password' in res['js']['error']
+ or 'You entered a wrong CAPTCHA code' in res['js']['error']
+ or 'CAPTCHA Code nicht korrekt' in res['js']['error']):
return None
- elif 'CAPTCHA' in json_response['js']['error']:
+
+ elif 'CAPTCHA' in res['js']['error']:
self.logDebug("Error response is unknown, but mentions CAPTCHA")
return None
+
else:
- self.fail(json_response['js']['error'])
+ self.fail(res['js']['error'])
- if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:
+ if not 'answer' in res['js'] or not field in res['js']['answer']:
self.error(_("JSON %s 2") % field)
- return json_response['js']['answer'][field]
+ return res['js']['answer'][field]
getInfo = create_getInfo(FilepostCom)
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 82d40fba6..871a3dd26 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -159,10 +159,10 @@ class FileserveCom(Hoster):
recaptcha = ReCaptcha(self)
for _i in xrange(5):
- challenge, code = recaptcha.challenge(captcha_key)
+ challenge, response = recaptcha.challenge(captcha_key)
res = json_loads(self.load(self.URLS[2],
- post={'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': code,
+ post={'recaptcha_challenge_field' : challenge,
+ 'recaptcha_response_field' : response,
'recaptcha_shortencode_field': self.file_id}))
if not res['success']:
self.invalidCaptcha()
diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py
index b7e37457d..2dae4cd80 100644
--- a/module/plugins/hoster/IfileIt.py
+++ b/module/plugins/hoster/IfileIt.py
@@ -27,27 +27,30 @@ class IfileIt(SimpleHoster):
def handleFree(self):
- ukey = re.match(self.__pattern__, self.pyfile.url).group(1)
- json_url = 'http://ifile.it/new_download-request.json'
+ ukey = re.match(self.__pattern__, self.pyfile.url).group(1)
+ json_url = 'http://ifile.it/new_download-request.json'
post_data = {"ukey": ukey, "ab": "0"}
+ res = json_loads(self.load(json_url, post=post_data))
- json_response = json_loads(self.load(json_url, post=post_data))
- self.logDebug(json_response)
- if json_response['status'] == 3:
+ self.logDebug(res)
+
+ if res['status'] == 3:
self.offline()
- if json_response['captcha']:
+ if res['captcha']:
captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
post_data['ctype'] = "recaptcha"
for _i in xrange(5):
- post_data['recaptcha_challenge'], post_data['recaptcha_response'] = recaptcha.challenge(captcha_key)
- json_response = json_loads(self.load(json_url, post=post_data))
- self.logDebug(json_response)
+ challenge, response = recaptcha.challenge(captcha_key)
+ post_data.update({'recaptcha_challenge': challenge,
+ 'recaptcha_response' : response})
+ res = json_loads(self.load(json_url, post=post_data))
+ self.logDebug(res)
- if json_response['retry']:
+ if res['retry']:
self.invalidCaptcha()
else:
self.correctCaptcha()
@@ -55,10 +58,10 @@ class IfileIt(SimpleHoster):
else:
self.fail(_("Incorrect captcha"))
- if not "ticket_url" in json_response:
+ if not "ticket_url" in res:
self.error(_("No download URL"))
- self.download(json_response['ticket_url'])
+ self.download(res['ticket_url'])
getInfo = create_getInfo(IfileIt)
diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py
index c84e3bb0f..13cbf4781 100644
--- a/module/plugins/hoster/KingfilesNet.py
+++ b/module/plugins/hoster/KingfilesNet.py
@@ -36,17 +36,17 @@ class KingfilesNet(SimpleHoster):
def handleFree(self):
# Click the free user button
- post_data = {'op': "download1",
- 'usr_login': "",
- 'id': self.info['pattern']['ID'],
- 'fname': self.pyfile.name,
- 'referer': "",
+ post_data = {'op' : "download1",
+ 'usr_login' : "",
+ 'id' : self.info['pattern']['ID'],
+ 'fname' : self.pyfile.name,
+ 'referer' : "",
'method_free': "+"}
self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True)
solvemedia = SolveMedia(self)
- captcha_challenge, captcha_response = solvemedia.challenge()
+ challenge, response = solvemedia.challenge()
# Make the downloadlink appear and load the file
m = re.search(self.RAND_ID_PATTERN, self.html)
@@ -56,15 +56,15 @@ class KingfilesNet(SimpleHoster):
rand = m.group(1)
self.logDebug("rand = ", rand)
- post_data = {'op': "download2",
- 'id': self.info['pattern']['ID'],
- 'rand': rand,
- 'referer': self.pyfile.url,
- 'method_free': "+",
- 'method_premium': "",
- 'adcopy_response': captcha_response,
- 'adcopy_challenge': captcha_challenge,
- 'down_direct': "1"}
+ post_data = {'op' : "download2",
+ 'id' : self.info['pattern']['ID'],
+ 'rand' : rand,
+ 'referer' : self.pyfile.url,
+ 'method_free' : "+",
+ 'method_premium' : "",
+ 'adcopy_response' : response,
+ 'adcopy_challenge': challenge,
+ 'down_direct' : "1"}
self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True)
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 4e55496c6..0a5b26410 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -58,9 +58,12 @@ class LoadTo(SimpleHoster):
if captcha_key is None:
self.download(download_url)
else:
- captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
- self.download(download_url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response})
+ challenge, response = solvemedia.challenge(captcha_key)
+
+ self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response})
+
check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")})
+
if check == "404":
self.invalidCaptcha()
self.retry()
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index 3ed1199f6..cdfa410a9 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -117,6 +117,8 @@ class MediafireCom(SimpleHoster):
def checkCaptcha(self):
solvemedia = SolveMedia(self)
- captcha_challenge, captcha_response = solvemedia.challenge()
- self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge,
- "adcopy_response": captcha_response}, decode=True)
+ challenge, response = solvemedia.challenge()
+ self.html = self.load(self.url,
+ post={'adcopy_challenge': challenge,
+ 'adcopy_response' : response},
+ decode=True)
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 7788616a8..cc11fa7c7 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -129,13 +129,11 @@ class RapidgatorNet(SimpleHoster):
break
else:
captcha, captcha_key = self.getCaptcha()
- captcha_challenge, captcha_response = captcha.challenge(captcha_key)
+ challenge, response = captcha.challenge(captcha_key)
- self.html = self.load(url, post={
- "DownloadCaptchaForm[captcha]": "",
- "adcopy_challenge": captcha_challenge,
- "adcopy_response": captcha_response
- })
+ self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "",
+ 'adcopy_challenge' : challenge,
+ 'adcopy_response' : response})
if "The verification code is incorrect" in self.html:
self.invalidCaptcha()
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index e14b18a4f..a3b2cffcd 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -57,12 +57,12 @@ class RapiduNet(SimpleHoster):
recaptcha = ReCaptcha(self)
for _i in xrange(10):
- challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY)
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getCheckCaptcha",
{'_go' : None,
'captcha1': challenge,
- 'captcha2': code,
+ 'captcha2': response,
'fileId' : self.info['ID']})
if jsvars['message'] == 'success':
self.download(jsvars['url'])
@@ -70,13 +70,13 @@ class RapiduNet(SimpleHoster):
def getJsonResponse(self, url, post_data):
- response = self.load(url, post=post_data, decode=True)
- if not response.startswith('{'):
+ res = self.load(url, post=post_data, decode=True)
+ if not res.startswith('{'):
self.retry()
- self.logDebug(url, response)
+ self.logDebug(url, res)
- return json_loads(response)
+ return json_loads(res)
getInfo = create_getInfo(RapiduNet)
diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py
index 77b3d7d8a..3dd796900 100644
--- a/module/plugins/hoster/UploadableCh.py
+++ b/module/plugins/hoster/UploadableCh.py
@@ -53,13 +53,13 @@ class UploadableCh(SimpleHoster):
recaptcha = ReCaptcha(self)
- challenge, captcha = recaptcha.challenge(self.RECAPTCHA_KEY)
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
# Submit the captcha solution
self.load("http://www.uploadable.ch/checkReCaptcha.php",
cookies=True,
post={'recaptcha_challenge_field' : challenge,
- 'recaptcha_response_field' : captcha,
+ 'recaptcha_response_field' : response,
'recaptcha_shortencode_field': self.info['ID']},
decode=True)
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index 7af6501eb..833468a80 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -206,8 +206,8 @@ class UploadedTo(Hoster):
recaptcha = ReCaptcha(self)
for _i in xrange(5):
- challenge, result = recaptcha.challenge()
- options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": result}
+ challenge, response = recaptcha.challenge()
+ options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}
self.wait()
result = self.load(url, post=options)
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py
index 239cc92f5..25c424f1f 100644
--- a/module/plugins/hoster/UpstoreNet.py
+++ b/module/plugins/hoster/UpstoreNet.py
@@ -52,9 +52,9 @@ class UpstoreNet(SimpleHoster):
self.wait(wait_time)
# then, handle the captcha
- challenge, code = recaptcha.challenge()
- post_data['recaptcha_challenge_field'] = challenge
- post_data['recaptcha_response_field'] = code
+ challenge, response = recaptcha.challenge()
+ post_data.update({'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field' : response})
self.html = self.load(self.pyfile.url, post=post_data, decode=True)