# Instagram oneboxing

**URL:** https://meta.discourse.org/t/instagram-oneboxing/69099
**Category:** Feature
**Created:** [2017年八月30日 21:06 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099 "2017-08-30T21:06:12Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2019年三月14日 06:25 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/88 "2019-03-14T06:25:16Z")

</div>

@Roman can you add investigating this to your list (once you free us from other work)

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [2019年四月11日 15:50 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/89 "2019-04-11T15:50:10Z")

</div>

Just pushed a fix:

[https://github.com/discourse/onebox/commit/912d579ae3b1331f6dedcc9724e6c9ed0ddb289f](https://github.com/discourse/onebox/commit/912d579ae3b1331f6dedcc9724e6c9ed0ddb289f)

Will bump onebox version in discourse soon.

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [2019年四月12日 16:59 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/91 "2019-04-12T16:59:09Z")

</div>

`https://www.instagram.com/bennyblood24/p/BvRvyluBbwU`

The fix is now live on meta:

[https://www.instagram.com/bennyblood24/p/BvRvyluBbwU](https://www.instagram.com/bennyblood24/p/BvRvyluBbwU)

---

<div class="post-metadata">

### Author: ![Krischan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/krischan/32/47290_2.png) [@Krischan](https://meta.discourse.org/u/Krischan)
#### Post date: [2019年四月29日 05:38 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/92 "2019-04-29T05:38:55Z")

</div>

Hi Sam, is Instagram oneboxing broken? Test:

[https://www.instagram.com/p/BwrDFZ8AbBy/?utm\_source=ig\_web\_button\_share\_sheet](https://www.instagram.com/p/BwrDFZ8AbBy/?utm_source=ig_web_button_share_sheet)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年四月29日 06:45 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/93 "2019-04-29T06:45:49Z")

</div>

You wrote

`https://www.instagram.com/p/BwrDFZ8AbBy/?utm_source=ig_web_button_share_sheet`

But let’s see

`https://www.instagram.com/p/BwrDFZ8AbBy/`

[https://www.instagram.com/p/BwrDFZ8AbBy/](https://www.instagram.com/p/BwrDFZ8AbBy/)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2019年四月30日 07:08 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/94 "2019-04-30T07:08:28Z")

</div>

@Roman Looks like updated regex for username broke the regular Instagram links. Can you fix?

---

<div class="post-metadata">

### Author: ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)
#### Post date: [2019年四月30日 13:40 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/96 "2019-04-30T13:40:41Z")

</div>

I relaxed the regexp a little bit and added an additional test to cover both cases.

`https://www.instagram.com/p/BwieEVwgYZq/`

[https://www.instagram.com/p/BwieEVwgYZq/](https://www.instagram.com/p/BwieEVwgYZq/)

`https://www.instagram.com/meowed/p/Bw1WjpcDXRU/`

[https://www.instagram.com/meowed/p/Bw1WjpcDXRU/](https://www.instagram.com/meowed/p/Bw1WjpcDXRU/)

---

<div class="post-metadata">

### Author: ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)
#### Post date: [2019年八月15日 17:19 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/98 "2019-08-15T17:19:40Z")

</div>

跟进一下，我注意到我们网站上的 Instagram 嵌入卡片（oneboxes）已损坏……

> [@techAPJ](#):
>
> 我会让 Instagram 的图片和视频 URL 被视为相同，并显示视频预览图而不是 mp4 视频。由于我们本地下载嵌入卡片图片，图片将保持可用。例如，上面 @codinghorror 发布的 Instagram 视频链接的预览图将是：

这是否意味着 Instagram 嵌入卡片的预览图将不再损坏？如果是这样，目前对我们来说似乎并未生效。这可能仅针对视频帖子（我不确定，因为我们网站上几乎所有的示例都是视频）。

例如，我们网站上的这条帖子（仅几周前发布）：[Forearm rotation clip on this blog? - #4 by Troy - Playing Technique - The Cracking the Code Forum](https://forum.troygrady.com/t/forearm-rotation-clip-on-this-blog/18371/4?u=brendan)

其他几条帖子也是如此。重建帖子_确实_可以修复，例如重建后显示如下：[Black star lick HELP ME - #8 by Troy - Playing Technique - The Cracking the Code Forum](https://forum.troygrady.com/t/black-star-lick-help-me/10934/8?u=brendan)

我看到本主题中上方的一些视频嵌入仍然有效，所以不确定是否还有其他变量导致这仅针对某些账户发生。

如果这是 Instagram 的有意行为且没有简单的解决方法，那么以下建议很好：

> [@Richie](#):
>
> 如果不完全了解 Instagram 如何通过其 CDN 构建嵌入式媒体 URL，Discourse 能否自动更新这些签名？

基本上——每天或每周运行一次作业（不确定 Instagram 嵌入的过期时间具体多长），匹配 `https://www.instagram.com/p/` 模式，运行 [https://meta.discourse.org/t/rebake-all-posts-matching-a-pattern/48713，我认为这就能解决问题。](https://meta.discourse.org/t/rebake-all-posts-matching-a-pattern/48713%EF%BC%8C%E6%88%91%E8%AE%A4%E4%B8%BA%E8%BF%99%E5%B0%B1%E8%83%BD%E8%A7%A3%E5%86%B3%E9%97%AE%E9%A2%98%E3%80%82)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年八月15日 20:59 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/99 "2019-08-15T20:59:45Z")

</div>

应该只涉及更早期的帖子，而不是反复出现的问题。因此，一次全局重新烘焙即可解决所有问题。

---

<div class="post-metadata">

### Author: ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)
#### Post date: [2019年八月15日 21:05 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/100 "2019-08-15T21:05:47Z")

</div>

没错，我一开始也是这么想的。大约一两个月前，我对所有包含 Instagram 链接的帖子重新生成了预览图，本以为能永久解决这个问题。

但即使是最近的帖子（例如：[帖子一](https://forum.troygrady.com/t/chunking-question/10941/8?u=brendan)、[帖子二](https://forum.troygrady.com/t/forearm-rotation-clip-on-this-blog/18371/4?u=brendan)、[帖子三](https://forum.troygrady.com/t/the-amazing-wim-den-herder/10705/2?u=brendan)）现在又出现了预览图损坏的问题。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年八月15日 21:11 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/101 "2019-08-15T21:11:32Z")

</div>

嗯，也许 @techAPJ 可以看一下。

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2019年八月20日 04:26 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/102 "2019-08-20T04:26:49Z")

</div>

嘿，Brendan，你能确认一下你的网站上是否启用了“下载远程图片到本地”的设置吗？另外，请确保你的服务器满足“下载远程图片阈值”的要求，即你的服务器是否拥有所需的最小磁盘空间百分比？

---

<div class="post-metadata">

### Author: ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)
#### Post date: [2019年八月20日 16:40 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/103 "2019-08-20T16:40:43Z")

</div>

服务器有空间，但看起来我们之前_没有_启用该设置。我现在就开启它，并重新运行 rebake。感谢这里的帮助！

---

<div class="post-metadata">

### Author: ![bts](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bts/32/184556_2.png) [@bts](https://meta.discourse.org/u/bts)
#### Post date: [2019年十月16日 22:45 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/104 "2019-10-16T22:45:29Z")

</div>

跟进一下，我发现即使启用了“将远程图片下载到本地”（磁盘空间充足）并重新生成后，Instagram 的一键预览图片仍然无法显示。

编辑：啊，写着写着我想明白是怎么回事了。

较新的 Instagram 帖子确实使用了我们域名的正确图片 URL，而较旧的帖子仍然使用的是即将过期的 Instagram 链接。当我对所有旧嵌入内容执行重新生成时，我没有意识到站点设置“下载远程图片的最大天数”（默认为 30 天）对此进行了限制。

于是我将该设置改为 `9999` 并再次执行重新生成，现在似乎正常了！（留下这篇“橡皮鸭调试”帖子，以防这能帮到其他人……）

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [2019年十月16日 23:44 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/105 "2019-10-16T23:44:06Z")

</div>

Instagram 单框预览不支持视频播放功能，也无法单独展示或滑动浏览相册图片。而 Twitter 单框预览同时具备这两项功能。或许可以对这些功能进行改进。

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年十月16日 23:51 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/106 "2019-10-16T23:51:30Z")

</div>

由于 Instagram 的政策限制，这不可行。Instagram 归 Facebook 所有，而他们在这一类问题上非常不讲道理。

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [2019年十月17日 00:15 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/107 "2019-10-17T00:15:22Z")

</div>

我不知道这个。谢谢。

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [2019年十一月23日 09:53 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/109 "2019-11-23T09:53:25Z")

</div>

Instagram 单条卡片显示似乎出问题了？

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年十一月23日 19:03 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/110 "2019-11-23T19:03:30Z")

</div>

让我们看看

[https://www.instagram.com/p/B4htRUfBJ7e/?hl=en](https://www.instagram.com/p/B4htRUfBJ7e/?hl=en)

在我看来没问题？

---

<div class="post-metadata">

### Author: ![Dmitry\_Krasnoperov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_krasnoperov/32/65079_2.png) [@Dmitry\_Krasnoperov](https://meta.discourse.org/u/Dmitry_Krasnoperov)
#### Post date: [2019年十一月29日 22:26 UTC](https://meta.discourse.org/t/instagram-oneboxing/69099/111 "2019-11-29T22:26:24Z")

</div>

[https://www.instagram.com/p/B5dTSIoJ\_Fn/](https://www.instagram.com/p/B5dTSIoJ_Fn/)

我尝试使用时无法正常工作。

[上一頁](https://meta.discourse.org/t/instagram-oneboxing/69099.md?page=4)

[下一頁](https://meta.discourse.org/t/instagram-oneboxing/69099.md?page=6)
