从 url 获取 Instagram post 的 Facebook 媒体 ID

Get Facebook Media-id for instagram post from url

如果我有一个 instagram post 是否可以获取 instagram post 的 facebook id?需要明确的是,如果我要查看 https://www.instagram.com/p/Bcqn51ynrd5/,我可以通过执行以下两项操作之一找到 instagram media-id:

然而,这些都不是与 facebook 的新 instagram graph insights 关联的媒体 ID。如果我已经有了 facebook media-id,我可以通过调用 graph.facebook.com/{facebook-media-id}?fields=ig_id 通过 facebook graph 获取 instagram media-id 但我无法找到相反的。这可能吗?

我认为这是不可能的。它在 Insights API 文档中被列为限制。

列出当前限制:

  • We only store 2 years worth of metrics data.
  • You can only get insights for a single Instagram Business account at a time.
  • You cannot get insights for Facebook Pages.
  • Stories insights are only available for 24 hours, even if the stories are archived or highlighted. If you want to get the latest insights for a story before it expires, set up a Webhook for the Instagram topic and subscribe to the story_insights field.

致电graph.facebook.com/{instagram-business-account-id}/media?fields=ig_id

其中 returns Facebook 和 Instagram 媒体 ID 列表:

{
  "data": [
    {
      "ig_id": "1729885037886968354",
      "id": "16961190105043123"
    },
    {
      "ig_id": "1714698694055731973",
      "id": "16949739045077321"
    }
    ...

然后找到相应的 Facebook 媒体 ID,您可以获得洞察力。

此外,在 graph.facebook.com/{instagram-business-account-id}/media?fields=shortcode 中使用 shortcode 字段而不是 ig_id 并遍历列表直接搜索短代码,因此您可以跳过 "finding Instagram media-id by short code" 步骤。