Oliver Nassar

URL Metadata API Endpoint

December 2021

This is a simple one: I wanted an endpoint that would simply display a JSON object of some top-level metadata (eg. title, description, open graph data, etc.) associated with a URL.

Below are some URLs for to to see how it works:

Note: The host m.imnosy.com is simply a 301 redirect to the endpoint https://aws-api.416.io/utils/v1/url/metadata


What data will it retrieve?

Here's a breakdown of the open graph / metadata the endpoint can retrieve:

title, canonical, description, article:published_time, article:modified_time, og:description, og:image, og:image:alt, og:image:width, og:image:height, og:image:secure_url, og:image:type, og:locale, og:site_name, og:title, og:type, og:updated_time, og:url, og:video, og:video:duration, og:video:release_date, generator, twitter:card, twitter:creator, twitter:domain, twitter:description, twitter:image, twitter:image:alt, twitter:site, twitter:title, fb:app_id, fb:pages


Why did I build this?

A Chrome Extension I'm working on (Bookee) makes use of the Open Graph images a URL might refer to. It does so by showing a thumbnail associated with a URL. Ideally, it shows the Open Graph image associated with that URL (otherwise a screenshot of that URL).

However in order to do so, I need to first load the metadata associated with that URL.

This is being used by my other experiment: Open Graph Image Redirect.


How was it built?

I again used AWS to facilitate the backend of this tool. Three different services are used:

Cheerio is used for server-side HTML parsing.


Feedback

If you'd like to use the above endpoints in a production environment, or have any feedback, you can reach me at: onassar@gmail.com