简体   繁体   English

通过用户名获取 Instagram 用户分析

[英]Get instagram user analytics by username

I want to get the instagram user analytics, ie to get the time sheet with count of followers and followings.我想获取 instagram 用户分析,即获取包含关注者和关注者数量的时间表。 Is there any way to get the data from instagram api?有没有办法从instagram api获取数据? Or Is there other sites that I can get the analytics automatically with PHP?或者是否有其他网站可以使用 PHP 自动获取分析?

No analytics API from Instagram yet.尚无来自 Instagram 的分析 API。 we have to search users by user id.我们必须按用户 ID 搜索用户。

https://www.instagram.com/developer/endpoints/users/#get_users https://www.instagram.com/developer/endpoints/users/#get_users

In the api response the user json contains "counts" for followers, following and medias.在 api 响应中,用户 json 包含关注者、关注者和媒体的“计数”。

If you just has usernames with you then first search the users from user name by https://www.instagram.com/developer/endpoints/users/#get_users_search ;如果您只有用户名,则首先通过https://www.instagram.com/developer/endpoints/users/#get_users_search从用户名中搜索用户; get ids from them and use above API.从他们那里获取 ids 并使用上面的 API。

To generate the trend;产生趋势; we have to make the API calls daily, for all users!我们必须每天为所有用户调用 API! very costly, but there is no direct API available from Insta yet.非常昂贵,但 Insta 还没有直接可用的 API。

However, FB just released new API for user insights under graph api.不过,FB 刚刚在图 api 下发布了用于用户洞察的新 API。

https://developers.facebook.com/docs/instagram-api/reference/user#insights this works only for instagram business accounts though. https://developers.facebook.com/docs/instagram-api/reference/user#insights但这仅适用于 instagram 商业帐户。 and you need the access tokens on behalf of the account you want insights for.并且您需要代表您想要洞察力的帐户的访问令牌。

As of 2019-06 you can only access analytics (they call it insights at FB) for your own profile.截至 2019 年 6 月,您只能访问自己的个人资料的分析(他们在 FB 称之为洞察)。 You can't access insights of other user profile.您无法访问其他用户个人资料的见解。

For example, let's get your own followers_count .例如,让我们得到你自己的follows_count

graph.facebook.com
  /{your_facebookPage_id}/insights?metric=followers_count&period=day

You get this JSON as response:你得到这个 JSON 作为响应:

{
  "insights": {
    "data": [
      {
        "name": "follower_count",
        "period": "day",
        "values": [
          {
            "value": 2,
            "end_time": "2019-06-24T07:00:00+0000"
          },
          {
            "value": 0,
            "end_time": "2019-06-25T07:00:00+0000"
          }
        ],
        "title": "Follower Count",
        "description": "Total number of unique accounts following this profile",
        "id": "{your_facebookPage_id}/insights/follower_count/day"
      }
    ],
    "paging": {
      "previous": "https://graph.facebook.com/v3.3/{your_facebookPage_id}/insights?access_token=...&pretty=0&metric=follower_count&period=day&since=1561115213&until=1561288013",
      "next": "https://graph.facebook.com/v3.3/{your_facebookPage_id}/insights?access_token=...&pretty=0&metric=follower_count&period=day&since=1561460815&until=1561633615"
    }
  },
  "id": "{your_facebookPage_id}"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM