Instagram oneboxing

(Arpit Jalan) #48

Width is calculated in CSS via:

PR welcome for any improvements here. :slight_smile:

(eiklid) #49

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?

(Kris) #50

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

(Jeff Atwood) #51

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

(Arpit Jalan) #52

Fixed via:

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

(Colin Marshall) #53

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.

(Jeff Atwood) #54

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

(Colin Marshall) #55

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:

(Jeff Atwood) #56

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

(Colin Marshall) #57

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.

(Richie Rich) #58

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:

(Jeff Atwood) #59

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.

(Richie Rich) #60

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?


Amen to that my brother :+1:

We might be chasing our tails forever :slightly_frowning_face:

(Jeff Atwood) #61

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

See if this video keeps working.

(Jeff Atwood) #62

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

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


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

(Richie Rich) #63

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:

(Kris) #64

Looks like Instagram is expiring links as suspected

If you visit the source file

URL signature expired

Related info

(Richie Rich) #65


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:

(Richie Rich) #66

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:

(Mittineague) #67

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.