-2
我正在做一個instagram api實驗現在,我可以通過instagram標籤顯示照片。但我有一個問題:
- Theres一種顯示Instagram照片+用戶名(發佈照片的人)的方式?
感謝;)
我正在做一個instagram api實驗現在,我可以通過instagram標籤顯示照片。但我有一個問題:
感謝;)
如果我理解正確你的問題,假設你有一個Instagram的圖片的URL像http://instagram.com/p/p2P-98uHBp/那麼你可以使用Instagam的Embedding Endpoints獲得從該鏈接json
信息。
此URL格式將返回您需要的JSON數據:
http://api.instagram.com/oembed?url=http://instagram.com/p/p2P-98uHBp/
的用戶名可以像一個Ajax響應中提取:
var instaURL = "http://api.instagram.com/oembed?url=http://instagram.com/p/p2P-98uHBp/";
$(document).ready(function() {
$.ajax({
url: instaURL,
dataType : "jsonp", // this is important
cache: false,
success: function (response) {
alert("the instagram user is = " + response.author_name);
},
error: function() {
alert("couldn't process the instagram url");
}
});
});