Apostrophes in title attribute are HTML encoded in response

十年热恋 提交于 2021-01-29 12:49:51

问题


"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": {},
}

Any Idea why this is happening? It's well decoded into the description but not the title field


回答1:


This has been a known issue of the API for quite some time.

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.

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.

As a final note, interestingly enough, on my site your video does not produce HTML entities in the JSON text obtained from the API.



来源:https://stackoverflow.com/questions/59395285/apostrophes-in-title-attribute-are-html-encoded-in-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!