DISCLAIMER: OpenGraph.io is a commercial product that I work and support.
As you mentioned, often there are no OG tags to work with. There are all sorts of scenarios that you may come across (e.g. coding, misuse of HTML tags, etc.). If you want to handle boundary cases, I would recommend http://www.opengraph.io/
One of the main advantages is that it will output information, such as a title or description (if you need it), from the content on the page if OpenGraph tags do not exist.
To get information about the use of the site (the link must be encoded in the URL):
$.ajax('http://opengraph.io/api/1.0/site/http%3A%2F%2Fwww.washingtontimes.com%2F') .done(function(data){ console.log(data); });
Which will return something like:
{ "hybridGraph": { "title": "Washington Times - Politics, Breaking News, US and World News", "description": "The Washington Times delivers breaking news and commentary on the issues that affect the future of our nation.", "image": "http://twt-assets.washtimes.com/v4/images/logo-twt.4b20fb5d7b29.svg", "url": "http://www.washingtontimes.com/", "type": "site", "site_name": "Washington Times " }, "openGraph": {...}, "htmlInferred": {...}, "requestInfo": {...} }
1kmonkies
source share