mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
Dailymotion: fix #210
This commit is contained in:
parent
82671676ed
commit
9a87f83c70
@ -5,16 +5,22 @@ __all__ = ['dailymotion_download']
|
|||||||
from ..common import *
|
from ..common import *
|
||||||
|
|
||||||
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
|
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
|
||||||
html = get_html(url)
|
"""Downloads Dailymotion videos by URL.
|
||||||
html = parse.unquote(html).replace('\/', '/')
|
"""
|
||||||
|
|
||||||
title = r1(r'meta property="og:title" content="([^"]+)"', html)
|
id = match1(url, r'/video/([^\?]+)')
|
||||||
title = escape_file_path(title)
|
embed_url = 'http://www.dailymotion.com/embed/video/%s' % id
|
||||||
|
html = get_content(embed_url)
|
||||||
|
|
||||||
for quality in ['hd720URL', 'hqURL', 'sdURL']:
|
info = json.loads(match1(html, r'var\s*info\s*=\s*({.+}),\n'))
|
||||||
real_url = r1(r',\"' + quality + '\"\:\"([^\"]+?)\",', html)
|
|
||||||
|
title = info['title']
|
||||||
|
|
||||||
|
for quality in ['stream_h264_hd1080_url', 'stream_h264_hd_url', 'stream_h264_hq_url', 'stream_h264_url', 'stream_h264_ld_url']:
|
||||||
|
real_url = info[quality]
|
||||||
if real_url:
|
if real_url:
|
||||||
break
|
break
|
||||||
|
|
||||||
type, ext, size = url_info(real_url)
|
type, ext, size = url_info(real_url)
|
||||||
|
|
||||||
print_info(site_info, title, type, size)
|
print_info(site_info, title, type, size)
|
||||||
|
Loading…
Reference in New Issue
Block a user