diff options
Diffstat (limited to 'module')
29 files changed, 1800 insertions, 1 deletions
| diff --git a/module/network/Request.py b/module/network/Request.py index b2bac2d7b..084c84f95 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -244,7 +244,6 @@ class Request:              if "..." in file_name:                  download_folder = dirname(file_name) + sep                  headers = self.get_header() -                print headers                  file_name_search = re.search('filename=(?P<quote>\")?(.+)(?(quote)\")', headers)                  if file_name_search:                      file_name = file_name_search.group(2) diff --git a/module/plugins/BluehostTo.py b/module/plugins/BluehostTo.py new file mode 100644 index 000000000..1ecd47122 --- /dev/null +++ b/module/plugins/BluehostTo.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import time + +from 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/CCF.py b/module/plugins/CCF.py new file mode 100644 index 000000000..d7792dce4 --- /dev/null +++ b/module/plugins/CCF.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os.path +import random +import re +import tempfile +import urllib2 + +from Plugin import Plugin +from module.network.MultipartPostHandler import MultipartPostHandler + +class CCF(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "CCF" +        props['type'] = "container" +        props['pattern'] = r".*\.ccf" +        props['version'] = "0.1" +        props['description'] = """CCF Container Convert Plugin""" +        props['author_name'] = ("Willnix") +        props['author_mail'] = ("Willnix@pyload.org") +        self.props = props +        self.parent = parent +        self.multi_dl = True +        self.links = [] + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        infile = url.replace("\n", "") + +        opener = urllib2.build_opener(MultipartPostHandler) +        params = {"src": "ccf", +            "filename": "test.ccf", +            "upload": open(infile, "rb")} +        tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() + +        random.seed() +        tempdir = tempfile.gettempdir() +        if tempdir[0] == '/': +            delim = '/' +        else: +            delim = '\\' +        tempdlc_name = tempdir + delim + str(random.randint(0, 100)) + '-tmp.dlc' +        while os.path.exists(tempdlc_name): +            tempdlc_name = tempfile.gettempdir() + '/' + str(random.randint(0, 100)) + '-tmp.dlc' + +        tempdlc = open(tempdlc_name, "w") +        tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) +        tempdlc.close + +        self.links.append(tempdlc_name) + +        return True
\ No newline at end of file diff --git a/module/plugins/DLC.pyc b/module/plugins/DLC.pycBinary files differ new file mode 100644 index 000000000..5d4809178 --- /dev/null +++ b/module/plugins/DLC.pyc diff --git a/module/plugins/DepositfilesCom.py b/module/plugins/DepositfilesCom.py new file mode 100644 index 000000000..b2f6db29c --- /dev/null +++ b/module/plugins/DepositfilesCom.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib +from 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/FourChan.py b/module/plugins/FourChan.py new file mode 100644 index 000000000..840274457 --- /dev/null +++ b/module/plugins/FourChan.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class FourChan(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "FourChan" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?(img\.)?(zip\.)?4chan.org/\w+/(res/|imgboard\.html)" +        props['version'] = "0.1" +        props['description'] = """4chan.org Thread Download Plugin""" +        props['author_name'] = ("Spoob") +        props['author_mail'] = ("Spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        html = self.req.load(url) +        link_pattern = "" +        temp_links = [] +        if "imagebord.html" in url: +            link_pattern = '[<a href="(res/\d*\.html)">Reply</a>]' +            temp_links = re.findall(link_pattern, html) +            for link in re.findall(link_pattern, html): +                temp_links.append(link) +        else: +            temp_links = re.findall('File : <a href="(http://(?:img\.)?(?:zip\.)?4chan\.org/\w{,3}/src/\d*\..{3})"', html) +        self.links = temp_links diff --git a/module/plugins/GigasizeCom.py b/module/plugins/GigasizeCom.py new file mode 100644 index 000000000..e9404263c --- /dev/null +++ b/module/plugins/GigasizeCom.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import re +import tempfile +from time import time + +from 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/HoerbuchIn.py b/module/plugins/HoerbuchIn.py new file mode 100644 index 000000000..02d3a79e7 --- /dev/null +++ b/module/plugins/HoerbuchIn.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class HoerbuchIn(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "HoerbuchIn" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?hoerbuch\.in/blog\.php\?id=" +        props['version'] = "0.3" +        props['description'] = """Hoerbuch.in Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def download_html(self): +        url = self.parent.url +        self.html = self.req.load(url) + +    def file_exists(self): +        """ returns True or False +        """ +        self.download_html() +        if re.search(r"Download", self.html) != None: +            return True +        return False + +    def proceed(self, url, location): +        temp_links = [] +        download_container = ("Download", "Mirror #1", "Mirror #2", "Mirror #3") +        for container in download_container: +            download_content = re.search("<BR><B>" + container + ":</B>(.*?)<BR><B>", self.html).group(1) +            tmp = re.findall('<A HREF="http://www.hoerbuch.in/cj/out.php\?pct=\d+&url=(http://rs\.hoerbuch\.in/.+?)" TARGET="_blank">Part \d+</A>', download_content) +            if tmp == []: continue +            for link in tmp: +                link_html = self.req.load(link, cookies=True) +                temp_links.append(re.search('<FORM ACTION="(http://.*?)" METHOD="post"', link_html).group(1)) +            break + +        self.links = temp_links diff --git a/module/plugins/LixIn.py b/module/plugins/LixIn.py new file mode 100644 index 000000000..ee7d99a62 --- /dev/null +++ b/module/plugins/LixIn.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class LixIn(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "LixIn" +        props['type'] = "container" +        props['pattern'] = r"http://(www.)?lix.in/" +        props['version'] = "0.1" +        props['description'] = """Lix.in Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        new_link = "" +        if not re.search("captcha_img.php", self.html): +            new_link = re.search(r".*<iframe  name=\"ifram\" src=\"(.*)\" marginwidth=\"0\".*", self.req.load(url, post={"submit" : "continue"})).group(1) + +        self.links = [new_link] diff --git a/module/plugins/MegauploadCom.py b/module/plugins/MegauploadCom.py new file mode 100644 index 000000000..bcafec83f --- /dev/null +++ b/module/plugins/MegauploadCom.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import re +import tempfile + +from 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.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) +            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 + +        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 = 'id="downloadlink"><a href="(.*)" onclick="' +            search = re.search(file_url_pattern, self.html[1]) +            return search.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 = '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 diff --git a/module/plugins/MyvideoDe.py b/module/plugins/MyvideoDe.py new file mode 100644 index 000000000..3f7ce915b --- /dev/null +++ b/module/plugins/MyvideoDe.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from 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/NetloadIn.py b/module/plugins/NetloadIn.py new file mode 100644 index 000000000..789c84a2d --- /dev/null +++ b/module/plugins/NetloadIn.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import re +import tempfile +from time import time +from time import sleep + +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://.*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.init_ocr() + +    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." + +            pyfile.status.filename = self.get_file_name() + +            self.download_html2() + +            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() + +            tries += 1 +            if tries > 3: +                raise Exception, "Error while preparing DL, HTML dump: %s %s" % (self.html[0], self.html[1]) + +        return True + + +    def download_html(self): +        url = self.parent.url +        self.html[0] = self.req.load(url, cookies=True) + +    def download_html2(self): +         +        url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&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&.*&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) +            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" + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        try: +            file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\" >Click here" +            search = re.search(file_url_pattern, self.html[2]) +            return search.group(1) +        except: +            return None + +    def get_wait_time(self): +        wait = int(re.search(r"countdown\((.+),'change\(\)'\)", self.html[2]).group(1)) +        self.time_plus_wait = time() + wait / 100 + +        if re.search(r"We had a reqeust with the IP", self.html[2]): +            self.want_reconnect = True +         +    def get_file_name(self): +        try: +            file_name_pattern = '\t\t\t(.+)<span style="color: #8d8d8d;">' +            return re.search(file_name_pattern, self.html[0]).group(1) +        except: +            return self.parent.url + +    def file_exists(self): +        """ returns True or False +        """ +        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/plugins/OneKhDe.py b/module/plugins/OneKhDe.py new file mode 100644 index 000000000..15c3a6872 --- /dev/null +++ b/module/plugins/OneKhDe.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.unescape import unescape +from Plugin import Plugin + +class OneKhDe(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "OneKhDe" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?1kh.de/f/" +        props['version'] = "0.1" +        props['description'] = """1kh.de Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        temp_links = [] +        link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html) +        for id in link_ids: +            new_link = unescape(re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.req.load("http://1kh.de/l/" + id)).group(1)) +            temp_links.append(new_link) +        self.links = temp_links diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py new file mode 100644 index 000000000..5b3c7ee8c --- /dev/null +++ b/module/plugins/Plugin.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +#Copyright (C) 2009 kingzero, RaNaN +# +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3 of the License, +#or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#See the GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +### +import ConfigParser +import logging +import re + +from module.network.Request import Request + +class Plugin(): + +    def __init__(self, parent): +        self.parser = ConfigParser.SafeConfigParser() +        self.config = {} +        props = {} +        props['name'] = "BasePlugin" +        props['version'] = "0.1" +        props['pattern'] = None +        props['type'] = "hoster" +        props['description'] = """Base Plugin""" +        props['author_name'] = ("RaNaN", "spoob") +        props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.req = Request() +        self.html = 0 +        self.time_plus_wait = 0 #time() + wait in seconds +        self.want_reconnect = False +        self.multi_dl = True +        self.ocr = None #captcha reader instance +        self.logger = logging.getLogger("log") +     +    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() +             +        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 set_parent_status(self): +        """ sets all available Statusinfos about a File in self.parent.status +        """ +        pass + +    def download_html(self): +        """ gets the url from self.parent.url saves html in self.html and parses +        """ +        html = "" +        self.html = html + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        return self.parent.url + +    def get_file_name(self): +        return re.findall("([^\/=]+)", self.parent.url)[-1] + +    def wait_until(self): +        if self.html != None: +            self.download_html() +        return self.time_plus_wait + +    def proceed(self, url, location): +        self.req.download(url, location) + +    def set_config(self): +        pass + +    def get_config(self, value): +        self.parser.read("pluginconfig") +        return self.parser.get(self.props['name'], value) + +    def read_config(self): +        self.parser.read("pluginconfig") + +        if self.parser.has_section(self.props['name']): +            for option in self.parser.options(self.props['name']): +                self.config[option] = self.parser.get(self.props['name'], option, raw=True) +                self.config[option] = False if self.config[option].lower() == 'false' else self.config[option] + +    def init_ocr(self): +        modul = __import__("module.captcha." + self.props['name'], fromlist=['captcha']) +        captchaClass = getattr(modul, self.props['name']) +        self.ocr = captchaClass() + +    def __call__(self): +        return self.props['name'] diff --git a/module/plugins/RSDF.py b/module/plugins/RSDF.py new file mode 100644 index 000000000..c2406d6e0 --- /dev/null +++ b/module/plugins/RSDF.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import base64 +import binascii + +from Plugin import Plugin + +class RSDF(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "RSDF" +        props['type'] = "container" +        props['pattern'] = r".*\.rsdf" +        props['version'] = "0.2" +        props['description'] = """RSDF Container Decode Plugin""" +        props['author_name'] = ("RaNaN", "spoob") +        props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.multi_dl = True +        self.links = [] + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        try: +            from Crypto.Cipher import AES + +            infile = url.replace("\n", "") +            Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') + +            IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') +            IV_Cipher = AES.new(Key, AES.MODE_ECB) +            IV = IV_Cipher.encrypt(IV) + +            obj = AES.new(Key, AES.MODE_CFB, IV) + +            rsdf = open(infile, 'r') + +            data = rsdf.read() +            data = binascii.unhexlify(''.join(data.split())) +            data = data.splitlines() + +            for link in data: +                link = base64.b64decode(link) +                link = obj.decrypt(link) +                decryptedUrl = link.replace('CCF: ', '') +                self.links.append(decryptedUrl) + +            rsdf.close() + +        except: +            print "Kein Crypto installiert, RSDF Plugin kann nicht genutzt werden" diff --git a/module/plugins/RSLayerCom.py b/module/plugins/RSLayerCom.py new file mode 100644 index 000000000..e470c1748 --- /dev/null +++ b/module/plugins/RSLayerCom.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.unescape import unescape +from Plugin import Plugin + +class RSLayerCom(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "RSLayerCom" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?rs-layer.com/directory-" +        props['version'] = "0.1" +        props['description'] = """RS-Layer.com Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        temp_links = []   +        link_ids = re.findall(r"onclick=\"getFile\(\'([0-9]{7}-.{8})\'\);changeBackgroundColor", self.html) +        for id in link_ids: +            new_link = unescape(re.search(r"name=\"file\" src=\"(.*)\"></frame>", self.req.load("http://rs-layer.com/link-" + id + ".html")).group(1)) +            print new_link +            temp_links.append(new_link) +        self.links = temp_links diff --git a/module/plugins/RapidshareCom.py b/module/plugins/RapidshareCom.py new file mode 100644 index 000000000..56a38fb9d --- /dev/null +++ b/module/plugins/RapidshareCom.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time + +from Plugin import Plugin + +class RapidshareCom(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "RapidshareCom" +        props['type'] = "hoster" +        props['pattern'] = r"http://(?:www.)?(rs\d*.)?rapidshare.com/files/" +        props['version'] = "0.4" +        props['description'] = """Rapidshare.com Download Plugin""" +        props['author_name'] = ("spoob", "RaNaN") +        props['author_mail'] = ("spoob@pyload.org", "ranan@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.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 self.start_dl or 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." +             +            pyfile.status.filename = self.get_file_name() +             +            if self.config['premium']: +                pyfile.status.url = self.parent.url +                return True + +            self.download_serverhtml() +            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() + +            tries += 1 +            if tries > 5: +                raise Exception, "Error while preparing, HTML dump:"+ str(self.html[0]) + str(self.html[1]) + +        return True + +    def download_html(self): +        """ gets the url from self.parent.url saves html in self.html and parses +        """ +        url = self.parent.url +        self.html[0] = self.req.load(url) +        self.html_old = time() + +        self.download_serverhtml() + +    def download_serverhtml(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, None, {"dl.start": "Free"}) +        self.html_old = time() +        self.get_wait_time() + +    def get_wait_time(self): + +        if re.search(r".*is already downloading.*", self.html[1]) != None: +            self.time_plus_wait = time() + 10 * 60 +        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.*", self.html[1]) != None: +                self.time_plus_wait = time() + 130 +                return True +            wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1) +            self.time_plus_wait = time() + int(wait_seconds) + 5 + +    def file_exists(self): +        """ returns True or False +        """ +        if re.search(r"The File could not be found", self.html[0]) != None or \ +            re.search(r"(<p>This limit is reached.</p>)", self.html[0]) or \ +            re.search(r"(is momentarily not available)", self.html[0]) or \ +            re.search(r"(The uploader has removed this file from the server)", self.html[0]) or \ +            re.search(r"(This file is suspected to contain illegal content)", self.html[0]): +            return False +        else: +            return True + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.config['premium']: +            self.start_dl = True +            return self.parent.url + +        #if (self.html_old + 5 * 60) < time(): # nach einiger zeit ist die file_url nicht mehr aktuell +        #   self.download_serverhtml() + + +        try: +            if self.config['server'] == "": +                file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*" +            else: +                file_url_pattern = '(http://rs.*)\';" /> %s<br />' % self.config['server'] + +            self.start_dl = True +            return re.search(file_url_pattern, self.html[1]).group(1) +        except Exception, e: +            self.start_dl = False +            return False +            #print self.html[1] #test print +            #raise Exception, "Error when retrieving download url" + +    def get_file_name(self): +             +        file_name_pattern = r"<p class=\"downloadlink\">.+/(.+) <font" +        return re.findall(file_name_pattern, self.html[0])[0] + +    def proceed(self, url, location): + +        if self.config['premium']: +            self.req.add_auth(self.config['username'], self.config['password']) + +        self.req.download(url, location) diff --git a/module/plugins/RelinkUs.py b/module/plugins/RelinkUs.py new file mode 100644 index 000000000..31f592759 --- /dev/null +++ b/module/plugins/RelinkUs.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class RelinkUs(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "RelinkUs" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?relink.us/go.php" +        props['version'] = "0.1" +        props['description'] = """Relink.us Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        container_id = url.split("id=")[-1] +        temp_links = [] +        link_number = len(re.findall(r"test_\d+", self.html)) +        for number in range(0, link_number): +            new_link = re.search("src='(.*)'></iframe>", self.req.load("http://relink.us/f/%s/1/%i" % (container_id, number))).group(1) +            temp_links.append(new_link) +            print temp_links +        self.links = temp_links diff --git a/module/plugins/ShareonlineBiz.py b/module/plugins/ShareonlineBiz.py new file mode 100644 index 000000000..d42ef9302 --- /dev/null +++ b/module/plugins/ShareonlineBiz.py @@ -0,0 +1,75 @@ +#!/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" +        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 diff --git a/module/plugins/ShragleCom.py b/module/plugins/ShragleCom.py new file mode 100644 index 000000000..bcf650d69 --- /dev/null +++ b/module/plugins/ShragleCom.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import time + +from 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})
\ No newline at end of file diff --git a/module/plugins/StealthTo.py b/module/plugins/StealthTo.py new file mode 100644 index 000000000..c904a07c3 --- /dev/null +++ b/module/plugins/StealthTo.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class StealthTo(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "StealthTo" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?stealth.to/folder/" +        props['version'] = "0.1" +        props['description'] = """Stealth.to Container Plugin""" +        props['author_name'] = ("spoob") +        props['author_mail'] = ("spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url, cookies=True) +        temp_links = [] +        ids = [] +        ats = [] # authenticity_token +        inputs = re.findall(r"(<(input|form)[^>]+)", self.html) +        for input in inputs: +            if re.search(r"name=\"authenticity_token\"",input[0]): +                ats.append(re.search(r"value=\"([^\"]+)", input[0]).group(1)) +            if re.search(r"name=\"id\"",input[0]): +                ids.append(re.search(r"value=\"([^\"]+)", input[0]).group(1)) +                 +        for i in range(0, len(ids)): +            self.req.load(url + "/web", post={"authenticity_token": ats[i], "id": str(ids[i]), "link": ("download_" + str(ids[i]))}, cookies=True) +            new_html = self.req.load(url + "/web", post={"authenticity_token": ats[i], "id": str(ids[i]), "link": "1"}, cookies=True) +            temp_links.append(re.search(r"iframe src=\"(.*)\" frameborder", new_html).group(1)) + +        self.links = temp_links diff --git a/module/plugins/UploadedTo.py b/module/plugins/UploadedTo.py new file mode 100644 index 000000000..e65be789c --- /dev/null +++ b/module/plugins/UploadedTo.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time +from Plugin import Plugin + +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/" +        props['version'] = "0.1" +        props['description'] = """Uploaded.to 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.want_reconnect = None +        self.multi_dl = False + +    def prepare(self, thread): +        pyfile = self.parent + +        self.want_reconnect = False +        tries = 0 + +        while not pyfile.status.url: + +            self.download_html() + +            pyfile.status.exists = self.file_exists() + +            if not pyfile.status.exists: +                raise Exception, "The file was not found on the server." + +            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) + +            pyfile.status.filename = self.get_file_name() + +            tries += 1 +            if tries > 5: +                raise Exception, "Error while preparing DL, HTML dump: %s" % self.html + +        return True + +    def download_html(self): +        url = self.parent.url +        self.html = self.req.load(url) + +        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 +        """ +        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: +            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: +            self.parent.status.url = None +            return self.parent.url + +    def file_exists(self): +        """ returns True or False +        """ +        if re.search(r"(File doesn't exist .*)", self.html) != None: +            return False +        else: +            return True diff --git a/module/plugins/XupIn.py b/module/plugins/XupIn.py new file mode 100644 index 000000000..6b1f3be73 --- /dev/null +++ b/module/plugins/XupIn.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from 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/YoupornCom.py b/module/plugins/YoupornCom.py new file mode 100644 index 000000000..fb0f4131d --- /dev/null +++ b/module/plugins/YoupornCom.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from 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
\ No newline at end of file diff --git a/module/plugins/YoutubeChannel.py b/module/plugins/YoutubeChannel.py new file mode 100644 index 000000000..4958d1db5 --- /dev/null +++ b/module/plugins/YoutubeChannel.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from Plugin import Plugin + +class YoutubeChannel(Plugin): + +    def __init__(self, parent): +        Plugin.__init__(self, parent) +        props = {} +        props['name'] = "YoutubeChannel" +        props['type'] = "container" +        props['pattern'] = r"http://(www\.)?(de\.)?\youtube\.com/user/*" +        props['version'] = "0.3" +        props['description'] = """Youtube.com Channel Download Plugin""" +        props['author_name'] = ("RaNaN", "Spoob") +        props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org") +        self.props = props +        self.parent = parent +        self.html = None +        self.read_config() + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        self.user = re.search(r"/user/(.+)", self.parent.url).group(1) +        max_videos = self.config['max_videos'] +        if not max_videos: +            max_videos = 1000 #max video a user can upload +        page = 0 +        temp_links = [] +        for start_index in range(1, int(max_videos), 50): +            max_results = max_videos - page * 50 +            if max_results > 50: +                max_results = 50 +            url = "http://gdata.youtube.com/feeds/api/users/" + self.user + "/uploads?max-results=" + str(max_results) + "&start-index=" + str(start_index) +            rep = self.req.load(url) +            new_links = re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)", rep) +            if new_links != []: +                temp_links.extend(new_links) +            else: +                break +            page += 1 +        self.links = temp_links diff --git a/module/plugins/YoutubeCom.py b/module/plugins/YoutubeCom.py new file mode 100644 index 000000000..7428f532d --- /dev/null +++ b/module/plugins/YoutubeCom.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from 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"<title>YouTube - (.*)</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("&", "&") +        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/ZippyshareCom.py b/module/plugins/ZippyshareCom.py new file mode 100644 index 000000000..61408f925 --- /dev/null +++ b/module/plugins/ZippyshareCom.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib +from 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 +        """ +        if self.html == None: +            self.download_html() +        if not self.want_reconnect: +            file_url = urllib.unquote(re.search("var \w* = 'fck(.*)';", 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("<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/ZshareNet.py b/module/plugins/ZshareNet.py new file mode 100644 index 000000000..33667605f --- /dev/null +++ b/module/plugins/ZshareNet.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from 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/__init__.py b/module/plugins/__init__.py new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/module/plugins/__init__.py @@ -0,0 +1 @@ +  | 
