GithubHelp home page GithubHelp logo

phasenraum2010 / embed-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from human-connection/embed-api

0.0 2.0 0.0 178 KB

API Service for fetching URL Information like images, icons, descriptions etc. thourgh OpenGraph, oEmbed and other standards.

License: MIT License

JavaScript 100.00%

embed-api's Introduction

Embed API

URL Embed API with Caching

About

This API uses Metaphor for fetching URL data from multiple sources.

How to use this image

Make sure you have installed docker.

Running locally

To test this service on you local machine, simply run:

docker run --rm --name embed-api humanconnection/embed-api:latest

Running in Production

Make sure you provide an unique API Key as well as a mongoDB user and password on your production server:

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, yarn and mongoDB 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)

    {
         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: '<iframe width="459" height="344" src="https://www.youtube.com/embed/cWDdd5KKhts?feature=oembed" frameborder="0" allowfullscreen></iframe>'
         },
         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: '<html><head><title>Cheese Shop Sketch - Monty Python\'s Flying Circus</title></head><body><div class=\'metaphor-embed\'><div class=\'metaphor-embed-header\'><img class="metaphor-embed-header-icon" src="https://s.ytimg.com/yts/img/favicon_32-vfl8NGn4k.png"/><div class="metaphor-embed-header-site">YouTube</div><a class ="metaphor-embed-header-link" href="https://www.youtube.com/watch?v=cWDdd5KKhts"><div class="metaphor-embed-header-title">Cheese Shop Sketch - Monty Python\'s Flying Circus</div></a></div><div class=\'metaphor-embed-body\'><div class="metaphor-embed-body-description">Subscribe to the Official Monty Python Channel here - http://smarturl.it/SubscribeToPython Cleese plays an erudite customer attempting to purchase some chees...</div><img class="metaphor-embed-body-image" src="https://i.ytimg.com/vi/cWDdd5KKhts/hqdefault.jpg"/></div></div></body></html>',
         sources: ['ogp', 'resource', 'oembed', 'twitter']
     }
    

Testing

Simply run yarn test and all your tests in the test/ directory will be run.

License

Copyright (c) 2018 Grzegorz Leoniec

Licensed under the MIT license.

embed-api's People

Contributors

appinteractive avatar visualjerk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.