summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-27 00:20:21 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-27 00:20:21 +0100
commit8e87787753b2e049917a5491727d285b1c5a7095 (patch)
tree9b23fb14b0f1270edc4582758bcf3a39cfd97b67 /module/plugins/hoster
parentcloses #42 (diff)
downloadpyload-8e87787753b2e049917a5491727d285b1c5a7095.tar.xz
closes #13
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/BluehostTo.py71
-rw-r--r--module/plugins/hoster/DepositfilesCom.py62
-rw-r--r--module/plugins/hoster/FilefactoryCom.py103
-rw-r--r--module/plugins/hoster/FilesmonsterCom.py94
-rw-r--r--module/plugins/hoster/FreakshareNet.py144
-rw-r--r--module/plugins/hoster/GigasizeCom.py84
-rw-r--r--module/plugins/hoster/HotfileCom.py110
-rw-r--r--module/plugins/hoster/MegauploadCom.py83
-rw-r--r--module/plugins/hoster/MyvideoDe.py65
-rw-r--r--module/plugins/hoster/NetloadIn.py157
-rw-r--r--module/plugins/hoster/RapidshareCom.py191
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py116
-rw-r--r--module/plugins/hoster/ShragleCom.py72
-rw-r--r--module/plugins/hoster/StorageTo.py104
-rw-r--r--module/plugins/hoster/UploadedTo.py150
-rw-r--r--module/plugins/hoster/XupIn.py69
-rw-r--r--module/plugins/hoster/YoupornCom.py62
-rw-r--r--module/plugins/hoster/YoutubeCom.py63
-rw-r--r--module/plugins/hoster/ZippyshareCom.py59
-rw-r--r--module/plugins/hoster/ZshareNet.py72
-rw-r--r--module/plugins/hoster/__init__.py0
21 files changed, 1931 insertions, 0 deletions
diff --git a/module/plugins/hoster/BluehostTo.py b/module/plugins/hoster/BluehostTo.py
new file mode 100644
index 000000000..eff8ebcd8
--- /dev/null
+++ b/module/plugins/hoster/BluehostTo.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from module.Plugin import Plugin
+
+class BluehostTo(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "BluehostTo"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?bluehost.to/file/"
+ props['version'] = "0.1"
+ props['description'] = """Bluehost Download PLugin"""
+ props['author_name'] = ("RaNaN")
+ props['author_mail'] = ("RaNaN@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+ time.sleep(1.5)
+ self.html = self.req.load(url, cookies=True)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+
+ inputs = re.findall(r"(<(input|form)[^>]+)", self.html)
+ for i in inputs:
+ if re.search(r"name=\"BluehostVers2dl\"",i[0]):
+ self.BluehostVers2dl = re.search(r"value=\"([^\"]+)", i[0]).group(1)
+ elif re.search(r"name=\"PHPSESSID\"",i[0]):
+ self.PHPSESSID = re.search(r"value=\"([^\"]+)", i[0]).group(1)
+ elif re.search(r"name=\"DownloadV2Hash\"",i[0]):
+ self.DownloadV2Hash = re.search(r"value=\"([^\"]+)", i[0]).group(1)
+ elif re.search(r"name=\"access\"",i[0]):
+ self.access = re.search(r"value=\"([^\"]+)", i[0]).group(1)
+ elif re.search(r"name=\"download\"",i[0]):
+ url = re.search(r"action=\"([^\"]+)", i[0]).group(1)
+
+ return url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ file_name_pattern = r"<center><b>.+: (.+)<\/b><\/center>"
+ return re.search(file_name_pattern, self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+
+ if re.search(r"html", self.html) == None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location, {'BluehostVers2dl': self.BluehostVers2dl, 'DownloadV2Hash': self.DownloadV2Hash, 'PHPSESSID': self.PHPSESSID, 'access': self.access})
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
new file mode 100644
index 000000000..6c5748096
--- /dev/null
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.Plugin import Plugin
+
+class DepositfilesCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "DepositfilesCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://depositfiles.com/.{2,}/files/"
+ props['version'] = "0.1"
+ props['description'] = """Depositfiles.com Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_url = urllib.unquote(re.search('<form action="(http://.*\.depositfiles.com/.*)" method="get" onSubmit="download_started', self.html).group(1))
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search('File name: <b title="(.*)">', self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+
+ self.req.download(url, location, cookies=True)
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
new file mode 100644
index 000000000..5b7db301d
--- /dev/null
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+from time import time
+
+class FilefactoryCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "FilefactoryCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www\.)?filefactory\.com/file/"
+ props['version'] = "0.1"
+ props['description'] = """Filefactory.com Download Plugin"""
+ props['author_name'] = ("sitacuisses","spoob","mkaay")
+ props['author_mail'] = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+ self.htmlwithlink = None
+
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.want_reconnect = False
+
+ self.download_html()
+
+ pyfile.status.exists = self.file_exists()
+
+ if not pyfile.status.exists:
+ raise Exception, "The file was not found on the server."
+ return False
+
+ self.get_waiting_time()
+
+ pyfile.status.filename = self.get_file_name()
+
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.url = self.get_file_url()
+ pyfile.status.want_reconnect = self.want_reconnect
+
+ thread.wait(self.parent)
+
+ return True
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=True)
+ tempurl = re.search('a href=\"(.*?)\".*?button\.basic\.jpg', self.html).group(1)
+ self.htmlwithlink = self.req.load("http://www.filefactory.com"+tempurl, cookies=True)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_url = re.search('a href=\"(.*?)\".*?button\.basic\.jpg', self.htmlwithlink).group(1)
+ #print file_url
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search('content=\"Download\ (\S*?)\ for\ free\.', self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def get_waiting_time(self):
+ if self.html == None:
+ self.download_html()
+ countdown_re = re.compile("countdown.*?>(\d+)")
+ m = countdown_re.search(self.htmlwithlink)
+ if m:
+ sec = int(m.group(1))
+ else:
+ sec = 0
+ self.time_plus_wait = time() + sec
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+
+ self.req.download(url, location, cookies=True)
+
diff --git a/module/plugins/hoster/FilesmonsterCom.py b/module/plugins/hoster/FilesmonsterCom.py
new file mode 100644
index 000000000..27c687363
--- /dev/null
+++ b/module/plugins/hoster/FilesmonsterCom.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Plugin for www.filesmonster.com
+# this plugin isn't fully implemented yet,but it does download
+# todo:
+# detect, if reconnect is necessary
+# download-error handling
+# postpone download, if speed is below a set limit
+# implement premium-access
+# optional replace blanks in filename with underscores
+
+import re
+import urllib
+import time
+from Plugin import Plugin
+
+class FilesmonsterCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "FilesmonsterCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(www.)??filesmonster.com/download.php"
+ props['version'] = "0.1"
+ props['description'] = """Filesmonster.com Download Plugin"""
+ props['author_name'] = ("sitacuisses","spoob")
+ props['author_mail'] = ("sitacuisses@yahoo.de","spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+ self.htmlwithlink = None
+ self.url = None
+ self.filerequest = None
+
+ def download_html(self):
+ self.url = self.parent.url
+ self.html = self.req.load(self.url) # get the start page
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ self.get_download_page() # the complex work is done here
+ file_url = self.htmlwithlink
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search(r"File\sname:\s<span\sclass=\"em\">(.*?)</span>", self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None:
+ return False
+ else:
+ return True
+
+ def get_download_page(self):
+ herewego = re.findall(r"<form\sid=\'slowdownload\'\smethod=\"post\"\saction=\"http://filesmonster.com/get/free/\">\s*\n\s*<input\stype=\"hidden\"\sname=\"(\S*?)\"\svalue=\"(\S*?)\"\s*>", self.html)
+ the_download_page = self.req.load("http://filesmonster.com/get/free/", None, herewego)
+ temporary_filtered = re.search(r"</div><form\sid=\'rtForm\'\sname=\"rtForm\"\smethod=\"post\">\s*\n(\s*<input\stype=\'hidden\'\sname=\'(\S*?)\'\svalue=\'(\S*?)\'>\s*\n)*?\s*</form>", the_download_page).group(0)
+ all_the_tuples = re.findall(r"<input\stype=\'hidden\'\sname=\'(\S*?)\'\svalue=\'(\S*?)\'", temporary_filtered)
+ time.sleep(30)
+ herewego = None
+ herewego = self.req.load('http://filesmonster.com/ajax.php', None, all_the_tuples)
+ ticket_number = re.search(r"\"text\":\"(.*?)\"\,\"error\"", herewego).group(1)
+ herewego = None
+ herewego = self.req.load('http://filesmonster.com/ajax.php', None, {'act': 'getdl', 'data': ticket_number})
+ ticket_number = None
+ ticket_number = re.search(r"\"url\":\"(.*?)\"", herewego).group(1)
+ the_download_page = re.sub(r"\\/", r"/", ticket_number)
+ ticket_number = urllib.quote(the_download_page.encode('utf8'))
+ self.htmlwithlink = re.sub("http%3A", "http:", ticket_number)
+ self.filerequest = re.search(r"\"file_request\":\"(.*?)\"", herewego).group(1)
+
+ def proceed(self, url, location):
+
+ self.req.download(url, location, None, {"X-File-Request": self.filerequest})
diff --git a/module/plugins/hoster/FreakshareNet.py b/module/plugins/hoster/FreakshareNet.py
new file mode 100644
index 000000000..0768b5476
--- /dev/null
+++ b/module/plugins/hoster/FreakshareNet.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+import httplib
+from module.Plugin import Plugin
+from time import time
+
+
+class FreakshareNet(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "FreakshareNet"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www\.)?freakshare\.net/files/\S*?/"
+ props['version'] = "0.1"
+ props['description'] = """Freakshare.com Download Plugin"""
+ props['author_name'] = ("sitacuisses","spoob","mkaay")
+ props['author_mail'] = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+ self.req_opts = list()
+
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.want_reconnect = False
+
+ self.download_html()
+
+ pyfile.status.exists = self.file_exists()
+
+ if not pyfile.status.exists:
+ raise Exception, "The file was not found on the server."
+ return False
+
+ self.get_waiting_time()
+
+ pyfile.status.filename = self.get_file_name()
+
+ pyfile.status.waituntil = self.time_plus_wait
+ thread.wait(self.parent)
+ pyfile.status.url = self.get_file_url()
+ pyfile.status.want_reconnect = self.want_reconnect
+
+ return True
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=True)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ self.req_opts = self.get_download_options() # get the Post options for the Request
+ file_url = self.parent.url
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center\;\">(.*?)<\/h1>", self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def get_waiting_time(self):
+ if self.html == None:
+ self.download_html()
+ timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1)
+ if timestring:
+ sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off
+ else:
+ sec = 0
+ self.time_plus_wait = time() + sec
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"Sorry, this Download doesnt exist anymore", self.html) != None:
+ return False
+ else:
+ return True
+
+ def get_download_options(self):
+ re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.html).group(0) #get the whole request
+ to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
+ request_options = list()
+ for item in to_sort: #Name value pairs are output reversed from regex, so we reorder them
+ request_options.append((item[1], item[0]))
+ herewego = self.req.load(self.parent.url, None, request_options, cookies=True) # the actual download-Page
+ to_sort = None
+ to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
+ request_options = list()
+ for item in to_sort: #Same as above
+ request_options.append((item[1], item[0]))
+ return request_options
+
+ def proceed(self, url, location):
+ """
+ request.download doesn't handle the 302 redirect correctly
+ that's why the data are posted "manually" via httplib
+ and the redirect-url is read from the header.
+ Important: The cookies may not be posted to the download-url
+ otherwise the downloaded file only contains "bad try"
+ Need to come up with a better idea to handle the redirect,
+ help is appreciated.
+ """
+ temp_options = urllib.urlencode(self.req_opts)
+ temp_url = re.match(r"http://(.*?)/.*", url).group(1) # get the server name
+ temp_extended = re.match(r"http://.*?(/.*)", url).group(1) # get the url relative to serverroot
+ cookie_list = ""
+ for temp_cookie in self.req.cookies: #prepare cookies
+ cookie_list += temp_cookie.name + "=" + temp_cookie.value +";"
+ temp_headers = [ #create the additional header fields
+ ["Content-type", "application/x-www-form-urlencoded"], #this is very important
+ ["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", "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"],
+ ["Keep-Alive", "300"],
+ ["Referer", self.req.lastURL],
+ ["Cookie", cookie_list]]
+ temp_conn = httplib.HTTPConnection(temp_url)
+ temp_conn.request("POST", temp_extended, temp_options, dict(temp_headers))
+ temp_response = temp_conn.getresponse()
+ new_url = temp_response.getheader("Location") # we need the Location-header
+ temp_conn.close
+ self.req.download(new_url, location, None, None, cookies=False)
diff --git a/module/plugins/hoster/GigasizeCom.py b/module/plugins/hoster/GigasizeCom.py
new file mode 100644
index 000000000..e22fe8593
--- /dev/null
+++ b/module/plugins/hoster/GigasizeCom.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+
+from module.Plugin import Plugin
+
+class GigasizeCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "GigasizeCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"(?:http://)?(?:www.)?gigasize.com/get.php\?d="
+ props['version'] = "0.1"
+ props['description'] = """Gigasize.com 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.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)
+
+ 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)
+
+ 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 = '<form action="(/getcgi.php\?t=.*)" method="post" id="formDownload">'
+ search = re.search(file_url_pattern, self.html[1])
+ if search:
+ return "http://gigazise.com" + 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 = "<p><strong>Name</strong>: <b>(.*)</b></p>"
+ 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):
+ print url
+ print self.req.load(url, cookies=True)
diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py
new file mode 100644
index 000000000..a046cb6b1
--- /dev/null
+++ b/module/plugins/hoster/HotfileCom.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+from module.Plugin import Plugin
+
+class HotfileCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "HotfileCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://hotfile.com/dl/"
+ props['version'] = "0.1"
+ props['description'] = """Hotfile.com Download Plugin"""
+ props['author_name'] = ("sitacuisses","spoob","mkaay")
+ props['author_mail'] = ("sitacuisses@yhoo.de","spoob@pyload.org","mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+ self.htmlwithlink = None
+ self.url = None
+
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.want_reconnect = False
+
+ pyfile.status.exists = self.file_exists()
+
+ if not pyfile.status.exists:
+ raise Exception, "The file was not found on the server."
+ return False
+
+ pyfile.status.filename = self.get_file_name()
+
+ self.get_wait_time()
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.want_reconnect = self.want_reconnect
+
+ thread.wait(self.parent)
+
+ pyfile.status.url = self.get_file_url()
+
+ return True
+
+ def download_html(self):
+ self.url = self.parent.url
+ self.html = self.req.load(self.url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ self.get_download_page()
+ file_url = re.search("a href=\"(http://hotfile\.com/get/\S*?)\"", self.htmlwithlink).group(1)
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search('Downloading\s<b>(.*?)</b>', self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"Such file does not exist or it has been removed for infringement of copyrights.", self.html) != None:
+ return False
+ else:
+ return True
+
+ def get_wait_time(self):
+ free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);")
+ matches = free_limit_pattern.findall(self.html)
+ if matches:
+ for match in matches:
+ if int(match) == 60000:
+ continue
+ if int(match) == 0:
+ continue
+ else:
+ self.time_plus_wait = time() + int(match)/1000 + 65
+ self.want_reconnect = True
+ return True
+ self.time_plus_wait = time() + 65
+
+ def get_download_page(self):
+ herewego = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html).group(0)
+ all_the_tuples = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", herewego)
+
+ self.htmlwithlink = self.req.load(self.url, None, all_the_tuples)
+
+ def proceed(self, url, location):
+
+ self.req.download(url, location)
+
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py
new file mode 100644
index 000000000..3eb21a591
--- /dev/null
+++ b/module/plugins/hoster/MegauploadCom.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+
+from module.Plugin import Plugin
+
+class MegauploadCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "MegauploadCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)megaupload.com/"
+ props['version'] = "0.1"
+ props['description'] = """Megaupload.com Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.time_plus_wait = None #time() + wait in seconds
+
+ self.html = [None, None]
+ self.want_reconnect = False
+ self.init_ocr()
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name
+
+ for i in range(5):
+ self.html[0] = self.req.load(url, cookies=True)
+ url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1)
+ self.req.download(url_captcha_html, captcha_image, cookies=True)
+ captcha = self.ocr.get_captcha(captcha_image)
+ os.remove(captcha_image)
+ captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1)
+ megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1)
+ self.html[1] = self.req.load(url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}, cookies=True)
+ if re.search(r"Waiting time before each download begins", self.html[1]) != None:
+ break
+ self.time_plus_wait = time() + 45
+
+ 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 = 'id="downloadlink"><a href="(.*)" onclick="'
+ search = re.search(file_url_pattern, self.html[1])
+ return search.group(1).replace(" ", "%20")
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html[0] == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="'
+ return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-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"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \
+ re.search(r"Download limit exceeded", self.html[0]):
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location, cookies=True)
diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py
new file mode 100644
index 000000000..5e2eb0b39
--- /dev/null
+++ b/module/plugins/hoster/MyvideoDe.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+
+class MyvideoDe(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "MyvideoDe"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(www\.)?myvideo.de/watch/"
+ props['version'] = "0.1"
+ props['description'] = """Youtube.com Video Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.html_old = None #time() where loaded the HTML
+ self.time_plus_wait = None #time() + wait in seconds
+
+ def set_parent_status(self):
+ """ sets all available Statusinfos about a File in self.parent.status
+ """
+ if self.html == None:
+ self.download_html()
+ self.parent.status.filename = self.get_file_name()
+ self.parent.status.url = self.get_file_url()
+ self.parent.status.wait = self.wait_until()
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1)
+ videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1)
+ file_url = videoServer + videoId + ".flv"
+ print videoId
+ print videoServer
+ print file_url
+ return file_url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>"
+ return re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv'
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"(.* Das angeforderte Video ist nicht.*)", self.html) != None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
new file mode 100644
index 000000000..bc755fb58
--- /dev/null
+++ b/module/plugins/hoster/NetloadIn.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+from time import sleep
+import hashlib
+
+from module.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://.*netload\.in/"
+ props['version'] = "0.1"
+ props['description'] = """Netload.in Download Plugin"""
+ props['author_name'] = ("spoob", "RaNaN")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = [None, None, None]
+ self.want_reconnect = False
+ self.multi_dl = False
+ self.api_data = None
+ self.init_ocr()
+ self.read_config()
+ if self.config['premium']:
+ self.multi_dl = True
+ else:
+ self.multi_dl = False
+
+ def prepare(self, thread):
+ pyfile = self.parent
+ self.req.clear_cookies()
+
+ self.download_api_data()
+ if self.file_exists():
+ pyfile.status.filename = self.get_file_name()
+
+ if self.config['premium']:
+ self.req.load("http://netload.in/index.php", None, { "txtuser" : self.config['username'], "txtpass" : self.config['password'], "txtcheck" : "login", "txtlogin" : ""})
+ self.logger.info("Netload: Use Premium Account")
+ pyfile.status.url = self.parent.url
+ #@TODO: premium??
+ return True
+
+ self.download_html()
+ while not pyfile.status.url:
+ self.get_wait_time()
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.want_reconnect = self.want_reconnect
+ thread.wait(self.parent)
+
+ pyfile.status.url = self.get_file_url()
+
+ else:
+ raise Exception, "The file was not found on the server."
+
+ def download_api_data(self):
+ url = self.parent.url
+ id_regex = re.compile("http://netload.in/datei(.*?)(?:\.htm|/)")
+ match = id_regex.search(url)
+ if match:
+ apiurl = "http://netload.in/share/fileinfos2.php"
+ src = self.req.load(apiurl, cookies=False, get={"file_id": match.group(1)})
+ self.api_data = {}
+ if src != "unknown file_data":
+ lines = src.split(";")
+ self.api_data["exists"] = True
+ self.api_data["fileid"] = lines[0]
+ self.api_data["filename"] = lines[1]
+ self.api_data["size"] = lines[2] #@TODO formatting? (ex: '2.07 KB')
+ self.api_data["status"] = lines[3]
+ self.api_data["checksum"] = lines[4].replace("\n", "")
+ else:
+ self.api_data["exists"] = False
+
+ def download_html(self):
+ self.html[0] = self.req.load(self.parent.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;", "")
+ for i in range(6):
+ 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;", "")
+ 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
+ self.req.download(captcha_url, captcha_image, cookies=True)
+ captcha = self.ocr.get_captcha(captcha_image)
+ os.remove(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)
+
+ if re.search(r"(We will prepare your download..|We had a reqeust with the IP)", self.html[2]) != None:
+ break
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ try:
+ file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\" >Click here"
+ return re.search(file_url_pattern, self.html[2]).group(1)
+ except:
+ return None
+
+ def get_wait_time(self):
+ if re.search(r"We had a reqeust with the IP", self.html[2]):
+ self.time_plus_wait = time() + 10 * 30
+ return
+
+ wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", self.html[2]).group(1)) / 100
+ self.time_plus_wait = time() + wait_seconds
+
+ def get_file_name(self):
+ if self.api_data["filename"]:
+ return self.api_data["filename"]
+ elif self.html[0]:
+ file_name_pattern = '\t\t\t(.+)<span style="color: #8d8d8d;">'
+ file_name_search = re.search(file_name_pattern, self.html[0])
+ if file_name_search:
+ return file_name_search.group(1)
+ return self.parent.url
+
+ def file_exists(self):
+ if self.api_data["exists"]:
+ return self.api_data["exists"]
+ elif self.html[0] and re.search(r"The file has been deleted", self.html[0]) == None:
+ return True
+ return False
+
+ def proceed(self, url, location):
+ self.req.download(url, location, cookies=True)
+
+ 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, 5)
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py
new file mode 100644
index 000000000..973e28470
--- /dev/null
+++ b/module/plugins/hoster/RapidshareCom.py
@@ -0,0 +1,191 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+
+from module.Plugin import Plugin
+import hashlib
+
+class RapidshareCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "RapidshareCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://[\w\.]*?rapidshare.com/files/(\d*?)/(.*)"
+ props['version'] = "1.0"
+ props['description'] = """Rapidshare.com Download Plugin"""
+ props['author_name'] = ("spoob", "RaNaN", "mkaay")
+ props['author_mail'] = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.html = [None, None]
+ self.html_old = None #time() where loaded the HTML
+ self.time_plus_wait = None #time() + wait in seconds
+ self.want_reconnect = False
+ self.no_slots = True
+ self.api_data = None
+ self.url = self.parent.url
+ self.read_config()
+ if self.config['premium']:
+ self.multi_dl = True
+ else:
+ self.multi_dl = False
+
+ self.start_dl = False
+
+ def prepare(self, thread):
+ pyfile = self.parent
+ self.req.clear_cookies()
+
+ self.download_api_data()
+ if self.api_data["status"] == "1":
+ pyfile.status.filename = self.get_file_name()
+
+ if self.config["premium"]:
+ self.logger.info("Rapidshare: Use Premium Account (%sGB left)" % (self.props["premkbleft"]/1000000))
+ pyfile.status.url = self.parent.url
+ return True
+
+ self.download_html()
+ while self.no_slots:
+ self.get_wait_time()
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.want_reconnect = self.want_reconnect
+ thread.wait(pyfile)
+
+ pyfile.status.url = self.get_file_url()
+
+ return True
+ elif self.api_data["status"] == "2":
+ self.logger.info("Rapidshare: Traffic Share (direct download)")
+ pyfile.status.filename = self.get_file_name()
+ pyfile.status.url = self.parent.url
+ return True
+ else:
+ raise Exception, "The file was not found on the server."
+
+ def download_api_data(self):
+ """
+ http://images.rapidshare.com/apidoc.txt
+ """
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_file = {"sub": "checkfiles_v1", "files": "", "filenames": "", "incmd5": "1"}
+ m = re.compile(self.props['pattern']).search(self.url)
+ if m:
+ api_param_file["files"] = m.group(1)
+ api_param_file["filenames"] = m.group(2)
+ src = self.req.load(api_url_base, cookies=False, get=api_param_file)
+ if src.startswith("ERROR"):
+ return
+ fields = src.split(",")
+ self.api_data = {}
+ self.api_data["fileid"] = fields[0]
+ self.api_data["filename"] = fields[1]
+ self.api_data["size"] = fields[2] # in bytes
+ self.api_data["serverid"] = fields[3]
+ self.api_data["status"] = fields[4]
+ """
+ status codes:
+ 0=File not found
+ 1=File OK (Downloading possible without any logging)
+ 2=File OK (TrafficShare direct download without any logging)
+ 3=Server down
+ 4=File marked as illegal
+ 5=Anonymous file locked, because it has more than 10 downloads already
+ 6=File OK (TrafficShare direct download with enabled logging)
+ """
+ self.api_data["shorthost"] = fields[5]
+ self.api_data["checksum"] = fields[6].strip().lower() # md5
+
+ self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
+
+ if self.config["premium"]:
+ api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", \
+ "login": self.config['username'], "password": self.config['password']}
+ src = self.req.load(api_url_base, cookies=False, get=api_param_prem)
+ if src.startswith("ERROR"):
+ self.config["premium"] = False
+ self.logger.info("Rapidshare: Login faild")
+ return
+ fields = src.split("\n")
+ premkbleft = int(fields[19].split("=")[1])
+ if premkbleft < int(self.api_data["size"][0:-3]):
+ self.logger.info("Rapidshare: Not enough traffic left")
+ self.config["premium"] = False
+ else:
+ self.props["premkbleft"] = premkbleft
+
+ def download_html(self):
+ """ gets the url from self.parent.url saves html in self.html and parses
+ """
+ self.html[0] = self.req.load(self.url, cookies=True)
+ self.html_old = time()
+
+ def get_wait_time(self):
+ """downloads html with the important informations
+ """
+ file_server_url = re.search(r"<form action=\"(.*?)\"", self.html[0]).group(1)
+ self.html[1] = self.req.load(file_server_url, cookies=True, post={"dl.start": "Free"})
+
+ self.html_old = time()
+
+ if re.search(r"is already downloading", self.html[1]):
+ self.logger.info("Rapidshare: Already downloading, wait 30 minutes")
+ self.time_plus_wait = time() + 10 * 30
+ return
+ self.no_slots = False
+ try:
+ wait_minutes = re.search(r"Or try again in about (\d+) minute", self.html[1]).group(1)
+ self.time_plus_wait = time() + 60 * int(wait_minutes)
+ self.want_reconnect = True
+ except:
+ if re.search(r"(Currently a lot of users|There are no more download slots)", self.html[1], re.I) != None:
+ self.time_plus_wait = time() + 130
+ self.logger.info("Rapidshare: No free slots!")
+ self.no_slots = True
+ return True
+ self.no_slots = False
+ wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1)
+ self.time_plus_wait = time() + int(wait_seconds) + 5
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.config['server'] == "":
+ file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*"
+ else:
+ file_url_pattern = '(http://rs.*)\';" /> %s<br />' % self.config['server']
+
+ return re.search(file_url_pattern, self.html[1]).group(1)
+
+ def get_file_name(self):
+ if self.api_data["filename"]:
+ return self.api_data["filename"]
+ elif self.html[0]:
+ file_name_pattern = r"<p class=\"downloadlink\">.+/(.+) <font"
+ file_name_search = re.search(file_name_pattern, self.html[0])
+ if file_name_search:
+ return file_name_search.group(1)
+ return self.url.split("/")[-1]
+
+ def proceed(self, url, location):
+ if self.config['premium']:
+ self.req.add_auth(self.config['username'], self.config['password'])
+ self.req.download(url, location, cookies=True)
+
+ 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, 5)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
new file mode 100644
index 000000000..b9a9accef
--- /dev/null
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import re
+import tempfile
+from time import time
+from base64 import b64decode
+
+from module.Plugin import Plugin
+
+class ShareonlineBiz(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "ShareonlineBiz"
+ props['type'] = "hoster"
+ 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.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",
+ "location": "service.php",
+ "dieseid": "",
+ "user": self.config['username'],
+ "pass": self.config['password'],
+ "login":"Log+me+in",
+ "folder_autologin":"1"}
+ self.req.load("http://www.share-online.biz/login.php", cookies=True, post=post_vars)
+ url = self.parent.url
+ self.html[0] = self.req.load(url, cookies=True)
+
+ if not self.config['premium']:
+ captcha_image = tempfile.NamedTemporaryFile(suffix=".jpg").name
+
+ 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:
+ self.time_plus_wait = time() + 15
+ break
+
+ os.remove(captcha_image)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ 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 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, 5)
diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py
new file mode 100644
index 000000000..c0cc9de72
--- /dev/null
+++ b/module/plugins/hoster/ShragleCom.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from module.Plugin import Plugin
+
+class ShragleCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "ShragleCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?shragle.com/files/"
+ props['version'] = "0.1"
+ props['description'] = """Shragle Download PLugin"""
+ props['author_name'] = ("RaNaN")
+ props['author_mail'] = ("RaNaN@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.multi_dl = False
+
+ def set_parent_status(self):
+ """ sets all available Statusinfos about a File in self.parent.status
+ """
+ if self.html == None:
+ self.download_html()
+ self.parent.status.filename = self.get_file_name()
+ self.parent.status.url = self.get_file_url()
+ self.parent.status.wait = self.wait_until()
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+ self.time_plus_wait = time.time() + 10
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+
+ self.fileID = re.search(r"name=\"fileID\" value=\"([^\"]+)", self.html).group(1)
+ self.dlSession = re.search(r"name=\"dlSession\" value=\"([^\"]+)", self.html).group(1)
+ self.userID = ""
+ self.password = ""
+ self.lang = "de"
+ return "http://srv4.shragle.com/download.php"
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+
+ file_name_pattern = r"<\/div><h2>(.+)<\/h2"
+ return re.search(file_name_pattern, self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+
+ if re.search(r"html", self.html) == None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location, {'fileID': self.fileID, 'dlSession': self.dlSession, 'userID': self.userID, 'password': self.password, 'lang': self.lang})
diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py
new file mode 100644
index 000000000..dbff844ad
--- /dev/null
+++ b/module/plugins/hoster/StorageTo.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+
+from module.Plugin import Plugin
+
+class StorageTo(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "StorageTo"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www)?\.storage\.to/get/.*"
+ props['version'] = "0.1"
+ props['description'] = """Storage.to Download Plugin"""
+ props['author_name'] = ("mkaay")
+ props['author_mail'] = ("mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.time_plus_wait = None
+ self.want_reconnect = False
+ self.api_data = None
+ self.html = None
+ self.read_config()
+ self.multi_dl = False
+
+ self.start_dl = False
+
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.req.clear_cookies()
+
+ self.want_reconnect = False
+
+ pyfile.status.exists = self.file_exists()
+
+ if not pyfile.status.exists:
+ raise Exception, "The file was not found on the server."
+ return False
+
+ pyfile.status.filename = self.get_file_name()
+
+ self.get_wait_time()
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.want_reconnect = self.want_reconnect
+
+ thread.wait(self.parent)
+
+ pyfile.status.url = self.get_file_url()
+
+ return True
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=True)
+
+ def download_api_data(self):
+ url = self.parent.url
+ info_url = url.replace("/get/", "/getlink/")
+ src = self.req.load(info_url, cookies=True)
+ pattern = re.compile(r"'(\w+)' : (.*?)[,|\}]")
+ self.api_data = {}
+ for pair in pattern.findall(src):
+ self.api_data[pair[0]] = pair[1].strip("'")
+ print self.api_data
+
+ def get_wait_time(self):
+ if not self.api_data:
+ self.download_api_data()
+ if self.api_data["state"] == "wait":
+ self.want_reconnect = True
+ self.time_plus_wait = time() + int(self.api_data["countdown"])
+
+
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if not self.api_data:
+ self.download_api_data()
+ if self.api_data["state"] == "failed":
+ return False
+ else:
+ return True
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if not self.api_data:
+ self.download_api_data()
+ return self.api_data["link"]
+
+ def get_file_name(self):
+ if not self.html:
+ self.download_html()
+ file_name_pattern = r"<span class=\"orange\">Downloading:</span>(.*?)<span class=\"light\">(.*?)</span>"
+ return re.search(file_name_pattern, self.html).group(1)
+
+ def proceed(self, url, location):
+ self.req.download(url, location, cookies=True)
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
new file mode 100644
index 000000000..bb623b4e6
--- /dev/null
+++ b/module/plugins/hoster/UploadedTo.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+from module.Plugin import Plugin
+import hashlib
+
+class UploadedTo(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "UploadedTo"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www\.)?u(?:p)?l(?:oaded)?\.to/(?:file/)?(.*)"
+ props['version'] = "0.3"
+ props['description'] = """Uploaded.to Download Plugin"""
+ props['author_name'] = ("spoob", "mkaay")
+ props['author_mail'] = ("spoob@pyload.org", "mkaay@mkaay.de")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.time_plus_wait = None #time() + wait in seconds
+ self.api_data = None
+ self.want_reconnect = False
+ self.read_config()
+ if self.config['premium']:
+ self.multi_dl = True
+ else:
+ self.multi_dl = False
+
+ self.start_dl = False
+
+ def prepare(self, thread):
+ pyfile = self.parent
+
+ self.want_reconnect = False
+ tries = 0
+
+ while not pyfile.status.url:
+ self.req.clear_cookies()
+ self.download_html()
+
+ pyfile.status.exists = self.file_exists()
+
+ if not pyfile.status.exists:
+ raise Exception, "The file was not found on the server."
+
+ self.download_api_data()
+
+ pyfile.status.filename = self.get_file_name()
+
+ if self.config['premium']:
+ pyfile.status.url = self.parent.url
+ return True
+
+ self.get_waiting_time()
+
+ pyfile.status.waituntil = self.time_plus_wait
+ pyfile.status.url = self.get_file_url()
+ pyfile.status.want_reconnect = self.want_reconnect
+
+ thread.wait(self.parent)
+
+ pyfile.status.filename = self.get_file_name()
+
+ tries += 1
+ if tries > 5:
+ raise Exception, "Error while preparing DL"
+ return True
+
+ def download_api_data(self):
+ url = self.parent.url
+ match = re.compile(self.props['pattern']).search(url)
+ if match:
+ src = self.req.load("http://uploaded.to/api/file", cookies=False, get={"id": match.group(1).split("/")[0]})
+ if not src.find("404 Not Found"):
+ return
+ self.api_data = {}
+ lines = src.splitlines()
+ self.api_data["filename"] = lines[0]
+ self.api_data["size"] = lines[1] # in kbytes
+ self.api_data["checksum"] = lines[2] #sha1
+
+ def download_html(self):
+ if self.config['premium']:
+ self.config['username'], self.config['password']
+ self.req.load("http://uploaded.to/login", None, { "email" : self.config['username'], "password" : self.config['password']})
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=False)
+
+ def get_waiting_time(self):
+ try:
+ wait_minutes = re.search(r"Or wait ([\d\-]+) minutes", self.html).group(1)
+ if int(wait_minutes) < 0: wait_minutes = 1
+ self.time_plus_wait = time() + 60 * int(wait_minutes)
+ self.want_reconnect = True
+ except:
+ self.time_plus_wait = 0
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.config['premium']:
+ self.start_dl = True
+ return self.parent.url
+ try:
+ file_url_pattern = r".*<form name=\"download_form\" method=\"post\" action=\"(.*)\">"
+ return re.search(file_url_pattern, self.html).group(1)
+ except:
+ return None
+
+ def get_file_name(self):
+ try:
+ if self.api_data and self.api_data["filename"]:
+ return self.api_data["filename"]
+ file_name = re.search(r"<td><b>\s+(.+)\s", self.html).group(1)
+ file_suffix = re.search(r"</td><td>(\..+)</td></tr>", self.html)
+ if not file_suffix:
+ return file_name
+ return file_name + file_suffix.group(1)
+ except:
+ return self.parent.url
+
+ def file_exists(self):
+ if re.search(r"(File doesn't exist .*)", self.html) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ if self.config['premium']:
+ self.req.download(url, location, cookies=True)
+ else:
+ self.req.download(url, location, cookies=False, post={"download_submit": "Free Download"})
+
+ def check_file(self, local_file):
+ if self.api_data and self.api_data["checksum"]:
+ h = hashlib.sha1()
+ 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, 5)
diff --git a/module/plugins/hoster/XupIn.py b/module/plugins/hoster/XupIn.py
new file mode 100644
index 000000000..d044f2389
--- /dev/null
+++ b/module/plugins/hoster/XupIn.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+
+class XupIn(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "XupIn"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?xup.in/"
+ props['version'] = "0.1"
+ props['description'] = """Xup.in Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.html_old = None #time() where loaded the HTML
+ self.time_plus_wait = None #time() + wait in seconds
+ self.posts = {}
+ self.want_reconnect = None
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+ self.posts["vid"] = re.search('"hidden" value="(.*)" name="vid"', self.html).group(1)
+ self.posts["vtime"] = re.search('"hidden" value="(.*)" name="vtime"', self.html).group(1)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_url_pattern = r".*<form action=\"(.*)\" method=\"post\">"
+ return re.search(file_url_pattern, self.html).group(1)
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ return self.parent.url.split('/')[-2]
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"(.*<font color=\"#ff0000\">File does not exist</font>.*)", self.html, re.I) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+ self.req.download(url, location, self.posts)
+
+ def wait_until(self):
+ if self.html == None:
+ self.download_html()
+ return self.time_plus_wait
diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py
new file mode 100644
index 000000000..e501954da
--- /dev/null
+++ b/module/plugins/hoster/YoupornCom.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+
+class YoupornCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "YoupornCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(www\.)?youporn\.com/watch/.+"
+ props['version'] = "0.1"
+ props['description'] = """Youporn.com Video Download Plugin"""
+ props['author_name'] = ("willnix")
+ props['author_mail'] = ("willnix@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.html_old = None #time() where loaded the HTML
+ self.time_plus_wait = None #time() + wait in seconds
+
+ def set_parent_status(self):
+ """ sets all available Statusinfos about a File in self.parent.status
+ """
+ if self.html == None:
+ self.download_html()
+ self.parent.status.filename = self.get_file_name()
+ self.parent.status.url = self.get_file_url()
+ self.parent.status.wait = self.wait_until()
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+
+ file_url = re.search(r'(http://download.youporn.com/download/\d*/.*\?download=1&ll=1&t=dd)">', self.html).group(1)
+ print file_url
+ return file_url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ file_name_pattern = r".*<title>(.*) - Free Porn Videos - YouPorn.com Lite \(BETA\)</title>.*"
+ return re.search(file_name_pattern, self.html).group(1) + '.flv'
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"(.*invalid video_id.*)", self.html) != None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
new file mode 100644
index 000000000..38a4934df
--- /dev/null
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+
+class YoutubeCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "YoutubeCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*"
+ props['version'] = "0.2"
+ props['description'] = """Youtube.com Video Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.read_config()
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html == None:
+ self.download_html()
+
+ videoId = self.parent.url.split("v=")[1].split("&")[0]
+ videoHash = re.search(r', "t": "([^"]+)"', self.html).group(1)
+ quality = ""
+ if self.config['high_quality']:
+ quality = "&fmt=18"
+ file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality
+ return file_url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+
+ file_name_pattern = r"'VIDEO_TITLE': '(.*)',"
+ file_suffix = ".flv"
+ if self.config['high_quality']:
+ file_suffix = ".mp4"
+ name = re.search(file_name_pattern, self.html).group(1).replace("/", "") + file_suffix
+
+ name = name.replace("&amp;", "&")
+ return name
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"(.*eine fehlerhafte Video-ID\.)", self.html) != None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
new file mode 100644
index 000000000..bec7f8c65
--- /dev/null
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.Plugin import Plugin
+
+class ZippyshareCom(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "ZippyshareCom"
+ props['type'] = "hoster"
+ props['pattern'] = r"(http://)?www?\d{0,2}\.zippyshare.com/v/"
+ props['version'] = "0.1"
+ props['description'] = """Zippyshare.com Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = None
+ self.want_reconnect = False
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=True)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ file_url_pattern = r"var \w* = '(http%.*?)';"
+ file_url_search = re.search(file_url_pattern, self.html).group(1)
+ file_url = urllib.unquote(file_url_search.replace("nnn", "aaa").replace("unlg", "v").replace("serwus", "zippyshare"))
+ return file_url
+
+ def get_file_name(self):
+ if self.html == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search("<strong>Name: </strong>(.*)</font><br />", self.html).group(1)
+ return file_name
+ else:
+ return self.parent.url
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html == None:
+ self.download_html()
+ if re.search(r"HTTP Status 404", self.html) != None:
+ return False
+ else:
+ return True
+
+ def proceed(self, url, location):
+
+ self.req.download(url, location, cookies=True)
diff --git a/module/plugins/hoster/ZshareNet.py b/module/plugins/hoster/ZshareNet.py
new file mode 100644
index 000000000..08f28a35c
--- /dev/null
+++ b/module/plugins/hoster/ZshareNet.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.Plugin import Plugin
+
+class ZshareNet(Plugin):
+
+ def __init__(self, parent):
+ Plugin.__init__(self, parent)
+ props = {}
+ props['name'] = "ZshareNet"
+ props['type'] = "hoster"
+ props['pattern'] = r"http://(?:www.)?zshare.net/"
+ props['version'] = "0.1"
+ props['description'] = """Zshare.net Download Plugin"""
+ props['author_name'] = ("spoob")
+ props['author_mail'] = ("spoob@pyload.org")
+ self.props = props
+ self.parent = parent
+ self.html = [None, None]
+ self.html_old = None #time() where loaded the HTML
+ self.time_plus_wait = None #time() + wait in seconds
+ self.posts = {}
+ self.want_reconnect = False
+ self.multi_dl = False
+
+ def download_html(self):
+ url = self.parent.url
+ self.html[0] = self.req.load(url)
+ if "/video/" in url:
+ url = url.replace("/video/", "/download/")
+ elif "/audio/" in url:
+ url = url.replace("/audio/", "/download/")
+ elif "/image/" in url:
+ url = url.replace("/image/", "/download/")
+ self.html[1] = self.req.load(url, None, {"download": "1"})
+
+ 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 = "".join(eval(re.search("var link_enc=new Array(.*);link", self.html[1]).group(1)))
+ return file_url
+ else:
+ return False
+
+ def get_file_name(self):
+ if self.html[0] == None:
+ self.download_html()
+ if not self.want_reconnect:
+ file_name = re.search("<font color=\"#666666\">(.*)</font></td>", self.html[0]).group(1)
+ return file_name
+ 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"File Not Found", self.html[0]) != None:
+ return False
+ else:
+ return True
+
+ def wait_until(self):
+ if self.html[0] == None:
+ self.download_html()
+ return self.time_plus_wait
diff --git a/module/plugins/hoster/__init__.py b/module/plugins/hoster/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/module/plugins/hoster/__init__.py