可以使用以下网址在未经授权的情况下从Instagram获取用户的媒体Feed,并控制所显示的数据?
https://www.instagram.com/{username}/media/
响应采用JSON格式:
{
status: "ok",
items: [
{
can_delete_comments: false,
code: "BHN55zegQYk",
location: null,
images: {
low_resolution: {
url: "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s320x320/e35/13551611_1746490512297913_1853324944_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.l",
width: 320,
height: 320
},
thumbnail: {
url: "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s150x150/e35/c0.0.1079.1079/13534565_996407620456445_1170595894_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.c",
width: 150,
height: 150
},
standard_resolution: {
url: "https://scontent-waw1-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/13551611_1746490512297913_1853324944_n.jpg?ig_cache_key=MTI4MjkzNjEyOTgwNDM3MTQ5Mg%3D%3D.2.l",
width: 640,
height: 640
}
},
can_view_comments: true,
comments: {
count: 2,
data: [
{
created_time: "1467158133",
text: "#flowermuse #peonyseason #peonies #peonylove",
from: { /* user object */ },
id: "17848900168109698"
},
{
created_time: "1467171168",
text: "!!",
from: { /* user object */ },
id: "17848905430109698"
}
]
},
alt_media_url: null,
caption: {
created_time: "1467157926",
text: "The first of Alaskan peonies going out this week! ",
from: { /* user object */ },
id: "17848900084109698"
},
link: "https://www.instagram.com/p/BHN55zegQYk/",
likes: {
count: 156,
data: [
{ /* user object */ },
{ /* user object */ },
{ /* user object */ },
{ /* user object */ }
]
},
created_time: "1467157926",
user_has_liked: false,
type: "image",
id: "1282936129804371492_25920898",
user: { /* user object */ }
},
{ /* more media objects */ }
]
}
是否有可能以某种方式过滤此数据?例如,我只需要images
部分返回的项目,我可以轻松跳过user
数据,他们的评论,喜欢等。
我想限制仅提取给图像源及其描述的数据。
答案 0 :(得分:0)
您无法在未经授权的情况下访问任何Instagram API,您需要access_token
。
您无法获得仅包含图片的过滤JSON Feed,json数据Feed非常小,您只需抓取整个Feed并在客户端生成过滤后的Feed。