1

I am trying to get a specific comment from a YouTube video. For example I want to get the details from the 34th comment of a YouTube video. Does anybody knows how can I do this without reading all the comment list?

Or if there isn't available any solution for retrieving only one comment, can you get a list with all the comments from a YouTube video? (I used the API method commentThreads but it has a limit of 100 comments within a call).

Btw, I read this How to get a specific comment of a youtube video? , but maybe the answer is outdated.

brasofilo
  • 25,496
  • 15
  • 91
  • 179
andrei.godea
  • 853
  • 1
  • 9
  • 9
  • may be this helpfull: http://stackoverflow.com/questions/19965856/how-to-get-all-comments-on-a-youtube-video – DsRaj Jun 07 '16 at 11:31
  • Thanks, but I already tried to use https://www.googleapis.com/youtube/v3/commentThreads and it allows me to fetch a maximum number of 100 comments at once. So if I need the 454th comment it will be a performance issue because I need 5 different calls. – andrei.godea Jun 07 '16 at 11:52
  • I've been looking for something similar and I think I found how to do it. But your question is not really clear...What 34th comment? Sorted by time or relevance? How are you deciding what comment to get? Why the number 34? In my case, if I want details of a comment, I need to somewhat read them all first. And by "reading" I mean Machine Reading, do you mean Human Reading? – brasofilo Nov 24 '17 at 03:45
  • 1
    And reading *all* comment is not an issue, you just go storing the results on an array until there's no more `nextPageToken`. Google and Facebook don't give us more than 100 results per call, so we need to take the performance hit. I just notice the hit it if total results are over 5k items, for 500 it's a breeze. – brasofilo Nov 24 '17 at 03:53
  • Does this answer your question? [How to get all comments on a YouTube video?](https://stackoverflow.com/questions/19965856/how-to-get-all-comments-on-a-youtube-video) – Michael Freidgeim Feb 26 '23 at 21:16

1 Answers1

2

Just use https://www.googleapis.com/youtube/v3/comments to get specific comment from a video like

https://www.googleapis.com/youtube/v3/comments?part=snippet&id={COMMENT_ID}&textFormat=html&key={YOUR_API_KEY} 

Use the ID that is specific for every comment and the API Key on your Google Developer Console. You can get the commentID clicking on the timestamp link beside the commenter's name.

brasofilo
  • 25,496
  • 15
  • 91
  • 179
Kumar
  • 1,187
  • 18
  • 31
  • Thanks, but I need to get the comment based on its index. It is an automated job so I don't have the id of the comment. Thanks anyway! – andrei.godea Jun 25 '16 at 13:46
  • are you using api for this or just html scraping – Kumar Jun 25 '16 at 13:50
  • At the moment I am using api. I read all comments and after that I can find the wanted comment by its index but as you can imagine it can take a while if there are many comments (because I can only read 100 comments per call). The main problem is that there is no method available for what I need. I could manage to improve this functionality if I could get the total number of first level comments from a video, but Youtube is showing only the total number of comments (first level + replies). – andrei.godea Jun 26 '16 at 11:50
  • This is the correct answer. Getting second level comments is another issue. Getting all comments is another issue and so is _finding_ an specific comment (by keyword, user or date). – brasofilo Nov 24 '17 at 04:08