Instagram oneboxing

What a fantastic set of solutions!

People can see now it’s a video at a glance too.

Great work everyone, thanks for the amazingly quick response to this issue too :clap:

11 Likes

Awesome work on this.

My only request is if there is a way to make the onebox mention my Instagram account name a little less?

For me the most important part is the image so I’d appreciate a way to somehow hide at least the “Account Name on Instagram” heading (the instagram.com link leads to the linked page) and perhaps even the caption?

https://www.retrogameboards.com/t/rgb-pick-up-thread-of-swag/224/1744?u=matt

1 Like

This is probably easiest accomplished via a local CSS customization, under Admin, Customize. You could hide or de-size the element through standard CSS.

image

I do agree that the “on Instagram” part is redundant though @techapj… we’re saying it twice, and everyone knows how I feel about needless repeated text :wink:

4 Likes

Fixed in

7 Likes

How about the top instagram.com becomes instagram.com/username? So much neater.

Also “Matt Sephton (@mattsephton) on Instagram” at the start of the caption also feels needlessly repetitive.

As for local CSS, is that per user or globally for a board? Because I’m not admin of any boards.

1 Like

I noticed something about URL parsing. Oneboxing fails and produces just the image if the URL contains the Instagram username.

This won’t work as intended: https://www.instagram.com/bennyblood24/p/Brc6FNRn9vu/

This works: https://www.instagram.com/p/Brc6FNRn9vu/

5 Likes

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

5 Likes

Just pushed a fix:

Will bump onebox version in discourse soon.

8 Likes

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

The fix is now live on meta:

9 Likes

Hi Sam, is Instagram oneboxing broken? Test:

1 Like

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/

3 Likes

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

5 Likes

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/meowed/p/Bw1WjpcDXRU/

12 Likes

Following up here as I’ve noticed broken Instagram oneboxes on our site…

Is this supposed to make it so that the Instagram onebox preview images no longer break? Because if so, it seems that’s not currently working for us. It may be specific to video posts (not sure as pretty much all examples on our site are videos).

See e.g. this post on our site (from just a few weeks ago): Forearm rotation clip on this blog? - Playing Technique - The Cracking the Code Forum

Same with several others. Rebuild does fix, e.g. displays like so after rebuilding the post: Black star lick HELP ME - Playing Technique - The Cracking the Code Forum

I see some video embeds above in this very topic do still work, so not sure if there’s some other variable with this only happening for certain accounts.

If this is an intentional thing from Instagram without an easy workaround, this is a good suggestion:

Basically — a daily / weekly job (not sure how long exactly the Instagram embeds expire) to run Rebake all posts matching a pattern matching https://www.instagram.com/p/ I think would do the trick.

It should only be much older posts, not a recurring thing. So a one time global rebake should fix all.

Right that’s what I thought at first, and I did a rebake on all our posts w/ Instagram links like a month or two back which I thought would fix this permanently.

But even recent posts (examples: one, two, three) now have the broken preview images again.

Hmm maybe @techAPJ could have a look.

1 Like

Hey Brendan, can you verify that the setting download remote images to local is enabled on your site? Also can you make sure that download remote images threshold is satisfied on your server, i.e. your server has required percentage of minimum disk space?

4 Likes

Server has space, but looks like we did not have that setting enabled, I will turn it on now and run the rebake again. Thanks for the help here!

4 Likes

Following up here, I found that after enabling download remote images to local (with plenty of disk space free) and rebaking, the Instagram onebox preview images were still breaking.

EDIT: ahhh as I’m writing this I think I see what’s going on.

Newer Instagram posts did have the correct image URLs from our domain, while older ones still had the expiring Instagram ones. When I did the rebake for all old embeds, I didn’t realize the site setting download remote images max days old (default 30 days) was limiting this.

So I changed that setting to 9999 and did the rebake again, seems to be working now! (Leaving this rubber-ducking post here just in case this helps clarify for anyone else…)

3 Likes