XRay is my service that parses web pages and extracts information from them. Right now I mostly use it to parse comments, but now that I've been adding support for reposts, it's used there as well.
Today I added support for XRay to extract data from Instagram URLs!
This means anything that uses XRay will now return structured data when given an Instagram URL, just like how it parses h-entry and other Microformats.
Unfortunately, Instagram does not provide timezone data for the published date, only a Unix timestamp. So if the photo is tagged at a location, then XRay will look up the appropriate timezone for that location and adjust the timezone of the published date accordingly!
Here's what the parsed JSON looks like for this photo. Note that the timezone is set to East Coast because this photo was taken at MIT.
{
"data":{
"type":"entry",
"url":"https://www.instagram.com/p/BM4rGs-lApG/",
"author":{
"type":"card",
"name":"Aaron Parecki",
"url":"http://aaronparecki.com/",
"photo":"https://scontent.cdninstagram.com/t51.2885-19/s320x320/14240576_268350536897085_1129715662_a.jpg"
},
"content":{
"text":"Here again"
},
"photo":[
"https://scontent.cdninstagram.com/t51.2885-15/e35/14269001_1162908790471145_6084871298582839296_n.jpg?ig_cache_key=MTM4NTA0NjQ2MjAyNzc5NTAxNA%3D%3D.2"
],
"location":[
"https://www.instagram.com/explore/locations/206258876/"
],
"published":"2016-11-16T16:07:06-05:00"
},
"refs":{
"https://www.instagram.com/explore/locations/206258876/":{
"type":"card",
"name":"Massachusetts Institute of Technology (MIT)",
"url":"https://www.instagram.com/explore/locations/206258876/",
"latitude":42.360011410484,
"longitude":-71.091869836761
}
}
}
In addition to my website using this for reposts and comments, when I paste that URL into IRC, Loqi uses XRay to expand it and provide a little text preview.
oh man, awesome!
comparing to https://granary-demo.appspot.com/instagram/-/@self/@app/BM4rGs-lApG?format=json-mf2, looks like they match up pretty well.
one interesting difference: did you do an extra profile URL fetch to get http://aaronparecki.com/? it’s not in https://www.instagram.com/p/BM4rGs-lApG/ anywhere.
otherwise, next step, comments and likes? :P