3
votes

I am trying to retrieve all comments to a video with all replies, however, using the Test It interface (or the Java library) I have not been able to retrieve all comments - I have following two examples, when I have failed:

Example 1

The example video and comment is https://www.youtube.com/watch?v=xCLy2DZdXhY&lc=z12ei1s5gs2mc303523qsdigcxmphhlrd04 When I retrieve the comment using

GET https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&id=z12ei1s5gs2mc303523qsdigcxmphhlrd04&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

I receive: The response for the particular comment - note that there are 2 replies

And note the "totalReplyCount": 2, line.

However, when I try to obtain all replies using the parentId:

GET https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=z12ei1s5gs2mc303523qsdigcxmphhlrd04&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

I receive an empty response:

Empty response

Remarks

I have read Youtube Data API v3: commentThread call doesn't give replies for some comment threads , however, it does not provide me the answer as I do use the comments list with parentId and I am still not getting any replies.

Even if I try the not recommended way - using the part snippet,replies, I do not get any replies: Request: GET https://www.googleapis.com/youtube/v3/commentThreads?part=snippet%2Creplies&id=z12ei1s5gs2mc303523qsdigcxmphhlrd04&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

Still no replies

However, if I do not specify the comment thread by its ID and specify that I want all comment threads for the video:

GET https://www.googleapis.com/youtube/v3/commentThreads?part=snippet%2Creplies&videoId=xCLy2DZdXhY&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

Then voila - The comment thread is now with those two replies:

Now with replies - Part 1 Now with replies - Part 2

Why do I receive the replies now and not when I either specify the replies by their parentId or when I specify the comment thread by its id?

Moreover, if I take the (weird) id of one of the replies and try to obtain the comment with this reply, I will receive empty response:

GET https://www.googleapis.com/youtube/v3/comments?part=snippet&id=z12ei1s5gs2mc303523qsdigcxmphhlrd04.1443381718685326&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

Cannot find the reply

Example 2

This problem is a bit different. I have a video https://www.youtube.com/watch?v=-c76GeR2IWg with 7 comments (6 of them are top levels). When I try to obtain all top level comments related to this video I receive only 4 of them. GET https://www.googleapis.com/youtube/v3/commentThreads?part=snippet%2Creplies&videoId=-c76GeR2IWg&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

Only 4 top level comments

One of the missing comments in the response is https://www.youtube.com/watch?v=-c76GeR2IWg&lc=z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k . When I train to obtain comment thread with this id, I do obtain the comment thread: GET https://www.googleapis.com/youtube/v3/commentThreads?part=snippet%2Creplies&id=z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

I can find it using its id

And also, when I try to obtain the replies for this comment (there should be 1 reply) I receive an empty response:

GET https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

enter image description here

Remarks

  • For both examples, the number of comments is less than the size of the page. For this simple example, I have skipped pagination and chose examples with only a few comments, in the real application I use the pagination but I do not get more results.

  • I do not really understand how is the YouTube and G+ integrated together, thus this might be the issue, however, I was always accesing these videos using only youtube, not checking the users' G+ page, thus I would say that this should not be the case.

Similar questions on SO:

1
The API seems to be not working. It is an error from Google's side.Harshit Sharma

1 Answers

1
votes

When I do the following via HTTP request:

https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=z12ei1s5gs2mc303523qsdigcxmphhlrd04&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

I get the following response:

items": [
  {
   "kind": "youtube#comment",
   "etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/aOipn7OKd9ibVua9TWdtD2vJJgI\"",
   "id": "z12ei1s5gs2mc303523qsdigcxmphhlrd04.1443381718685326",
   "snippet": {
    "textDisplay": "JM",
    "parentId": "z12ei1s5gs2mc303523qsdigcxmphhlrd04",
    "authorDisplayName": "Asia Price",
    "authorProfileImageUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=50",
    "authorChannelUrl": "http://www.youtube.com/channel/UCtUuxM3_g2hWA7qr17d85RQ",
    "authorChannelId": {
     "value": "UCtUuxM3_g2hWA7qr17d85RQ"
    },
    "authorGoogleplusProfileUrl": "https://plus.google.com/100662746258967935686",
    "canRate": false,
    "viewerRating": "none",
    "likeCount": 0,
    "publishedAt": "2015-09-27T19:21:58.685Z",
    "updatedAt": "2015-09-27T19:21:58.685Z"
   }
  },
  {
   "kind": "youtube#comment",
   "etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/NtowtHGdhytzw9YY9RxUopEgoTA\"",
   "id": "z12ei1s5gs2mc303523qsdigcxmphhlrd04.1443365800258222",
   "snippet": {
    "textDisplay": "0",
    "parentId": "z12ei1s5gs2mc303523qsdigcxmphhlrd04",
    "authorDisplayName": "FAY Fay",
    "authorProfileImageUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=50",
    "authorChannelUrl": "http://www.youtube.com/channel/UC5b4dTxK4ae_roaMWMYpglQ",
    "authorChannelId": {
     "value": "UC5b4dTxK4ae_roaMWMYpglQ"
    },
    "authorGoogleplusProfileUrl": "https://plus.google.com/100517618639903741268",
    "canRate": false,
    "viewerRating": "none",
    "likeCount": 0,
    "publishedAt": "2015-09-27T14:56:40.258Z",
    "updatedAt": "2015-09-27T14:56:40.258Z"
   }
  }

I get the same results when I use the API explorer.

For your second example,

https://www.googleapis.com/youtube/v3/comments?part=snippet&parentId=z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}

gives me

"items": [
  {
   "kind": "youtube#comment",
   "etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/UBoqDwv8bg8xZpbIepzI_M5gp9o\"",
   "id": "z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k.1409319325542384",
   "snippet": {
    "textDisplay": "Ahoj děkuju :) jo máš fajn videa :) ",
    "parentId": "z120d11g2yyjyxcxw04cg1xbaqfnslfaamk0k",
    "authorDisplayName": "Gumičkování s Péťou",
    "authorProfileImageUrl": "https://lh4.googleusercontent.com/-VJce_PtJx70/AAAAAAAAAAI/AAAAAAAAABI/dabMtsy0haY/photo.jpg?sz=50",
    "authorChannelUrl": "http://www.youtube.com/channel/UCAyuADHtiVTpiAbt2VVQhtQ",
    "authorChannelId": {
     "value": "UCAyuADHtiVTpiAbt2VVQhtQ"
    },
    "authorGoogleplusProfileUrl": "https://plus.google.com/101894467260220798842",
    "canRate": false,
    "viewerRating": "none",
    "likeCount": 0,
    "publishedAt": "2014-08-29T13:35:25.542Z",
    "updatedAt": "2014-08-29T13:35:25.542Z"
   }
  }

It might be an issue with your request or API key. Try making a new one and using that.