Search code examples
youtube-data-api

Apostrophes in title attribute are HTML encoded in response


"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


Solution

  • 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.