summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-06-20 16:30:01 +0200
committerGravatar spoob <spoob@gmx.de> 2009-06-20 16:30:01 +0200
commit41f78f21c779e940861fb8f4e2c4436fff2c1f45 (patch)
tree8cc17f6b77f9621922e983c1bd31d53a5ed5a427
parentsome new cli stuff (no interactive functions yet) (diff)
downloadpyload-41f78f21c779e940861fb8f4e2c4436fff2c1f45.tar.xz
Added Netload.in Download Plugin
-rw-r--r--Plugins/GigasizeCom.py5
-rw-r--r--Plugins/NetloadIn.py85
-rw-r--r--module/file_list.py8
-rw-r--r--pyLoadCli.py12
4 files changed, 99 insertions, 11 deletions
diff --git a/Plugins/GigasizeCom.py b/Plugins/GigasizeCom.py
index edc92b2ba..2f9e26f5d 100644
--- a/Plugins/GigasizeCom.py
+++ b/Plugins/GigasizeCom.py
@@ -41,6 +41,7 @@ class GigasizeCom(Plugin):
if re.search(r"Package features", self.html[1]) != None:
if re.search(r"YOU HAVE REACHED YOUR HOURLY LIMIT", self.html[1]) != None:
self.time_plus_wait = time() + 3600 #one hour
+ #self.time_plus_wait = time() + 60
break
os.remove(captcha_image)
@@ -79,5 +80,5 @@ class GigasizeCom(Plugin):
return True
def proceed(self, url, location):
-
- self.req.download(url, location, cookies=True)
+ print url
+ print self.req.load(url, cookies=True)
diff --git a/Plugins/NetloadIn.py b/Plugins/NetloadIn.py
new file mode 100644
index 000000000..ade424868
--- /dev/null
+++ b/Plugins/NetloadIn.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+
+from Plugin import Plugin
+
+class NetloadIn(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "NetloadIn"
+ props['type'] = "hoster"
+ props['pattern'] = r"(?:http://)?(?:www.)?http://netload.in/"
+ props['version'] = "0.1"
+ props['description'] = """Netload.in Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = [None, None, None]
+ self.want_reconnect = False
+ self.init_ocr()
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html[0] = self.req.load(url, cookies=True)
+ 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)
+ 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)
+
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".png").name
+
+ for i in range(5):
+ self.req.download(captcha_url, captcha_image, cookies=True)
+ captcha = self.ocr.get_captcha(captcha_image)
+ self.html[2] = self.req.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha}, cookies=True)
+ if re.search(r"download:", self.html[2]) != None:
+ self.time_plus_wait = time() + 20
+ break
+
+ os.remove(captcha_image)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html[0] == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_url_pattern = '<a class="Orange_Link" href="(http://.+)" >Click here'
+ search = re.search(file_url_pattern, self.html[2])
+ if search:
+ return search.group(1)
+ return ""
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html[0] == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name_pattern = '\t\t\t(.+)<span style="color: #8d8d8d;">'
+ return re.search(file_name_pattern, self.html[0]).group(1)
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html[0] == None:
+ self.download_html()
+ if re.search(r"The file has been deleted", self.html[0]) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location, cookies=True)
diff --git a/module/file_list.py b/module/file_list.py
index 00a3e0603..dbac8ea02 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -50,10 +50,12 @@ class File_List(object):
def remove(self, pyfile):
- if pyfile in self.files:
- self.files.remove(pyfile)
+ pass
- del self.data[pyfile.id]
+ #if pyfile in self.files:
+ #self.files.remove(pyfile)
+#
+ #del self.data[pyfile.id]
def get_id(self):
"""return a free id"""
diff --git a/pyLoadCli.py b/pyLoadCli.py
index f948e1fb5..0e9145041 100644
--- a/pyLoadCli.py
+++ b/pyLoadCli.py
@@ -169,12 +169,12 @@ class _GetchWindows:
if __name__ == "__main__":
if len(sys.argv) != 4:
- address = raw_input("Adress:")
- port = raw_input("Port:")
- password = raw_input("Password:")
- #address = "localhost"
- #port = "7272"
- #password = "pwhere"
+ #address = raw_input("Adress:")
+ #port = raw_input("Port:")
+ #password = raw_input("Password:")
+ address = "localhost"
+ port = "7272"
+ password = "pwhere"
cli = pyLoadCli(address, port, password)
else:
cli = pyLoadCli( * sys.argv[1:])