如何从instagram实时发布数据获取实际照片?

时间:2021-07-27 15:31:21

I subscribed to the #tattoo tag with instagram's real-time api and it's working fine, the problem is that I have no idea how to get the actual uploaded image when the post data looks like this:

我使用Instagram的实时api订阅#tattoo标签并且它工作正常,问题是当帖子数据看起来像这样时,我不知道如何获取实际上传的图像:

[{"changed_aspect": "media", "subscription_id": XXXXXX, "object": "tag", "object_i
d": "tattoo", "time": 1334521880}]

It doesn't give me any info about the media_id or something like that, am I missing something?

它没有给我任何关于media_id或类似的东西的信息,我错过了什么吗?

1 个解决方案

#1


17  

As noted in their realtime API docs:

正如他们的实时API文档中所述:

The changed data is not included in the payload, so it is up to you how you'd like to fetch the new data. For example, you may decide only to fetch new data for specific users, or after a certain number of photos have been posted.

更改的数据不包含在有效负载中,因此您需要如何获取新数据。例如,您可能决定仅为特定用户获取新数据,或者在发布一定数量的照片后。

So it sounds like you just have to get the actual data via their regular tag API, apparently using GET /tags/{tag-name}/media/recent. For you:

所以听起来你只需通过常规标签API获取实际数据,显然是使用GET / tags / {tag-name} / media / recent。为你:

https://api.instagram.com/v1/tags/tattoo/media/recent?access_token=ACCESS-TOKEN

This does certainly seem inelegant, since you'll have to sort out which of the recent updates you've already seen, but I don't see anything suggesting a better method.

这确实看起来不那么优雅,因为你必须弄清楚你已经看过哪些最近的更新,但我没有看到任何暗示更好的方法。

#1


17  

As noted in their realtime API docs:

正如他们的实时API文档中所述:

The changed data is not included in the payload, so it is up to you how you'd like to fetch the new data. For example, you may decide only to fetch new data for specific users, or after a certain number of photos have been posted.

更改的数据不包含在有效负载中,因此您需要如何获取新数据。例如,您可能决定仅为特定用户获取新数据,或者在发布一定数量的照片后。

So it sounds like you just have to get the actual data via their regular tag API, apparently using GET /tags/{tag-name}/media/recent. For you:

所以听起来你只需通过常规标签API获取实际数据,显然是使用GET / tags / {tag-name} / media / recent。为你:

https://api.instagram.com/v1/tags/tattoo/media/recent?access_token=ACCESS-TOKEN

This does certainly seem inelegant, since you'll have to sort out which of the recent updates you've already seen, but I don't see anything suggesting a better method.

这确实看起来不那么优雅,因为你必须弄清楚你已经看过哪些最近的更新,但我没有看到任何暗示更好的方法。