noembed: A simple free alternative of embedly

, , Leave a comment

In one of my projects I was using embedly. Me and my client both were very happy using it. Then it became a paid service.

It is not a bad thing to make a service paid. They have added many new features after that. I liked it even more.

However, my client was not earning a significant amount of money from his website. As a result he was unwilling to pay that amont of money for embedding purpose.

Some days later he asked me to use https://noembed.com in the project as it is a free service.

As I started to look into it. I went to their demo page https://noembed.com/demo. Unfortunately, I found that many of the websites do not work with noembed.

However, I just had to add the functionality of dynamically embedding data from basically 3 video websites. They are YouTube, Vimeo, and Dailyomtion. I was relieved when I found that all of these websites are working with Noembed. That means I will not have to use embedly.

The usage is really straight forward.

To embed the url https://www.youtube.com/watch?v=ee1172yeqyE with noembed, you will have to send a GET request to –

https://noembed.com/embed?url=https://www.youtube.com/watch?v=ee1172yeqyE

This will return a JSON response like –

{
"author_url":"https://www.youtube.com/user/movieclipsTRAILERS",
"type":"video",
"provider_url":"https://www.youtube.com/",
"thumbnail_height":360,
"width":480,
"provider_name":"YouTube",
"url":"https://www.youtube.com/watch?v=ee1172yeqyE",
"author_name":"Movieclips Trailers",
"title":"Avengers: Endgame Trailer #1 (2019) | Movieclips Trailers",
"thumbnail_width":480,
"height":270,
"thumbnail_url":"https://i.ytimg.com/vi/ee1172yeqyE/hqdefault.jpg",
"version":"1.0",
"html":"\n<iframe width=\" 480\" height=\"270\" src=\"https://www.youtube.com/embed/ee1172yeqyE?feature=oembed\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe>\n"
}

Notice the ‘html‘ attribute. If you put the ‘html’ attribute value in your HTML response, the URL will be embedded.

You will have to perse the JSON response according to the language you are using. In my rails application I used the follwoing line of code to send request and converting the JSON response to rails hashed.

url = 'https://www.youtube.com/watch?v=ee1172yeqyE'
content = JSON.parse(open("https://noembed.com/embed?url=#{CGI::escape(url)}").read)
puts content['html']

You can use Noembed for a number of sites. This link contains a list of supported sites by Noembed: https://noembed.com/#supported-sites

However, you will find many of the sites do not work with noembed. For this reason, before using noembed for your project test thoroghly if the your desired sites work with it or not.

 

Leave a Reply