【问题标题】:Apostrophes in title attribute are HTML encoded in response标题属性中的撇号是响应的 HTML 编码
【发布时间】:2020-04-11 04:46:01
【问题描述】:
"snippet": {
    "publishedAt": "2012-08-24T17:06:35.000Z",
    "channelId": "UCh6C5LG14uZKmwCgGxf-nDQ",
    "title": "Céline Dion - I'm Alive (Official Video)",
    "description": "Celine Dion - I'm Alive (Official Video) Listen on Spotify: http://smarturl.it/Celine_Spotify_EN Listen on Apple Music: http://smarturl.it/Celine_AM_EN Amazon: ...",
    "thumbnails": {},
}

知道为什么会这样吗?它被很好地解码为 description 而不是 title 字段

【问题讨论】:

    标签: youtube-data-api


    【解决方案1】:

    这是 API 的一个已知问题已有一段时间了。

    其他用户也体验过——包括我自己。然而,谷歌没有出现任何文档解释和/或解决方案(据我所知),无论是在 SO 上,还是在谷歌自己的问题跟踪器 site 上。

    我自己正在通过我自己的HTML entity decoder 过滤从 API 端点接收到的文本。

    我建议您使用周围编程环境中可用的工具进行相同类型的清理。

    最后一点,有趣的是,在我的网站上,your video 不会在从 API 获得的 JSON 文本中生成 HTML 实体。

    【讨论】:

      猜你喜欢
      • 2017-09-25
      • 2013-01-04
      • 2010-09-30
      • 2011-12-25
      • 1970-01-01
      • 2019-07-08
      • 1970-01-01
      • 2018-01-17
      • 1970-01-01
      相关资源
      最近更新 更多