Read open graph image through Facebook API -
here's stackoverflow.com's og:image meta tag:
<meta property="og:image" itemprop="image primaryimageofpage" content="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon@2.png?v=ea71a5211a91&a" />
is possible read information through facebook's open graph api, rather scraping page manually?
https://graph.facebook.com/?id=http://stackoveflow.com returns:
{ "og_object": { "id": "10150180465825637", "description": "q&a professional , enthusiast programmers", "title": "stack overflow", "type": "website", "updated_time": "2015-07-21t12:33:38+0000", "url": "http://stackoverflow.com/" }, "share": { "comment_count": 4, "share_count": 32367 }, "id": "http://stackoverflow.com" }
if additionally request picture
fields, should desired result:
/?id=http://stackoverflow.com&fields=id,share,og_object{id,title,type,updated_time,url,picture}
returns
{ "id": "http://stackoverflow.com", "share": { "comment_count": 4, "share_count": 32367 }, "og_object": { "id": "10150180465825637", "title": "stack overflow", "type": "website", "updated_time": "2015-07-21t12:33:38+0000", "url": "http://stackoverflow.com/", "picture": { "data": { "is_silhouette": false, "url": "https://fbexternal-a.akamaihd.net/safe_image.php?d=aqa6i9bpngiu11fn&w=200&h=200&url=http%3a%2f%2fcdn.sstatic.net%2fstackoverflow%2fimg%2fapple-touch-icon%402.png%3fv%3dea71a5211a91%26a&crop" } } } }
Comments
Post a Comment