Embed Tweets and Timelines to Website through oEmbed API

Опубликовано: 28 Октябрь 2024
на канале: Tech Forum
3,432
16

#twitter #embedtweets #embedtimeline

Embed Tweets and Timelines to Website through oEmbed API

The tweets and timelines can be embeded into the website in multiple way, the oEmbed API help to embed the dynamic tweets and timlines programatically through tweet id or URL.

Embed Tweet

https://publish.twitter.com/oembed?ur...
https://publish.twitter.com/oembed?url=   / 1358691549505179648  
https://publish.twitter.com/oembed?ur...
https://publish.twitter.com/oembed?ur...

url - The URL of the Tweet to be embedded

Maxwidth - The maximum width of a rendered Tweet in whole pixels.(default 325)

hide_media - When set to true, "t", or 1 links in a Tweet are not expanded to photo, video, or link previews. (default false)

hide_thread - When set to true, "t", or 1 a collapsed version of the previous Tweet in a conversation thread will not be displayed when the requested Tweet is in reply to another Tweet.(default false)

omit_script - When set to true, "t", or 1 the script responsible for loading widgets.js will not be returned. Your webpages should include their own reference to widgets.js (default false)

Align - {left,right,center,none} Specifies whether the embedded Tweet should be floated left, right, or center in the page relative to the parent element. (default none)

Related - A comma-separated list of Twitter usernames related to your content.

Lang - Request returned HTML and a rendered Tweet in the specified Twitter language supported by embedded Tweets.(default en)

Theme - {light, dark} When set to dark, the Tweet is displayed with light text over a dark background. (default light)

widget_type - {video} Set to video to return a Twitter Video embed for the given Tweet.

Dnt - When set to true, the Tweet and its embedded page on your site are not used for purposes that include personalized suggestions and personalized ads(default false)

Returns a single Tweet, specified by either a Tweet web URL or the Tweet ID, in an oEmbed-compatible format

The oEmbed endpoint allows customization of the final appearance of an Embedded Tweet by setting the corresponding properties in HTML markup to be interpreted by Twitter's JavaScript bundled with the HTML response by default.

Embed Timeline

https://publish.twitter.com/oembed?ur...
https://publish.twitter.com/oembed?url=   / national-parks  
https://publish.twitter.com/oembed?ur...
https://publish.twitter.com/oembed?ur...

url - The URL of the Twitter timeline to be embedded

widget_type - Collection timelines only. Set to grid to display Tweets in a grid layout

Limit - Display up to N items where N is a value between 1 and 20 inclusive

Maxwidth - Set the maximum width of the widget. Must be between 180 and 1200 inclusive

Maxheight - Set the maximum height of the widget. Must be greater than 200

omit_script - Do not include a script element in the response (value 1)

Lang - A supported Twitter language code

Related - Suggest additional Twitter screen names related to the widget as comma-separated values.

Theme - When set to dark, the timeline is displayed with light text over a dark background

Return a simple embed HTML for a Twitter timeline specified by the timeline URL, in an oEmbed-compatible JSON format. User, list, likes, and collection timelines are supported.

The Twitter oEmbed API can be used to embed dynamic tweets and timelines programatically to the website