[vine] fix support

This commit is contained in:
Mort Yao 2015-06-13 22:52:11 +08:00
parent 3d6e6effa1
commit 6886c5ace1

View File

@ -7,18 +7,16 @@ from ..common import *
def vine_download(url, output_dir='.', merge=True, info_only=False):
html = get_html(url)
vid = r1(r'vine.co/v/([^/]+)/', html)
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 = "%s - %s" % (title1, title2) + " [" + vid + "]"
url = r1(r'<source src="([^"]*)"', html) or r1(r'<meta itemprop="contentUrl" content="([^"]*)"', html)
if url[0:2] == "//":
url = "http:" + url
type, ext, size = url_info(url)
title = "{} - {} [{}]".format(title1, title2, vid)
stream = r1(r'<meta property="twitter:player:stream" content="([^"]*)">', html)
mime, ext, size = url_info(stream)
print_info(site_info, title, type, size)
print_info(site_info, title, mime, size)
if not info_only:
download_urls([url], title, ext, size, output_dir, merge = merge)
download_urls([stream], title, ext, size, output_dir, merge=merge)
site_info = "Vine.co"
download = vine_download