summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-12-20 01:12:27 +0100
committerGravatar spoob <spoob@gmx.de> 2009-12-20 01:12:27 +0100
commitda1e726d6d4ece84c94af4a9a766fb5a39325eab (patch)
treed8b9a7c89d4d753fff9539683d62ec541a6c00b5 /module/plugins
parentFixed normal hoster file_exists function (diff)
downloadpyload-da1e726d6d4ece84c94af4a9a766fb5a39325eab.tar.xz
Checksum for Shareonline.biz
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/DLC.pycbin5663 -> 5740 bytes
-rw-r--r--module/plugins/LinkList.py10
-rw-r--r--module/plugins/ShareonlineBiz.py72
3 files changed, 55 insertions, 27 deletions
diff --git a/module/plugins/DLC.pyc b/module/plugins/DLC.pyc
index 93d2bec7f..235e46e1a 100644
--- a/module/plugins/DLC.pyc
+++ b/module/plugins/DLC.pyc
Binary files differ
diff --git a/module/plugins/LinkList.py b/module/plugins/LinkList.py
index fc737e8c5..92508ce29 100644
--- a/module/plugins/LinkList.py
+++ b/module/plugins/LinkList.py
@@ -29,11 +29,11 @@ class LinkList(Plugin):
if link != "\n":
tmpLinks.append(link.replace("\n", ""))
txt.close()
-#~
- #~ if not self.parent.core.config['general']['debug_mode']:
- #~ txt = open(linkList, 'w')
- #~ txt.write("")
- #~ txt.close()
+
+ if not self.parent.core.config['general']['debug_mode']:
+ txt = open(linkList, 'w')
+ txt.write("")
+ txt.close()
#@TODO: maybe delete read txt file?
self.links = tmpLinks
diff --git a/module/plugins/ShareonlineBiz.py b/module/plugins/ShareonlineBiz.py
index a798ccefa..1b1eb6e27 100644
--- a/module/plugins/ShareonlineBiz.py
+++ b/module/plugins/ShareonlineBiz.py
@@ -26,14 +26,48 @@ class ShareonlineBiz(Plugin):
self.html = [None, None]
self.want_reconnect = False
self.init_ocr()
+ self.url = self.parent.url
+ self.read_config()
if self.config['premium']:
self.multi_dl = True
else:
self.multi_dl = False
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.download_api_data()
+ if self.api_data["status"]:
+ self.download_html()
+ pyfile.status.filename = self.api_data["filename"]
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.url = self.get_file_url()
+ pyfile.status.want_reconnect = self.want_reconnect
+ else:
+ raise Exception, "File not found"
+ return False
+
+ def download_api_data(self):
+ """
+ http://images.rapidshare.com/apidoc.txt
+ """
+ api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php?md5=1"
+ api_param_file = {"links": self.url}
+ src = self.req.load(api_url_base, cookies=False, post=api_param_file)
+
+ fields = src.split(";")
+ self.api_data = {}
+ self.api_data["fileid"] = fields[0]
+ self.api_data["status"] = fields[1]
+ if self.api_data["status"] == "NOTFOUND":
+ return
+ self.api_data["filename"] = fields[2]
+ self.api_data["size"] = fields[3] # in bytes
+ self.api_data["checksum"] = fields[4].strip().lower().replace("\n\n", "") # md5
+
def download_html(self):
if self.config['premium']:
- post_vars = {"act": "login",
+ post_vars = {ct": "login",
"location": "service.php",
"dieseid": "",
"user": self.config['username'],
@@ -47,11 +81,12 @@ class ShareonlineBiz(Plugin):
if not self.config['premium']:
captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
- for i in range(5):
+ for i in range(10):
self.req.download("http://www.share-online.biz/captcha.php", captcha_image, cookies=True)
captcha = self.ocr.get_captcha(captcha_image)
+ self.logger.debug("Captcha %s: %s" % (i, captcha))
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:
+ if re.search(r"Der Download ist Ihnen zu langsam", self.html[1]) != None:
self.time_plus_wait = time() + 15
break
@@ -60,29 +95,22 @@ class ShareonlineBiz(Plugin):
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\("(.*)\); document'
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
+ def check_file(self, local_file):
+ if self.api_data and self.api_data["checksum"]:
+ h = hashlib.md5()
+ f = open(local_file, "rb")
+ h.update(f.read())
+ f.close()
+ hexd = h.hexdigest()
+ if hexd == self.api_data["checksum"]:
+ return (True, 0)
+ else:
+ return (False, 1)
else:
- return True
+ return (True, 5)