diff options
| author | 2013-02-26 15:48:40 +0100 | |
|---|---|---|
| committer | 2013-02-26 15:48:40 +0100 | |
| commit | 400b9a2578c5934b6d3a0736a64a11a9f20c43b0 (patch) | |
| tree | f09a039549bde3a4212aafa4c4a516dae5125bf0 | |
| parent | Merge pull request #12 from irrenhaus/stable (diff) | |
| parent | Added DailymotionCom plugin (diff) | |
| download | pyload-400b9a2578c5934b6d3a0736a64a11a9f20c43b0.tar.xz | |
Merge pull request #15 from Peekayy/stable
Added DailymotionCom plugin
| -rw-r--r-- | module/plugins/hoster/DailymotionCom.py | 53 | 
1 files changed, 53 insertions, 0 deletions
| diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py new file mode 100644 index 000000000..0385125a4 --- /dev/null +++ b/module/plugins/hoster/DailymotionCom.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from urllib import unquote +from module.plugins.Hoster import Hoster + +class DailymotionCom(Hoster): +    __name__ = 'DailymotionCom' +    __type__ = 'hoster' +    __pattern__ = r'http://www.dailymotion.com/.*' +    __version__ = '0.1' +    __description__ = """Dailymotion Video Download Hoster""" +    __author_name__ = ("Peekayy") +    __author_mail__ = ("peekayy.dev@gmail.com") + +    def process(self, pyfile): +        html = self.load(pyfile.url, decode=True) + +        filename = re.search(r'name="title" content="Dailymotion \\-(.*?)\\- ein Film', html) +        if filename is None: +            filename = re.search(r'<span class="title foreground" title="(.*?)">', html) +            if filename is None: +                filename = re.search(r'class="title" title="(.*?)"', html) +                if filename is None: +                    filename = re.search(r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"', html) +                    if filename is None: +                        self.fail("Unable to find file name") +        pyfile.name = filename.group(1)+'.mp4' +        self.logDebug('Filename='+pyfile.name) +        allLinksInfo = re.search(r'"sequence":"(.*?)"', html) +        self.logDebug(allLinksInfo.groups()) +        allLinksInfo = unquote(allLinksInfo.group(1)) +         +        dlLink = self.getQuality('hd720URL', allLinksInfo) +        if dlLink is None: +            dlLink = self.getQuality('hqURL', allLinksInfo) +            if dlLink is None: +                dlLink = self.getQuality('sdURL', allLinksInfo) +                if dlLink is None: +                    dlLink = self.getQuality('ldURL', allLinksInfo) +        if dlLink is None: +            self.fail(r'Unable to find video URL') +        else: +            self.logDebug(dlLink) +            self.download(dlLink) + +    def getQuality(self, quality, data): +        link = re.search('"' + quality + '":"(http:[^<>"\']+)"', data) +        if link is None: +            return link +        else: +            return link.group(1).replace('\\','') | 
