jQuery 如何在 Instagram 上显示用户喜欢的所有图片(通过 API)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17801466/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I display all images a user has liked on Instagram (via API)?
提问by Nick
I'd really love to be able to view the images I've "liked" on Instagram via a web app. In the API there's an endpoint for /users/self/media/liked, but I'm not sure how to take advantage of this. I'm assuming it would require user authentication? I was trying to build it off of Potomak's jQuery Instagram plugin, but it wasn't working. Any ideas?
我真的很想能够通过网络应用程序在 Instagram 上查看我“喜欢”的图像。在 API 中有一个 /users/self/media/liked 的端点,但我不确定如何利用它。我假设它需要用户身份验证?我试图用Potomak 的 jQuery Instagram 插件构建它,但它不起作用。有任何想法吗?
回答by user1788736
i found this link but i dont know how to do it in javascript or php! see if it helps u http://symmetricinfinity.com/2013/04/06/download-your-likes-from-instagram.htmland Instagram API Docs
我找到了这个链接,但我不知道如何在 javascript 或 php 中做到这一点!看看它是否对你有帮助http://symmetricinfinity.com/2013/04/06/download-your-likes-from-instagram.html和 Instagram API Docs
i wonder if any one can translate this to php or javascript!
我想知道是否有人可以将其翻译成 php 或 javascript!
source code from above refrence:
上面参考的源代码:
require 'restclient'
require 'json'
media_url = "https://api.instagram.com/v1/users/self/media/liked/?access_token=ACCESS_TOKEN"
urls = []
while media_url != nil
response = RestClient.get(media_url)
json = JSON.parse(response)
media_url = json["pagination"]["next_url"]
json["data"].each do |item|
urls << item["images"]["standard_resolution"]["url"]
end
# don't slam instagram's api
sleep 0.2
end
urls.each_with_index do |url, idx|
image = RestClient.get(url)
path = Dir.pwd + "/#{idx}.jpg"
File.open(path, 'w') {|f| f.write(image) }
end