Topic on Extension talk:Widgets/archive 2

Michael Z Freeman (talkcontribs)
Yaron Koren (talkcontribs)

Amazingly, it looks like there's no standard widget yet for displaying a tweet, er, X post. (I think that text is there just to display something before the tweet finishes loading, by the way - the API is being accessed.) You could create the widget yourself, potentially...

Michael Z Freeman (talkcontribs)

"I think that text is there just to display something before the tweet finishes loading, by the way - the API is being accessed."

Ah, really ? Right. I’ll go back to trying this again.

So actually consulting the X API using https://publish.twitter.com/oembed?url=https://twitter.com/Michael86084836/status/1798253963143528714 gives ...

{"url":"https:\/\/twitter.com\/Michael86084836\/status\/1798253963143528714","author_name":"Michael Freeman","author_url":"https:\/\/twitter.com\/Michael86084836","html":"\u003Cblockquote class=\"twitter-tweet\"\u003E\u003Cp lang=\"en\" dir=\"ltr\"\u003E“We are awake to their woke"\u003Ca href=\"https:\/\/t.co\/5dRMkPd32a\"\u003Ehttps:\/\/t.co\/5dRMkPd32a\u003C\/a\u003E\u003C\/p\u003E— Michael Freeman (@Michael86084836) \u003Ca href=\"https:\/\/twitter.com\/Michael86084836\/status\/1798253963143528714?ref_src=twsrc%5Etfw\"\u003EJune 5, 2024\u003C\/a\u003E\u003C\/blockquote\u003E\n\u003Cscript async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"\u003E\u003C\/script\u003E\n\n","width":550,"height":null,"type":"rich","cache_age":"3153600000","provider_name":"Twitter","provider_url":"https:\/\/twitter.com","version":"1.0"}

Can I parse this, I think it’s JSON ? Does anyone know a widget example ?

Yaron Koren (talkcontribs)

Why parse it - why not just create a widget that displays the necessary HTML?

Michael Z Freeman (talkcontribs)

Sorry, having real problems getting started here. Can you give me a few clues as to what I need to look at ?

Michael Z Freeman (talkcontribs)

Could I filter that X response with something live "regex_replace:"#^(?!(https?:)?//).*#I":’' ? That’s taken from the iFrame widget.

Yaron Koren (talkcontribs)

Sorry for the delay. Actually, there is a Tweet widget - and it seems to still work fine, even though it was pre-name change. Have you tried it?

Reply to "Twitter/X Widget ?"