summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-09-03 00:13:48 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-09-03 00:13:48 +0200
commit24fd08a6773a4cddfb3dc7d81e85d9bec7d18205 (patch)
tree4648fc52ed8f58988f37e86ef3b9b43a5e3f4335
parentdynamic webinterface (diff)
downloadpyload-24fd08a6773a4cddfb3dc7d81e85d9bec7d18205.tar.xz
netload fix
-rw-r--r--Plugins/NetloadIn.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/Plugins/NetloadIn.py b/Plugins/NetloadIn.py
index 733347272..11765f42a 100644
--- a/Plugins/NetloadIn.py
+++ b/Plugins/NetloadIn.py
@@ -72,31 +72,36 @@ class NetloadIn(Plugin):
def download_html2(self):
url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)', self.html[0]).group(1).replace("amp;", "")
- self.html[1] = self.req.load(url_captcha_html, cookies=True)
- try:
- captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', self.html[1]).group(1)
- except:
- url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)', self.html[1]).group(1).replace("amp;", "")
+ for i in range(6):
+
self.html[1] = self.req.load(url_captcha_html, cookies=True)
- captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', self.html[1]).group(1)
+
+ try:
+ captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', self.html[1]).group(1)
+ except:
+ url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)', self.html[1]).group(1).replace("amp;", "")
+ self.html[1] = self.req.load(url_captcha_html, cookies=True)
+ captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', self.html[1]).group(1)
- file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', self.html[1]).group(1)
+ file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', self.html[1]).group(1)
- captcha_image = tempfile.NamedTemporaryFile(suffix=".png").name
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".png").name
- for i in range(10):
+
self.req.download(captcha_url, captcha_image, cookies=True)
captcha = self.ocr.get_captcha(captcha_image)
self.logger.debug("Captcha %s: %s" % (i, captcha))
sleep(5)
self.html[2] = self.req.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha}, cookies=True)
+
+ os.remove(captcha_image)
+
if re.search(r"(We will prepare your download..|We had a reqeust with the IP)", self.html[2]) != None:
return True
raise Exception, "Captcha reading failed"
- os.remove(captcha_image)
def get_file_url(self):
""" returns the absolute downloadable filepath