【问题标题】:How can I embed a Tweet?如何嵌入推文?
【发布时间】:2020-08-06 05:19:33
【问题描述】:

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

有什么简单的方法吗?

【问题讨论】:

    标签: html twitter embed


    【解决方案1】:
    1. 点击推文上的 按钮
    2. 然后,单击显示</> Embed tweet 的按钮
    3. 您现在需要做的就是复制代码。

    代码如下:

    <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 页面中的样子:

    【讨论】:

      【解决方案2】:

      转到publish.twitter.com

      粘贴推文 URL 并按 Enter。

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

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

      【讨论】:

        猜你喜欢
        • 2012-04-01
        • 1970-01-01
        • 2021-01-27
        • 2021-09-15
        • 2018-02-22
        • 2013-11-24
        • 2015-08-28
        • 2015-05-25
        • 2020-01-22
        相关资源
        最近更新 更多