【问题标题】:twitter-video twitter-video-error not related to API documentation, how to fix it?twitter-video twitter-video-error 与 API 文档无关,如何解决?
【发布时间】:2016-03-11 19:31:24
【问题描述】:

这是 Twitter API 1.1 对 api.twitter.com/1/statuses/oembed.{format} 的 html 请求响应示例,它不会导致 twitter-video-error当 Widgets 脚本 widgets.js?

重现错误的步骤:

  1. 通过以下方式请求 API:1.1/statuses/oembed.json?id=672098352037785600&maxwidth=500&hide_thread=true&omit_script=true&align=center&widget_type=video&hide_tweet=true
  2. 在单个 div 中绑定,手动编写,响应的 html 属性内的代码。在主页上使用角度指令ng-bind-html
  3. 执行//platform.twitter.com/widgets.js后检查渲染代码

响应中的 HTML:

<blockquote class=\"twitter-video\" data-status=\"hidden\"><p lang=\"ro\" dir=\"ltr\">The Good Dinosaur <a href=\"https://twitter.com/hashtag/Trailler?src=hash\">#Trailler</a> Movie: <a href=\"https://t.co/xQxGt5RAwK\">https://t.co/xQxGt5RAwK</a> melalui <a href=\"https://twitter.com/YouTube\">@YouTube</a></p>&mdash; Udin Media ™ (@MediaUdin) <a href=\"https://twitter.com/MediaUdin/status/672098352037785600\">December 2, 2015</a></blockquote>

根据 API,

嵌入式推文分为两部分:&lt;blockquote&gt; 包含推文 Twitter 服务器上的信息和 JavaScript 文件 将&lt;blockquote&gt; 转换为完全渲染的推文。如果你看到 推文在您的页面上,但不是完全渲染的推文,这是可能的 您的 CMS 或编辑界面删除了渲染所需的 &lt;script&gt; 推文。

尝试切换到“文本”、“HTML”或“代码编辑”模式以直接 输入预先格式化的推文信息。富文本或所见即所得 编辑器可能会误解粘贴的 HTML 代码,这可能会干扰 在你的页面上发布一条推文。

那么“切换到“文本”、“HTML”或“代码编辑”模式是什么意思?在哪里?怎么样?

我在 HTML 中的摘录:

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
</script>

<div ng-bind-html="htmloembedresponse"</div>

渲染页面:

<blockquote class="twitter-video twitter-video-error" data-twitter-extracted-i144954813610521315"=true....

因此,小部件渲染中不包含任何图标、图像/视频、按钮。 A 目前的文档非常简单。

【问题讨论】:

    标签: html angularjs twitter embed


    【解决方案1】:

    他们的意思是“不要相信所见即所得的编辑器会为你编写 HTML”。

    手工编写 HTML。

    【讨论】:

    • 这意味着不使用 api? api 创建要呈现的 html。同样来自它们的 JS 小部件应该呈现它。怎么可能?
    • 不,它翻译成“不要使用所见即所得的编辑器来编写使用 API 的 HTML”。
    • 再次查看消息:“如果您在页面上看到推文文本但不是完全呈现的推文有可能您的 CMS 或编辑界面剥夺了呈现鸣叫。”。可能的。不确定。问题可能是由其他原因引起的。
    • 重点是包含视频的
    猜你喜欢
    • 2014-10-23
    • 2016-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多