summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-07-03 00:16:56 +0200
committerGravatar spoob <spoob@gmx.de> 2009-07-03 00:16:56 +0200
commita25cdc2e2192592f538f9215340dcaf57a07f2d6 (patch)
tree326bc5ec82fd020d14b041af80ad825c14b80ca3
parentlittle captcha improvements (diff)
downloadpyload-a25cdc2e2192592f538f9215340dcaf57a07f2d6.tar.xz
added share-online.biz download plugin
-rw-r--r--Plugins/GigasizeCom.py2
-rw-r--r--Plugins/ShareonlineBiz.py79
-rwxr-xr-xmodule/network/Request.py5
3 files changed, 83 insertions, 3 deletions
diff --git a/Plugins/GigasizeCom.py b/Plugins/GigasizeCom.py
index 2f9e26f5d..e9404263c 100644
--- a/Plugins/GigasizeCom.py
+++ b/Plugins/GigasizeCom.py
@@ -33,7 +33,7 @@ class GigasizeCom(Plugin):
captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
- for i in range(0,5):
+ for i in range(5):
self.req.download("http://www.gigasize.com/randomImage.php", captcha_image, cookies=True)
captcha = self.ocr.get_captcha(captcha_image)
self.html[1] = self.req.load("http://www.gigasize.com/formdownload.php", None, {"txtNumber": captcha}, cookies=True)
diff --git a/Plugins/ShareonlineBiz.py b/Plugins/ShareonlineBiz.py
new file mode 100644
index 000000000..868007ccc
--- /dev/null
+++ b/Plugins/ShareonlineBiz.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+from base64 import b64decode
+
+from Plugin import Plugin
+
+class ShareonlineBiz(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "ShareonlineBiz"
+ props['type'] = "hoster"
+ #http://www.share-online.biz/download.php?id=A27B9D78
+ props['pattern'] = r"(?:http://)?(?:www.)?share-online.biz/download.php\?id="
+ props['version'] = "0.1"
+ props['description'] = """Shareonline.biz Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = [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)
+
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
+
+ for i in range(5):
+ self.req.download("http://www.share-online.biz/captcha.php", captcha_image, cookies=True)
+ captcha = self.ocr.get_captcha(captcha_image)
+ self.html[1] = self.req.load(url, post={"captchacode": captcha}, cookies=True)
+ if re.search(r"Der Download ist Ihnen zu langsam?", self.html[1]) != None:
+ self.time_plus_wait = time() + 15
+ 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 = 'loadfilelink\.decode\("(.*==)"\);'
+ return b64decode(re.search(file_url_pattern, self.html[1]).group(1))
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html[0] == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name_pattern = 'class="locatedActive">Download (.*)</span>'
+ return re.search(file_name_pattern, self.html[1]).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"nicht zum Download bereitgestellt werden", self.html[0]) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location)
diff --git a/module/network/Request.py b/module/network/Request.py
index 346412446..ff50c34bc 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -48,7 +48,7 @@ class Request:
self.opener.addheaders = [
("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10"),
- ("Accept-Encoding", "gzip,deflate"),
+ ("Accept-Encoding", "deflate"),
("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"),
("Connection", "keep-alive"),
@@ -56,7 +56,7 @@ class Request:
self.downloader.addheaders = [
("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10"),
- ("Accept-Encoding", "gzip,deflate"),
+ ("Accept-Encoding", "deflate"),
("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"),
("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7")]
@@ -154,6 +154,7 @@ class Request:
if self.abort: raise AbortDownload
self.dl_arrived += len(chunk)
file.write(chunk)
+
file.close()
self.dl = False
self.dl_finished = time.time()