Supporting tiktok urls for onebox

Anyone from Discourse know what it might take to allow for embedding of tiktok videos via onebox? It continues to grow as people look to find ways to escape a bit duringthe crisis

3 Likes

try to add www.tiktok.com in the white list of onebox parameters

3 Likes

No need to whitelist - that setting is just for “inline oneboxes”. You can already onebox tiktok content by pasting it on a line by itself. Unfortunately they don’t provide an og:video value, so it’s just a link, thumbnail and description.

8 Likes

Result on my discourse:

2 Likes

Thx. I guess I was referring to embedding video like youtube. So that would require tiktok to make a change?

Yes either they make a change or we write a custom tiktok plugin.

There is some precedence in the plugin route, I know twitter expand them nicely.

3 Likes

Their embed is kinda on the heavy side.

So maybe we go on an approach similar to Instagram, where we build our own thing?

Just media (we can add some metadata):

Embed:

7 Likes

Just media + some metadata looks right to me. This embed does not stop flashing after it plays and is super noisy.

12 Likes

Oh, looks like we can’t do our own. TikTok, like Instagram, use short-lived URLs so if we use the media directly posts are broken in less than a day (check my post above).

On Instagram this made we gave up on trying to embed videos and we do a fancy link. Since TikTok is just videos, I’m not sure it’s worth the effort if we don’t do a working player like Youtube, Vimeo, etc.

9 Likes

Don’t know if they won’t lock you out, but after hitting https://www.tiktok.com/embed/v2/VIDEO_ID?lang=en-US with curl I get HTML that has the proper video url. You’d just have to parse that out and send it to the front-end to display. Seems pretty easy.

1 Like

The problem is that this URL expires.

Yeah, but you can get it again, even after each page reload (so not a simple embed but a proper custom “widget”)

Making a topic page block waiting for TikTok servers ?

At this point it makes more sense to use their official oEmbed with iframes.

Why block? Make it work the same as their embed, but without the extra fluff that’s not needed. Multiple requests have to be made to get it to work anyway, I’d reckon this way will work faster than the official one that loads a full-blown React app.

I’d be more than happy to create a PoC plugin for this ;p

Please do and share with the community!

5 Likes

Tiktok support oembed:

2 Likes

Is this still not working? See above.

1 Like

We can’t created a custom embed because TikTok uses expiring URLs for their media.

Our only option is using their Embed, which

At this point the options are:

  • We cave in and enable their embed into core

  • Someone who cares about TikTok enough creates or sponsors a plugin that add TikTok embed support.

Any of the options are technically simple as we will just use their iframe.

5 Likes

As the outcome only affects communities with TikTok links posted, I would rather prefer to have it in the core via iFrame, as compared to the current 100% defunct way.

1 Like

@sam what about doing the iframe embed only when an admin adds the tiktok domain to their iframe site setting ?

1 Like