From 19a8c079d729ff8fcaeb77b30ac2d26d5897e37c Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Tue, 25 Sep 2012 00:27:28 +0200 Subject: [PATCH] add support for Dailymotion --- you_get/downloader/__init__.py | 1 + you_get/downloader/dailymotion.py | 23 +++++++++++++++++++++++ you_get/main.py | 1 + 3 files changed, 25 insertions(+) create mode 100644 you_get/downloader/dailymotion.py diff --git a/you_get/downloader/__init__.py b/you_get/downloader/__init__.py index e96b0f2..a5010f1 100644 --- a/you_get/downloader/__init__.py +++ b/you_get/downloader/__init__.py @@ -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 * diff --git a/you_get/downloader/dailymotion.py b/you_get/downloader/dailymotion.py new file mode 100644 index 0000000..90fcd8b --- /dev/null +++ b/you_get/downloader/dailymotion.py @@ -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') diff --git a/you_get/main.py b/you_get/main.py index bfec6eb..659cfde 100644 --- a/you_get/main.py +++ b/you_get/main.py @@ -22,6 +22,7 @@ def url_to_module(url): 'acfun': acfun, 'bilibili': bilibili, 'cntv': cntv, + 'dailymotion': dailymotion, 'iask': sina, 'ifeng': ifeng, 'iqiyi': iqiyi, -- GitLab