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

25 lines
754 B
Python
Raw Normal View History

2013-03-22 07:31:28 +04:00
#!/usr/bin/env python
__all__ = ['vine_download']
from ..common import *
def vine_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
2013-03-22 07:31:28 +04:00
html = get_html(url)
2014-02-15 00:19:43 +04:00
2015-06-13 17:52:11 +03:00
vid = r1(r'vine.co/v/([^/]+)', url)
2015-11-09 18:45:32 +03:00
title = r1(r'<title>([^<]*)</title>', html)
2015-06-13 17:52:11 +03:00
stream = r1(r'<meta property="twitter:player:stream" content="([^"]*)">', html)
2015-11-09 18:45:32 +03:00
if not stream: # https://vine.co/v/.../card
stream = r1(r'"videoUrl":"([^"]+)"', html).replace('\\/', '/')
2015-06-13 17:52:11 +03:00
mime, ext, size = url_info(stream)
2014-02-15 00:19:43 +04:00
2015-06-13 17:52:11 +03:00
print_info(site_info, title, mime, size)
2013-03-22 07:31:28 +04:00
if not info_only:
2015-06-13 17:52:11 +03:00
download_urls([stream], title, ext, size, output_dir, merge=merge)
2013-03-22 07:31:28 +04:00
site_info = "Vine.co"
download = vine_download
download_playlist = playlist_not_supported('vine')