07-08-2024, 07:18 AM
Since Twitter seemingly has no interest in fixing it I looked at the whole having to change x.com to twitter.com and it's a common problem across other things like Reddit, WordPress and Discord and their embeds too.
I'm apparently too dumb to figure out regular expressions but I think that's the way I could strip x.com urls of the stuff after the x.com and attach it to a twitter.com url before running through the embed script. Essentially what I need to do is take (using a tweet I posted in Other Forums thread) this:
https://x.com/saoirsedream/status/1808992716925383133
and somehow grab the "saoirsedream/status/1808992716925383133" stuff which the forum will do if I understand regular expressions correctly because it currently just grabs the entire url between the bbcode tags but other users on mybb forums have done similar things like automatically adding partner codes or whatever to Amazon links. The current regular expression is "(*.?)" which is apparently anything and how like bold tags work just passing through whatever was between them but the tweet code only does anything with a proper url.
Then I can just change the embed code to "https://twitter.com/$1" ($1 is the automatic variable the forum creates from the regular expression) and it will work. If I can figure this out then even if you inserted the link as https://twitter.com/saoirsedream/status/1808992716925383133 it would still work, since it'd just strip and then readd the same thing, so none of the old embeds would break.
If you understand anything I'm saying here there's a like in it for you if you can show me how not to be an idiot. Trying to do a simple search just led me to some rabbit hole of dudes trying to regex any possible URL anyone could ever post or whatever the hell this is and I just want to swap the domain names between two (2) possibilities!
The other method I thought of just having a script replace x.com with twitter.com on the forum seems like it'd be way more complicated and if Elon ever personally fixes this it would break everything again.
I'm apparently too dumb to figure out regular expressions but I think that's the way I could strip x.com urls of the stuff after the x.com and attach it to a twitter.com url before running through the embed script. Essentially what I need to do is take (using a tweet I posted in Other Forums thread) this:
https://x.com/saoirsedream/status/1808992716925383133
and somehow grab the "saoirsedream/status/1808992716925383133" stuff which the forum will do if I understand regular expressions correctly because it currently just grabs the entire url between the bbcode tags but other users on mybb forums have done similar things like automatically adding partner codes or whatever to Amazon links. The current regular expression is "(*.?)" which is apparently anything and how like bold tags work just passing through whatever was between them but the tweet code only does anything with a proper url.
Then I can just change the embed code to "https://twitter.com/$1" ($1 is the automatic variable the forum creates from the regular expression) and it will work. If I can figure this out then even if you inserted the link as https://twitter.com/saoirsedream/status/1808992716925383133 it would still work, since it'd just strip and then readd the same thing, so none of the old embeds would break.
If you understand anything I'm saying here there's a like in it for you if you can show me how not to be an idiot. Trying to do a simple search just led me to some rabbit hole of dudes trying to regex any possible URL anyone could ever post or whatever the hell this is and I just want to swap the domain names between two (2) possibilities!
The other method I thought of just having a script replace x.com with twitter.com on the forum seems like it'd be way more complicated and if Elon ever personally fixes this it would break everything again.
1 user liked this post: