【问题标题】:Filter response from Instagram media feed过滤来自 Instagram 媒体源的响应
【发布时间】:2016-06-29 06:36:46
【问题描述】:

是否可以使用以下 URL 未经授权从 Instagram 获取用户的媒体供稿并控制呈现的数据?

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 数据、他们的 cmets、like 等。 我想将获取的数据限制在图像源及其描述中。

【问题讨论】:

    标签: json rest instagram instagram-api


    【解决方案1】:

    你不能再未经授权访问任何 Instagram API,你需要access_token

    您无法获得仅包含图像的过滤 JSON 提要,json 数据提要非常小,您可以抓取整个提要并在客户端制作过滤提要。

    【讨论】:

    • 可以访问我提到的媒体端点:instagram.com/nasa/media
    • 只给你20个最近的,不确定你是否可以分页
    • @hsz 您提供的链接已损坏
    猜你喜欢
    • 2013-05-31
    • 2018-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多