oEmbed + Embed.ly


(Shri) #1

Here’s what I’d like to setup as a plugin.

Not sure where to begin and how this would work. Perhaps this can be done using onebox or something else?

I’d like to be able to create a more generic embedding interface - Onebox is ok, but not in my use case ( lots of links being posted and we want richer descriptions and one single template to rule the all).

First let me get this out of the way - there is a free tier at Embed.Ly which allows 5000 oembed calls. :slight_smile:

With the build in onebox, I get this:

With embedly’s oembed API I get this:

{  
   "provider_url":"http://www.scmp.com",
   "description":"Cynics in the local media like to say: there's no such thing as the most absurd, only the more absurd. The Cantonese saying may not translate well, but the message is clear - just when we think we have seen everything, something more bizarre will...",
   "title":"Hong Kong's Latest Epidemic: Ridiculitis",
   "thumbnail_width":620,
   "url":"http://www.scmp.com/comment/blogs/article/1843326/hong-kongs-latest-epidemic-ridiculitis",
   "thumbnail_url":"http://cdn1.i-scmp.com/sites/default/files/styles/620x356/public/2015/07/24/scmp_12jul15_ns_water2_wck_8437_51367695.jpg?itok=PCZWcd6e",
   "version":"1.0",
   "provider_name":"South China Morning Post",
   "type":"link",
   "thumbnail_height":356
}

For a facebook video from another thread, I get this:

{  
   "provider_url":"http://www.facebook.com",
   "description":"THE \"ZOMBIE APOCALYPSE TRUCK\" -> Dima Koslowski",
   "title":"Dima Koslowski - Timeline | Facebook",
   "author_name":"Dima Koslowski",
   "height":400,
   "thumbnail_width":160,
   "width":500,
   "html":"<iframe class=\"embedly-embed\" src=\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.facebook.com%2Fvideo%2Fembed%3Fvideo_id%3D879922095450656&url=https%3A%2F%2Fwww.facebook.com%2Fdima.koslowski%2Fvideos%2F879922095450656%2F&image=https%3A%2F%2Fscontent.xx.fbcdn.net%2Fv%2Ft15.0-10%2Fs160x160%2F12496571_879937415449124_521787180_n.jpg%3Foh%3Dd435f3b9eade0643e79f6b7f2d6d82b3%26oe%3D5831128A&key=430136d4c9274a4e91e08196f6a76460&type=text%2Fhtml&schema=facebook\" width=\"500\" height=\"400\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>",
   "author_url":"http://facebook.com/557079631068239",
   "version":"1.0",
   "provider_name":"Facebook",
   "thumbnail_url":"https://scontent.xx.fbcdn.net/v/t15.0-10/s160x160/12496571_879937415449124_521787180_n.jpg?oh=d435f3b9eade0643e79f6b7f2d6d82b3&oe=5831128A",
   "type":"video",
   "thumbnail_height":160
}

Can someone suggest a few areas I could look at to bring this into discourse?

The API is called using this:

http://api.embed.ly/1/oembed?url=https://www.facebook.com/dima.koslowski/videos/879922095450656/&height=400&width=500&key=ADD_YOUR_OWN_KEY


(Jeff Atwood) #2

Not particularly good timing if you look at 1.7 in #releases.

We view this as a core competency so, as with any core competency, we would never outsource it.


(Shri) #3

Just saw that. Thanks.

No clue how you’re going to do this and what the end result would look like and for sure don’t want to tread on core features. I hope you do consider an approach which may allow a developer to override the built in onebox. :slight_smile:

I actually do want to go further and bring in some tagging / entity and term extraction using some services like alchemyapi / semantria / diffbot into the links posted on this forum that I’m looking at developing, so figured this sort of plugin would be a good start for me to learn ruby / discourse at the same time.