https://github.com/human-connection/embed-api
API Service for fetching URL Information like images, icons, descriptions etc. thourgh OpenGraph, oEmbed and other standards.
https://github.com/human-connection/embed-api
oembed opengraph
Last synced: about 1 year ago
JSON representation
API Service for fetching URL Information like images, icons, descriptions etc. thourgh OpenGraph, oEmbed and other standards.
- Host: GitHub
- URL: https://github.com/human-connection/embed-api
- Owner: Human-Connection
- License: mit
- Created: 2018-03-25T19:42:10.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-01-20T04:25:17.000Z (over 6 years ago)
- Last Synced: 2025-03-30T15:46:55.635Z (about 1 year ago)
- Topics: oembed, opengraph
- Language: JavaScript
- Size: 276 KB
- Stars: 10
- Watchers: 4
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Embed API
> URL Embed API with Caching
## About
This API uses [Metaphor](https://www.npmjs.com/package/metaphor) for fetching URL data from multiple sources.
## How to use this image
Make sure you have installed [docker](https://www.docker.com/community-edition).
### Running locally
To test this service on you local machine, simply run:
```bash
docker run --rm --name embed-api humanconnection/embed-api:latest
```
You can use docker-compose, too:
```sh
docker-compose up
# wait until the services are up
curl --header "authentication: embedapitoken" "http://localhost:3050/embeds?url=http://www.human-connection.org/"
```
### Running in Production
Make sure you provide an unique API Key as well as a mongoDB user and password on your production server:
```bash
docker run --rm --name embed-api -e "EMBED_API_TOKEN=MYSUPERSECRETSTRING" -e "EMBED_API_MONGO_USER=MONGOUSER" -e "EMBED_API_MONGO_PASS=MONGOPASS" humanconnection/embed-api:latest
```
## Development
1. Make sure you have [NodeJS](https://nodejs.org/), [yarn](https://yarnpkg.com) and [mongoDB](https://www.mongodb.com/download-center#community) installed.
2. Install your dependencies
```
cd path/to/embed-api; yarn install
```
3. Start your app
```
yarn dev
```
4. Get URL Information
```
http://localhost:3050/embeds?url=http://www.human-connection.org/
```
5. Do something creative with the following output
(More information here: [Metaphor](https://www.npmjs.com/package/metaphor))
```
{
site_name: 'YouTube',
url: 'https://www.youtube.com/watch?v=cWDdd5KKhts',
title: 'Cheese Shop Sketch - Monty Python\'s Flying Circus',
image: { url: 'https://i.ytimg.com/vi/cWDdd5KKhts/maxresdefault.jpg' },
description: 'Subscribe to the Official Monty Python Channel here - http://smarturl.it/SubscribeToPython Cleese plays an erudite customer attempting to purchase some chees...',
type: 'video',
video: [
{
url: 'https://www.youtube.com/embed/cWDdd5KKhts',
type: 'text/html',
width: '480',
height: '360'
},
{
url: 'https://www.youtube.com/v/cWDdd5KKhts?version=3&autohide=1',
type: 'application/x-shockwave-flash',
width: '480',
height: '360',
tag: ['Monty Python', 'Python (Monty) Pictures Limited', 'Comedy', 'flying circus', 'monty pythons flying circus', 'john cleese', 'micael palin', 'eric idle', 'terry jones', 'graham chapman', 'terry gilliam', 'funny', 'comedy', 'animation', '60s animation', 'humor', 'humour', 'sketch show', 'british comedy', 'cheese shop', 'monty python cheese', 'cheese shop sketch', 'cleese cheese', 'cheese']
}
],
thumbnail: {
url: 'https://i.ytimg.com/vi/cWDdd5KKhts/hqdefault.jpg',
width: 480,
height: 360
},
embed: {
type: 'video',
height: 344,
width: 459,
html: ''
},
app: {
iphone: {
name: 'YouTube',
id: '544007664',
url: 'vnd.youtube://www.youtube.com/watch?v=cWDdd5KKhts&feature=applinks'
},
ipad: {
name: 'YouTube',
id: '544007664',
url: 'vnd.youtube://www.youtube.com/watch?v=cWDdd5KKhts&feature=applinks'
},
googleplay: {
name: 'YouTube',
id: 'com.google.android.youtube',
url: 'https://www.youtube.com/watch?v=cWDdd5KKhts'
}
},
player: {
url: 'https://www.youtube.com/embed/cWDdd5KKhts',
width: '480',
height: '360'
},
twitter: { site_username: '@youtube' },
icon: {
'32': 'https://s.ytimg.com/yts/img/favicon_32-vfl8NGn4k.png',
'48': 'https://s.ytimg.com/yts/img/favicon_48-vfl1s0rGh.png',
'96': 'https://s.ytimg.com/yts/img/favicon_96-vfldSA3ca.png',
'144': 'https://s.ytimg.com/yts/img/favicon_144-vflWmzoXw.png',
smallest: 'https://s.ytimg.com/yts/img/favicon_32-vfl8NGn4k.png'
},
preview: 'Cheese Shop Sketch - Monty Python\'s Flying Circus
',
sources: ['ogp', 'resource', 'oembed', 'twitter']
}
```
## Testing
Simply run `yarn test` and all your tests in the `test/` directory will be run.
### Testing with docker-compose
You can run eslint and mocha with:
```
- docker-compose run --rm embed-api yarn run eslint
- docker-compose run --rm embed-api yarn run mocha
```
## License
Copyright (c) 2018
Grzegorz Leoniec
Licensed under the [MIT license](LICENSE).