为Instagram oneboxes配置应用程序令牌

我也遇到了同样的情况,我不知道该怎么办。

https://www.instagram.com/p/CIRhYzFM7Lu

它不包含吗?

好吧,我做了一切,或者这个帖子发送了什么,但链接没有包含!

在我的论坛和这里

我希望能够在我的论坛上看到 Instagram 和 TikTok 的视频和照片。
有人知道我该怎么做吗?我也愿意为此付费。

向我们解释您如何使用此权限或此功能
instagram_graph_user_profile 权限使您的应用能够从用户那里读取用户配置文件。此权限必须用于读取 Instagram 用户配置文件的字段(例如,用户 ID 或帐户类型)。您可以使用此权限读取“用户”节点(代表 Instagram 用户)及其周边信息。您也可以使用此权限来请求广告、营销或通过使用非识别性或匿名汇总数据来增强您的应用程序的见解和分析(前提是此类数据不能被去匿名化)。

Facebook 要求我录制视频。

Instagram 嵌入内容是否已损坏?以前是可以的,但在过去几天里,Instagram 链接不再嵌入。

我无法看到 oEmbed 应用。取而代之的是“Instagram Basic Display”。

这和那个是一样的吗?我的 Facebook 应用暂时被暂停了(说来话长),所以我目前无法对其进行操作以找出答案。

稍后…

我注意到来自 https://developers.facebook.com/docs/features-reference/oembed-read 的内容

image

1 个赞

我的嵌入又坏了。将检查我的开发者控制台,看看是否有任何明显的问题(即使有,我也可能会错过!)。

嗯,我没错过!:

我不知道这是否能修复损坏的嵌入内容,但我还是完成了这些步骤。

我已超过 2024 年 1 月 11 日的截止日期,希望仍然可以。

这些步骤相当简单,我只需要勾选大约 4 个复选框,以确认遵守各种事项(我过去已经确认过,而且由于我的网站没有任何变化,我相信一切都会没事的)。

现在我只需要等待一两天确认。

1 个赞

大家好,我们最近决定允许用户嵌入 Instagram 链接。我们按照此帖中的说明操作 → 在 Meta 中创建了一个应用 → 获取了一个令牌 → 将其添加到 Discourse OneBox。一切顺利,但 Instagram 帖子没有显示出来。

我注意到 Discourse 没有正确地将 Instagram 链接转换为 iframe,然后在使用此 iframe 显示时什么也没有发生。

例如,链接:

https:/www.instagram.com/p/DNuo51_XP5L/

被转换为此 iframe:

<iframe width="" height="98" frameborder="0" data-unsanitized-src="https:/www.instagram.com/p/DNuo51_XP5L/embed" seamless="seamless" sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation"></iframe>

在使用 iframe 显示时,什么也没有发生,只有一个空白的矩形。

为了解决这个问题,我编写了以下代码并将其作为自定义 JS 组件插入:

import { apiInitializer } from "discourse/lib/api";

export default apiInitializer(api => {
  api.decorateCooked(($cooked) => {
    $cooked[0].querySelectorAll('iframe[data-unsanitized-src]').forEach((f) => {
      const u = f.getAttribute("data-unsanitized-src");
      if (!u) return;

      const fixed = u.replace(/^https:\//, "https://");
      let host = "";
      try { host = new URL(fixed).hostname; } catch (e) {}

      if (host === "www.instagram.com" || host === "instagram.com") {
        const permalink = fixed.replace(/\/embed\/?$/, "/");
        const blockquote = document.createElement("blockquote");
        blockquote.className = "instagram-media";
        blockquote.setAttribute("data-instgrm-permalink", permalink);
        blockquote.setAttribute("data-instgrm-version", "14");

        f.replaceWith(blockquote);

        if (!document.querySelector('script[src*="www.instagram.com/embed.js"]')) {
          const s = document.createElement("script");
          s.async = true;
          s.src = "//www.instagram.com/embed.js";
          document.body.appendChild(s);
        } else if (window.instgrm && window.instgrm.Embeds) {
          window.instgrm.Embeds.process();
        }
      }
    });
  }, { id: "instagram-iframe-to-blockquote" });
});

之后,所有 Instagram 嵌入内容都开始按预期显示。此代码将损坏的 iframe 转换为 <blockquote>

希望这段代码对大家有用。

3 个赞