2
votes

We have a site that has been using the YouTube API to load comments for videos for several months without issue. This weekend we noticed that the comment text has disappeared for all comments, across all videos! Author info, publishdAt, etc are all coming through just fine, but snippet.textDisplay is blank for every comment. If I view the video on YouTube.com, the comments are fine.

Sample API URL: https://www.googleapis.com/youtube/v3/commentThreads?videoId=1nFywcC37i0&key=PRIVATE_KEY&part=snippet,replies

Partial JSON return:

{
 "kind": "youtube#commentThreadListResponse",
 "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/HnKLJJvaX5o82p7SOXqZoax63Pk\"",
 "nextPageToken": "Cg0QvLX3nrHpygIgACgBEhQIAxDQibyJ2oDKAhiwy_Dp193CAhgCIBEo_dG1q83Pj81Z",
 "pageInfo": {
  "totalResults": 17,
  "resultsPerPage": 20
 },
 "items": [
  {
   "kind": "youtube#commentThread",
   "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/Fme5IvQu6tqWHp4YOLrYer7CIV0\"",
   "id": "z12mcbxpbsvvvjpep22qufvxxsqiith5g04",
   "snippet": {
    "videoId": "1nFywcC37i0",
    "topLevelComment": {
     "kind": "youtube#comment",
     "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/ldVLSDtTKPhMl-FtaJHj6FzFBxs\"",
     "id": "z12mcbxpbsvvvjpep22qufvxxsqiith5g04",
     "snippet": {
      "authorDisplayName": "Tea Culture",
      "authorProfileImageUrl": "https://lh3.googleusercontent.com/-gnq7syMNFPM/AAAAAAAAAAI/AAAAAAAABcY/GOY--FZpe0w/photo.jpg?sz=50",
      "authorChannelUrl": "http://www.youtube.com/channel/UCLTjm6qRUveEL2-q0UcFjWQ",
      "authorChannelId": {
       "value": "UCLTjm6qRUveEL2-q0UcFjWQ"
      },
      "videoId": "1nFywcC37i0",
      "textDisplay": "",
      "authorGoogleplusProfileUrl": "https://plus.google.com/113856310904021846289",
      "canRate": false,
      "viewerRating": "none",
      "likeCount": 1,
      "publishedAt": "2015-12-29T08:58:47.729Z",
      "updatedAt": "2015-12-29T08:58:47.729Z"
     }
    },
    "canReply": false,
    "totalReplyCount": 0,
    "isPublic": true
   }
  },
  {
   "kind": "youtube#commentThread",
   "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/74T1pezkd-XvwRlS2TdnS55rMLU\"",
   "id": "z12egnvgnxubg1fcz23njpizuseusp52v",
   "snippet": {
    "videoId": "1nFywcC37i0",
    "topLevelComment": {
     "kind": "youtube#comment",
     "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/Qo_wbi2gLLivL4wxv762XrTrOTc\"",
     "id": "z12egnvgnxubg1fcz23njpizuseusp52v",
     "snippet": {
      "authorDisplayName": "speeedskater",
      "authorProfileImageUrl": "https://lh6.googleusercontent.com/-vfRKsopq1lU/AAAAAAAAAAI/AAAAAAAAABM/L0ASWMo0cAg/photo.jpg?sz=50",
      "authorChannelUrl": "http://www.youtube.com/channel/UCsb8wbZeHZTta_yZ_YN1mag",
      "authorChannelId": {
       "value": "UCsb8wbZeHZTta_yZ_YN1mag"
      },
      "videoId": "1nFywcC37i0",
      "textDisplay": "",
      "authorGoogleplusProfileUrl": "https://plus.google.com/113292370824207410602",
      "canRate": false,
      "viewerRating": "none",
      "likeCount": 0,
      "publishedAt": "2015-12-03T05:25:02.538Z",
      "updatedAt": "2015-12-03T05:25:02.538Z"
     }
    },
    "canReply": false,
    "totalReplyCount": 0,
    "isPublic": true
   }
  },
  ...
2
There are several bug reports that seem to match this problem (and the timing). For instance, #7969 code.google.com/p/gdata-issues/issues/detail?id=7969. The workaround seems to be to use textFormat as plainText but this is clearly not ideal!theduck

2 Answers

0
votes

It does appear to be a recent bug; I'll keep an eye on the report at http://code.google.com/p/gdata-issues/issues/detail?id=7969, and implement the workaround to use textFormat as plainText for now.

0
votes

For a workaround if you need to have textFormat html, you can receive the comment by requesting comments list. Set filter id to id of topLevelComment found in commentThreads list response.

https://www.googleapis.com/youtube/v3/comments?id=TOP_LEVEL_COMMENT_ID&key=PRIVATE_KEY&part=snippet