python-ox/ox/web/vimeo.py

18 lines
493 B
Python
Raw Normal View History

2010-11-05 12:00:19 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2014-10-02 08:28:22 +00:00
import json
2010-11-05 12:00:19 +00:00
from ox.cache import read_url
2010-11-05 12:00:19 +00:00
2012-08-15 15:15:40 +00:00
def get_data(id):
2014-10-02 08:28:22 +00:00
url = 'http://vimeo.com/api/v2/video/%s.json' % id
data = json.loads(read_url(url).decode('utf-8'))[0]
url = 'http://player.vimeo.com/video/%s/config?autoplay=0&byline=0&bypass_privacy=1&context=clip.main&default_to_hd=1&portrait=0' % id
info = json.loads(read_url(url).decode('utf-8'))
data['video'] = info['request']['files']['h264']
2010-11-05 12:00:19 +00:00
return data