【问题标题】:How to get a videos' html description instead of plain text using youtube api v3如何使用 youtube api v3 获取视频的 html 描述而不是纯文本
【发布时间】:2015-09-20 01:39:06
【问题描述】:

https://www.googleapis.com/youtube/v3/videos?part=snippet&id=O44zOeYcEXs&key={API_KEY}

像上面这样的 url 返回特定视频的信息,但描述是纯文本。虽然当我们访问那个特定的视频 (https://www.youtube.com/watch?v=O44zOeYcEXs) 时,描述是很好的 html 格式。

我一直在研究,但没有找到任何方法来使用 API 提取视频的完整 html 描述。

任何指针?

这些是不同的问题:

https://stackoverflow.com/questions/25034187/how-to-get-the-entire-youtube-video-description-using-c-sharp-and-youtube-api-v3

Getting complete description of video using YouTube API v3

【问题讨论】:

    标签: javascript video youtube youtube-api youtube-data-api


    【解决方案1】:

    YouTube v3 API 包含的大多数 Google API 都以 JSon 格式返回数据,基本上你会得到一个字符串。如果您希望它很好地格式化为 html,您需要自己做。

    Youtube API V3

    对于每种资源类型,指南列出了一个或多个数据 表示,而资源则表示为 JSON 对象。

    【讨论】:

      【解决方案2】:

      另一个答案是正确的,但不能准确解释发生了什么。 Youtube 描述应该是纯文本,发布链接的唯一方法是使用完整的 URL。您不能超链接文本的 sn-ps 或使用任何其他 html。我认为这是为了防止恶意软件传播和其他几个问题。

      当您打开视频时,Youtube 会检测并链接描述中的 URL。您必须自己处理链接的纯文本描述并添加 html a href 标签。一种方法是使用Regex to detect URLs

      【讨论】:

        猜你喜欢
        • 2014-07-31
        • 1970-01-01
        • 1970-01-01
        • 2019-01-06
        • 2015-10-12
        • 2016-04-12
        • 2015-07-26
        • 2015-08-29
        • 2018-06-28
        相关资源
        最近更新 更多