Skip to main content
[ADDON] OEmbed Started by forumsearch0r2 · · Read 15200 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

[ADDON] OEmbed

'member oEmbed? I 'member!

This is version 1.0.6 which is the forumsearch0r version of "0.0.7 pre-alpha". It works but it could be more beautiful.

Obligatory add-on screenshot:



OEmbed Support

This ElkArte add-on is released under the terms of the WTFPL. Take it and do with it what the gently caress you want.
Parts of this add-on (mostly, the idea and the regular expressions) were ported from my blog software which is also licensed under the same terms.

Makes ElkArte support OEmbed, duh. Note that additional CSS is not a part of this add-on, but (e.g.) YouTube provides their own embedded stylesheets.

This add-on won't do anything unless your PHP installation has the curl extension enabled.  By default, only JSON OEmbeds are recognized. If the xml extension is available, XML OEmbeds will be respected as well.

In case you absolutely want to make me richer, you can donate some money: PayPal.

Maybe I'll find out how Twitter's CSS can be fetched automatically or something.  ::)

Source code for the curious ones. Pull requests are appreciated unless they suck.

Enjoy or don't or whatever.
Last Edit: April 21, 2021, 12:20:03 pm by forumsearch0r2

Re: [ADDON] OEmbed

Reply #1

Change log etc. (will be updated):

version 1.0.1:
It seems like ElkArte supports the URL tag. OEmbed didn't. Now it does.

version 1.0.2:
A $ slipped in. PHP did not care, the code logic did though.

version 1.0.3:
Fixed a PCRE mistake introduced in 1.0.1.

version 1.0.4:
Completed dependency checking.

version 1.0.5:
Fixed the "empty message" error after trying to post a OEmbed-capable link.

version 1.0.6:
Added a cURL timeout flag.
Last Edit: August 12, 2018, 04:36:51 pm by forumsearch0r2

Re: [ADDON] OEmbed

Reply #2

I just tried to install the addon twice. After the installations, I can not call/open the index page of the forum. Neither with link "Forum", nor by clicking on the house icon. Instead, this error message appears: preg_match_all (): Unknown modifier 'g'
What went wrong?
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: [ADDON] OEmbed

Reply #3

Try 1.0.3.

Re: [ADDON] OEmbed

Reply #4

Thank you, now it works!
And thanks for the addon. :)
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: [ADDON] OEmbed

Reply #5

You're welcome!

Re: [ADDON] OEmbed

Reply #6

How to embed Facebook posts? I tried it in different ways, but nothing was successful.
How can I embed such URLs, for example?

Code: [Select]
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: [ADDON] OEmbed

Reply #7

Does Facebook support OEmbed for that in the first place?

Re: [ADDON] OEmbed

Reply #8

I thought Facebook would do that, but apparently that's not the case.
I found this page and thought I just have to insert a simple link, but it's a bigger thing and I don't know if that works in forums anyway.

Which pages officially support OEmbed?
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: [ADDON] OEmbed

Reply #9

Twitter and YouTube were both tested by me, some board software supports it as well (so does WordPress IIRC), otherwise there is no "official" list since anyone can just add OEmbed support to their site if they feel like it.

ElkArte does not, by the way.

Re: [ADDON] OEmbed

Reply #10

Aha, okay.
It works with Instagram as well. Just like with Twitter with the date link.
ElkArte version: 1.1.8 / Theme: BeSocial / PHP 8.0

Re: [ADDON] OEmbed

Reply #12

One issue is that, when i post YouTube link it shows

"The message has the following error or errors that must be corrected before continuing:

        The message body was left empty."

Re: [ADDON] OEmbed

Reply #13

Which video have you tried? So I can reproduce it.