Yeah was talking with Cheese about this too.
With the YouTube and Twitter embeds it's a simple pattern of putting in the video identifier in a standard set of HTML (for YouTube) or the tweet identifier in a specific place and some Twitter provided Javascript automagically replaces that with the full HTML to display the content.
The embed example you posted has the content already in that info which is the content I need to get since I don't already have.
Plus a Bluesky link actually has the user profile in the URL too (i.e.
https://bsky.app/profile/seanmcarrol.../3layjfivwxs2n) so I need TWO pieces of information to identify a post, the unique identifier and the profile of who posted it.
But that's not the real problem, I can make the code require the whole URL instead of the ID like the youtube or twitter codes.
Looking at their documentation there is a way to get the HTML needed to show a post:
https://docs.bsky.app/docs/advanced-guides/oembed
Unfortunately that doesn't really work easily in the same way the YouTube or Twitter where I can just say "when someone uses this BBCode just replace that with this HTML template".
With the oembed what it looks like I'd need to do is the forum would have to reach out to the bluesky oembed API and get the full data for a given post, extract the HTML from that response, then put that HTML on the page before it gets sent to the user.
This is problematic for a number of reasons. Not the last of which is that it requires server side processing of ALL Bluesky links to get the HTML, on every single pageview, for every single embeded Bluesky post. Plus I'd probably get banned from the API if I did that, it's probably expected of me to cache the HTML responses for a given amount of time.
The YouTube and Twitter embeds don't have to do that because for YouTube the embed HTML is the same every single time, only the identifier changes. For Twitter the reaching out to the Twitter API to get the HTML happens after the page is sent from our server to the user's browser by Javascript that runs in the user's browser.
It's not impossible, but it's also not trivial to add unfortunately from what I can see.
I see a few different ways forward.
1) Write an extension to the forum software that gets the HTML for Bluesky posts and stores them in a database. High complexity, lots of effort.
2) Write some Javascript that would recognize a specific HTML output in the forum pages and reach out to the oEmbed API, get the HTML, and replace it on the page in the same fashion as the Twitter API. More straight forward, but I don't know Javascript and not sure how easy/hard this would be to make that's well supported by all browsers.
3) Kind of taking a different angle on it is something I thought about when doing the Twitter one too.. have a service that accepts the URL to a Bluesky post and returns an IMAGE of that post. That way embedding is simple and is not dependent on the browser OR the forum software. This is probably even more complicated (you have to render the website in code on a server, create an image, create a cache so you don't re-render the same ones over and over, etc) but it's something I understand better.
The thing is there might already be some variation of 2 or 3 already out there but I haven't been able to find it.
Or there might not be since discussion forums like this are a dying breed.