add support for Dailymotion

This commit is contained in:
Mort Yao 2012-09-25 00:27:28 +02:00
parent 043573c8ac
commit 19a8c079d7
3 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,7 @@
from .acfun import *
from .bilibili import *
from .cntv import *
from .dailymotion import *
from .ifeng import *
from .iqiyi import *
from .ku6 import *

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
__all__ = ['dailymotion_download']
from ..common import *
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
html = get_html(url)
html = parse.unquote(html).replace('\/', '/')
title = r1(r'meta property="og:title" content="([^"]+)"', html)
title = escape_file_path(title)
real_url = r1(r',\"sdURL\"\:\"([^\"]+?)\",', html)
type, ext, size = url_info(real_url)
print_info(site_info, title, type, size)
if not info_only:
download_urls([real_url], title, ext, size, output_dir, merge = merge)
site_info = "Dailymotion.com"
download = dailymotion_download
download_playlist = playlist_not_supported('dailymotion')

View File

@ -22,6 +22,7 @@ def url_to_module(url):
'acfun': acfun,
'bilibili': bilibili,
'cntv': cntv,
'dailymotion': dailymotion,
'iask': sina,
'ifeng': ifeng,
'iqiyi': iqiyi,