问题描述
"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
字段
Any Idea why this is happening? It's well decoded into the description
but not the title
field
推荐答案
这一直是 API 的一个已知问题.
This has been a known issue of the API for quite some time.
其他用户也经历过——包括我自己.然而,没有出现来自谷歌的文档解释和/或解决方案(据我所知),无论是在 SO 上,还是在谷歌自己的问题跟踪器 网站.
Other users experienced it -- including myself. Yet, no documenting explanation and/or solution from Google emerged (as far as I know), neither here on SO, nor on Google's own issue tracker site.
我自己正在通过我自己的 HTML 实体解码器过滤从 API 端点收到的文本.
I myself am filtering the texts received from API endpoints through my own HTML entity decoder.
我建议您使用周围编程环境中提供的工具进行相同类型的清理.
I recommend you do the same kind of cleaning-up, using tools available from the surrounding programming environment.
最后一点,有趣的是,在我的网站上您的视频不会在从 API 获取的 JSON 文本中生成 HTML 实体.
As a final note, interestingly enough, on my site your video does not produce HTML entities in the JSON text obtained from the API.
这篇关于title 属性中的撇号是响应中的 HTML 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!