openmedialibrary_platform/Shared/lib/python3.4/site-packages/ox/web/vimeo.py

18 lines
493 B
Python
Raw Normal View History

2013-10-11 17:28:32 +00:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
2014-10-04 19:08:57 +00:00
import json
2013-10-11 17:28:32 +00:00
from ox.cache import read_url
def get_data(id):
2014-10-04 19:08:57 +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']
2013-10-11 17:28:32 +00:00
return data