you-get/src/you_get/extractors/vine.py

26 lines
866 B
Python
Raw Normal View History

2013-03-22 07:31:28 +04:00
#!/usr/bin/env python
__all__ = ['vine_download']
from ..common import *
2014-02-15 00:19:43 +04:00
def vine_download(url, output_dir='.', merge=True, info_only=False):
2013-03-22 07:31:28 +04:00
html = get_html(url)
2014-02-15 00:19:43 +04:00
2014-06-18 02:59:05 +04:00
vid = r1(r'vine.co/v/([^/]+)/', html)
2014-02-15 00:19:43 +04:00
title1 = r1(r'<meta property="twitter:title" content="([^"]*)"', html)
2014-06-18 02:59:05 +04:00
title2 = r1(r'<meta property="twitter:description" content="([^"]*)"', html)
title = "%s - %s" % (title1, title2) + " [" + vid + "]"
2014-11-28 16:53:44 +03:00
url = r1(r'<source src="([^"]*)"', html) or r1(r'<meta itemprop="contentUrl" content="([^"]*)"', html)
2014-01-08 11:21:32 +04:00
if url[0:2] == "//":
url = "http:" + url
2013-03-22 07:31:28 +04:00
type, ext, size = url_info(url)
2014-02-15 00:19:43 +04:00
2013-03-22 07:31:28 +04:00
print_info(site_info, title, type, size)
if not info_only:
download_urls([url], title, ext, size, output_dir, merge = merge)
site_info = "Vine.co"
download = vine_download
download_playlist = playlist_not_supported('vine')