-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");
}
});
});