add support for Vimeo

This commit is contained in:
Mort Yao 2012-09-02 03:13:16 +02:00
parent 3b561fc53d
commit 93d23e050e
3 changed files with 35 additions and 0 deletions

View File

@ -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 *

View File

@ -0,0 +1,31 @@
#!/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')

View File

@ -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,