Skip to content

Add x.com URL support and update Twitter provider endpoint#136

Open
philltran wants to merge 1 commit into
leedo:masterfrom
philltran:x-com-support
Open

Add x.com URL support and update Twitter provider endpoint#136
philltran wants to merge 1 commit into
leedo:masterfrom
philltran:x-com-support

Conversation

@philltran

Copy link
Copy Markdown

Twitter rebranded to X and the primary domain for post URLs is now x.com.
The existing provider only matched twitter.com URLs and proxied to the legacy
publish.twitter.com endpoint, so x.com/... post URLs returned no embed.

Changes (lib/Noembed/Provider/Twitter.pm)

Testing

# x.com — now matches                                                                                                                                                                                                                
curl "http://localhost:5000/embed?url=https://x.com/<user>/status/<id>"                                                                                                                                                              
# twitter.com — still works                                                                                                                                                                                                          
curl "http://localhost:5000/embed?url=https://twitter.com/<user>/status/<id>"                                                                                                                                                        
# mobile variants                                                                                                                                                                                                                    
curl "http://localhost:5000/embed?url=https://mobile.x.com/<user>/status/<id>"                                                                                                                                                       
curl "http://localhost:5000/embed?url=https://mobile.twitter.com/<user>/status/<id>"                                                                                                                                                 
                                                                                                                                                                                                                                     
Expected: 200 JSON with provider_name: "X (formerly Twitter)" and an html                                                                                                                                                            
field containing a <blockquote> embed.                                     

- Extend patterns to match both twitter.com and x.com post URLs
- Normalize x.com URLs to twitter.com before proxying (publish.x.com/oembed
  is unreliable for x.com-domain input; workaround used by WordPress, Umbraco,
  Ghost, and Rocket.Chat)
- Update oEmbed endpoint to canonical https://publish.x.com/oembed
- Rename provider to "X (formerly Twitter)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant