Dailymotion: fix user page URL

This commit is contained in:
Mort Yao 2014-02-10 02:16:03 +01:00
parent 59e505b5bc
commit 4ab7c50ec8

View File

@ -7,22 +7,22 @@ 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):
"""Downloads Dailymotion videos by URL. """Downloads Dailymotion videos by URL.
""" """
id = match1(url, r'/video/([^\?]+)') id = match1(url, r'/video/([^\?]+)') or match1(url, r'video=([^\?]+)')
embed_url = 'http://www.dailymotion.com/embed/video/%s' % id embed_url = 'http://www.dailymotion.com/embed/video/%s' % id
html = get_content(embed_url) html = get_content(embed_url)
info = json.loads(match1(html, r'var\s*info\s*=\s*({.+}),\n')) info = json.loads(match1(html, r'var\s*info\s*=\s*({.+}),\n'))
title = info['title'] 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']: 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] 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)
if not info_only: if not info_only:
download_urls([real_url], title, ext, size, output_dir, merge = merge) download_urls([real_url], title, ext, size, output_dir, merge = merge)