django-politico-oembed-service
Quickstart
- Install the app.
$ pip install django-politico-oembed-service
- Add the app to your Django project and configure settings.
INSTALLED_APPS = [
# ...
'rest_framework',
'oembedservice',
]
#########################
# oembeder settings
OEMBEDSERVICE_API_AUTHENTICATION_CLASS = ''
OEMBEDSERVICE_API_PERMISSION_CLASS = ''
Services
twitter/
fetch('https://your-api.com/twitter/', {
method: 'POST',
headers: {
Authorization: `Token ${YOUR_TOKEN}`, // or whatever auth strategy you use
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://twitter.com/someuser/sometweeturl/'
})
})
.then(response => response.json())
.then(data => {
console.log(data);
});
You may also pass values for the following params:
maxwidth
hide_media
hide_thread
omit_script
link_color
See Twitter's API docs for valid values.
YouTube
youtube/
fetch('https://your-api.com/youtube/', {
method: 'POST',
headers: {
Authorization: `Token ${YOUR_TOKEN}`, // or whatever auth strategy you use
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://www.youtube.com/watch?v=V7uEb_XrK1U'
})
})
.then(response => response.json())
.then(data => {
console.log(data);
});
Developing
Testing
$ python example/manage.py test