instagram-api - Instagram 图 API : Convert ig_id to id - Migrating from Instagram API => Graph API

标签 instagram-api instagram-graph-api

我正在尝试将自定义报告平台从 Instagram 的旧 API 迁移到新的 Graph API ( https://developers.facebook.com/docs/instagram-api/reference/media/#metadata )

我有一个数据库,它存储了几年用于报告目的的帖子数据,它以旧格式 xxxxxxxxxxxxxxxxxx_yyyyyyyy 保存帖子的 ID。 .

新的 Graph API 返回两个 ID idig_id . ig_id与上面原始 ID 的 x 部分有关。新的 Graph API 不允许您通过 ig_id 查询媒体。 ,只有 id,所以我的问题是 - 有没有办法转换 ig_idid或检索 id来自 ig_id ?

最佳答案

不幸的是,我不相信有直接的方法可以从旧 ID 转到新 ID。我这样做的方法是获取媒体的完整列表,然后遍历该列表以匹配旧 ID。我想你已经知道了,但我会写出来以防其他人发现这篇文章并想要更多细节。

如果你去here ,第 6 步,您将看到端点检索指定业务帐户的所有媒体对象。网址是:

https://graph.facebook.com/v4.0/business-id-here/media?access_token=access-token-here

这将返回新图形 api 的 id 列表。

此时,您需要拉取每个媒体对象的详细信息。文档是 here .终点是:

https://graph.facebook.com/v4.0/media-id-here?access_token=access-token-here&fields=caption,children,comments,id,ig_id,media_type,media_url,owner,permalink,shortcode,thumbnail_url,timestamp,username

这将为您提供可以匹配的旧 ID 和新 ID。

关于instagram-api - Instagram 图 API : Convert ig_id to id - Migrating from Instagram API => Graph API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55944756/

相关文章:

php - 在没有任何钩子(Hook)的情况下使用 wp_set_auth_cookie

facebook-graph-api - Instagram 图谱 API

facebook-graph-api - Instagram 基本 API : Is it possible to get the media_url from "CAROUSEL_ALBUM" in one query?

python - Instagram Graph API - 发布图像

facebook - 使用 Instagram 图形 API 连接 Instagram 的新功能

ios - 无效的签名请求 : Missing required parameter

python - 类 InstagramSpider(scrapy.Spider) : AttributeError: 'module' object has no attribute 'Spider'

instagram - 给定 user_id,如何找到用户名?

ios - 使用 AssetPath 创建 NSURL

python - 如何从 Python 中的 InstagramAPI 开始?