Skip to content

Commit 9a87f83

Browse files
committed
Dailymotion: fix #210
1 parent 8267167 commit 9a87f83

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/you_get/downloader/dailymotion.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
from ..common import *
66

77
def dailymotion_download(url, output_dir = '.', merge = True, info_only = False):
8-
html = get_html(url)
9-
html = parse.unquote(html).replace('\/', '/')
8+
"""Downloads Dailymotion videos by URL.
9+
"""
1010

11-
title = r1(r'meta property="og:title" content="([^"]+)"', html)
12-
title = escape_file_path(title)
11+
id = match1(url, r'/video/([^\?]+)')
12+
embed_url = 'http://www.dailymotion.com/embed/video/%s' % id
13+
html = get_content(embed_url)
1314

14-
for quality in ['hd720URL', 'hqURL', 'sdURL']:
15-
real_url = r1(r',\"' + quality + '\"\:\"([^\"]+?)\",', html)
15+
info = json.loads(match1(html, r'var\s*info\s*=\s*({.+}),\n'))
16+
17+
title = info['title']
18+
19+
for quality in ['stream_h264_hd1080_url', 'stream_h264_hd_url', 'stream_h264_hq_url', 'stream_h264_url', 'stream_h264_ld_url']:
20+
real_url = info[quality]
1621
if real_url:
1722
break
23+
1824
type, ext, size = url_info(real_url)
1925

2026
print_info(site_info, title, type, size)

0 commit comments

Comments
 (0)