[vine] support card URLs

This commit is contained in:
Mort Yao 2015-11-09 16:45:32 +01:00
parent 53fface1f9
commit 20e9ef4708

View File

@ -8,10 +8,11 @@ def vine_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url)
vid = r1(r'vine.co/v/([^/]+)', url)
title1 = r1(r'<meta property="twitter:title" content="([^"]*)"', html)
title2 = r1(r'<meta property="twitter:description" content="([^"]*)"', html)
title = "{} - {} [{}]".format(title1, title2, vid)
title = r1(r'<title>([^<]*)</title>', html)
stream = r1(r'<meta property="twitter:player:stream" content="([^"]*)">', html)
if not stream: # https://vine.co/v/.../card
stream = r1(r'"videoUrl":"([^"]+)"', html).replace('\\/', '/')
mime, ext, size = url_info(stream)
print_info(site_info, title, mime, size)