Instagram oneboxing

Width is calculated in CSS via:

https://github.com/discourse/discourse/blob/597330ad1dd813ad0afa0baad68fdd54baac1390/app/assets/stylesheets/common/base/onebox.scss#L167

PR welcome for any improvements here. :slight_smile:

5 Likes

Hey guys, love the new changes to how instagram links are displayed. Only one small thing that’s bugging me. I just posted a list of instagram profiles on my forum and the list looks horrible since the profile pick gets blown up to the size of the posts above. Any fix for this?

2 Likes

Yeah this isn’t great… the preview in the composer doesn’t match what’s posted either. Example link:

So the bug report is that instagram profile links should be handled differently cc @techAPJ

4 Likes

Fixed via:

https://github.com/discourse/onebox/commit/767df71e3087a1b6fb649fda7c548a4953b88323

Instagram profile links will now be oneboxed using generic oneboxer. Demo:

https://www.instagram.com/williamshatner/?hl=en

10 Likes

Is it possible to have the Instagram onebox display the entire text description instead of what it currently does, which is roughly only the first sentence? The regular instagram embed shows the full description.

For an Instagram profile? What are you talking about? Example please?

Sorry, the correct term is “caption” not description. I’m talking about how the entire caption is displayed when you use their embed code. See here:

That’s practically a novella. Maybe behind a “read more…” button perhaps.

1 Like

Ya that was a lengthy example. The main point of the request is so that they don’t have to load another page to read the caption.

I found this thread while searching for a reason as to why any embedded Instagram videos refuse to play after a day or so of being embedded.

Prime example, the video in post # 30 here no longer plays :thinking:

For a more public example, an entire thread of Instagram videos on our Discourse have also stopped working.

Should I raise this as a Discourse bug in a new thread?

Or, and what’s far more likely, is this a known Instagram issue? :thinking:

Instagram, being a part of Facebook, is likely a bunch of jerks – so it wouldn’t surprise me if they use time limited keys for video sharing so they never work forever?

Alternately make sure the correct public URL is used for the videos. I don’t use Instagram myself so I can’t help much.

2 Likes

Hey @codinghorror

We did a few tests on our site in the ‘staff’ area.

If we post the exact same Instagram link (to a single Instagram post) in a new thread, the video plays fine. While playing fine in the new post, it still refuses to play in it’s original post location.

The second test we did was on post editing. We edited a post which had a video that no longer worked. Editing the post somehow made the video playable again!

Would appreciate guidance on if I should post this as a Discourse bug?

But:

Amen to that my brother :+1:

We might be chasing our tails forever :slightly_frowning_face:

1 Like

Not sure. Here’s a public instagram video I found by searching in Google.

See if this video keeps working. https://www.instagram.com/p/BjakLe4HEYf

2 Likes

The above Instagram video seems fine to me, so perhaps it is

  • some issue with the specific video you are trying to link

or

  • the instagram servers have decided your servers are spamming them with requests and have stopped allowing your server to talk to their server

Hi @codinghorror

The video you posted was playing fine, but you appear to have the same problem we do on our instance as three days later your video no longer plays either :frowning_face:

7 Likes

Looks like Instagram is expiring links as suspected

If you visit the source file

https://scontent-sjc3-1.cdninstagram.com/vp/373216f0c59c42208575329e53c848e3/5B818A9E/t50.2886-16/33260336_2012189805707951_8892107981315252491_n.mp4

URL signature expired

Related info

5 Likes

Blimey…

Thanks @awesomerobot for checking this out.

Looking at the SO article it seems there is no viable solution or suitable workaround at the moment :frowning:

1 Like

Without fully understanding how Instagram are constructing the embedded media URLs over their CDN, would it be possible for Discourse to automatically renew those signatures?

Again, editing a post with an Instagram video magically enables it to work again. As does posting the link to the Instagram video in a new post (even in the same thread!) makes it work again.

I don’t know if this helps, or if this is irrelevant :blush:

It would take an answer from an Instagram rep to know for certain, but I can think of two things.

  1. Instagram is cycling off older URLs so that stale links won’t impact resources.
  2. Instagram wants users to be able to share, but not hot-link indefinitely

Having Discourse automatically rebake posts containing Instagram links would impose more work for Discourse. Depending on the reason Instagram has set links up this way, they may not be pleased with Discourse doing this.

I’m thinking that until the reason is known, a better course would be for Discourse to stop oneboxing Instagram links and display them as only links instead. Granted, it would be a loss of a “cool” feature, but better than a broken onebox.

6 Likes