如何嵌入推文?

How can I embed a Tweet?

如何在 HTML 中嵌入推文?假设我想嵌入这条推文:https://twitter.com/Rntk____/status/1245167253630251008

有什么简单的方法吗?

  1. 点击推文上的 按钮
  2. 然后,单击 </> Embed tweet
  3. 按钮
  4. 您现在需要做的就是复制代码。

代码如下所示:

<blockquote class="twitter-tweet"><p lang="en" dir="ltr"> A 101-year-old man, who survived the Spanish flu pandemic &amp; World War II has now added <a href="https://twitter.com/hashtag/COVID%E3%83%BC19?src=hash&amp;ref_src=twsrc%5Etfw">#COVIDー19</a> to the list, after being discharged from hospital in Rimini.<br><br>Wow!  <a href="https://twitter.com/Rntk____/status/1245167253630251008">pic.twitter.com/7OtN2Sv3lp</a></p>&mdash; World Updates (@Rntk____) <a href="https://twitter.com/Rntk____/status/1245167253630251008?ref_src=twsrc%5Etfw">April 1, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

这是 HTML 页面中的样子:

转到publish.twitter.com

粘贴推文 URL 并按 Enter。

然后您可以通过推文上方的link进行自定义,或者直接复制代码。

另一种选择是使用 Twitter's oembed API endpoint 通过后端代码获取相同的信息,并将其嵌入到您的网站中。