提交 93d23e05 编写于 作者: M Mort Yao

add support for Vimeo

上级 3b561fc5
......@@ -9,6 +9,7 @@ from .pptv import *
from .sina import *
from .sohu import *
from .tudou import *
from .vimeo import *
from .w56 import *
from .yinyuetai import *
from .youku import *
......
#!/usr/bin/env python
__all__ = ['vimeo_download', 'vimeo_download_by_id']
from ..common import *
def vimeo_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
html = get_html('http://vimeo.com/%s' % id, faker = True)
signature = r1(r'"signature":"([^"]+)"', html)
timestamp = r1(r'"timestamp":([^,]+)', html)
title = r1(r'"title":"([^"]+)"', html)
title = escape_file_path(title)
url = 'http://player.vimeo.com/play_redirect?clip_id=%s&sig=%s&time=%s' % (id, signature, timestamp)
type, ext, size = url_info(url, faker = True)
print_info(site_info, title, type, size)
if not info_only:
download_urls([url], title, ext, size, output_dir, merge = merge, faker = True)
def vimeo_download(url, output_dir = '.', merge = True, info_only = False):
id = r1(r'http://\w*vimeo.com[/\w]*/(\d+)$', url)
assert id
vimeo_download_by_id(id, None, output_dir = output_dir, merge = merge, info_only = info_only)
site_info = "Vimeo.com"
download = vimeo_download
download_playlist = playlist_not_supported('vimeo')
......@@ -12,6 +12,8 @@ def url_to_module(url):
if site.endswith('.com.cn'):
site = site[:-3]
domain = r1(r'(\.[^.]+\.[^.]+)$', site)
if not domain:
domain = site
assert domain, 'unsupported url: ' + url
k = r1(r'([^.]+)', domain)
......@@ -28,6 +30,7 @@ def url_to_module(url):
'sina': sina,
'sohu': sohu,
'tudou': tudou,
'vimeo': vimeo,
'yinyuetai': yinyuetai,
'youku': youku,
'youtube': youtube,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册