twitterのsearch api から instagramの画像URLが必要となったのでメモ。
とりあえず、画像URLだけが必要な場合は、以下のURLを叩けばリダイレクトされるので、そのままsrc属性につっこめばおっけー。
?size=l(/m/s) とかで大きさも指定できる。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="http://instagr.am/p/{page_id}/media/?size=l" /> |
http://instagr.am/p/NVLdycQkC1/+media/?size=mでおっけー
<img src="http://instagr.am/p/NVLdycQkC1/media/?size=m" alt="" />
これは簡単。
次にinstagramの個別IDやタイトルとかも欲しい場合は以下のURLを叩けば、jsonpで必要な物がかえってくる。
http://instagr.am/api/v1/oembed?url={URL}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var URL = 'http:\/\/instagram.com\/p\/NVLdycQkC1\/'; | |
$.getJson( | |
'http:\/\/instagr.am\/api\/v1\/oembed?callback=&url='+URL, | |
function(json){ | |
console.log('json'); | |
//some codes | |
} | |
); |
こちらはパラメータとして、maxwidthを指定することで大きさを変えれるみたい。
ただ両方非公式っぽいので、そのへんはおまかせで。