You will make use of Comments.delete This will require you to pass a commentId to delete a particular comment. There are various ways to fetch the commentId, as for me, I use this URI GET request:
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&videoId={VIDEO_ID}&key={API_KEY}
You will get a response like:
"items": [
{
"kind": "youtube#commentThread",
"etag": "\"5C5HHOaBSHC5ZXfkrT4ZlRCi01A/wQo7nKuPMjPTCeeV9ofDLff8KhY\"",
"id": "z12ojxq5qwjlulz4o04cc5vxauuaubkbovk0k",
"snippet": {
"videoId": "Ez4nKZ2BeTU",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "\"5C5HHOaBSHC5ZXfkrT4ZlRCi01A/Ifn8tdeFUJiclXThCp44Cib6-cU\"",
"id": "z12ojxq5qwjlulz4o04cc5vxauuaubkbovk0k", //this is the commentId you will use to delete the comment
"snippet": {
"authorDisplayName": "...",
"authorProfileImageUrl": "...",
"authorChannelUrl": "...",
"authorChannelId": {
"value": "..."
},
"videoId": "Ez4nKZ2BeTU",
"textDisplay": "deleteme\ufeff", //this is my comment which I would like to delete
...
Use the commentId and pass that to the Comments.delete Try-it to delete the comment. It will return a 204 status if successful. So that's the concept. Hope this helps.