https://videomentions.com/api/v1/comments?id=${VIDEO_ID}
–or–
https://videomentions.com/api/v1/comments?continuation=${CONTINUATION}
–or–
https://videomentions.com/api/v1/comments?replyContinuation=${REPLY_CONTINUATION}
This endpoint can be used for fetching a video’s comments and their replies.
id
- string. (optional) Video ID.continuation
- string. (optional) Continuation string to get the next page of comments.replyContinuation
- string. (optional) Continuation string to get a comment’s replies.One and only one of the parameters listed above must be provided with each request.
When to use each:
id
parameter.continuation
parameter.replyContinuation
parameter.commentCount
- integer. The number of comments the video has. NOTE: This data is only included on page 1; requests for subsequent pages or for replies do not include this field.comments
- array. The comments.
id
- string. Comment ID.channelId
- string. ID of the channel that published the video.textDisplay
- string. The comment message.publishedText
- string. Human-readable string indicating when the comment was left.likeCount
- string. Human-readable number of likes (“17”, “4K”, “2M”, etc.).authorIsChannelOwner
- boolean. Whether the author of the comment is the channel owner.author
- object. Data about the author of the comment.
id
- string. User ID.name
- string. The user’s name.thumbnails
- array. User avatar images.
url
- string. User avatar image URL.width
- integer. User avatar image width in pixels.height
- integer. User avatar image height in pixels.url
- string The user’s YouTube URL.isPinned
- boolean. Whether the comment is pinned.hasReplies
- boolean. Whether the comment has replies. If the comment is a reply, this will always be false
.replyCount
- integer. Number of replies the comment has. If the comment is a reply, this will always be 0
.replyContinuation
- string|null. Continuation string to be included in subsequent requests to fetch a comment’s replies. This is null
when no more reply comments remain. If the comment is a reply, this will always be null
.continuation
string|null. Continuation string to be included in subsequent requests to fetch more comments. This is null
when no more comments remain.A top-level YouTube comment may have replies, but those replies can never have replies of their own. For that reason, if the comment is a reply, hasReplies
will always be set to false
, replyCount
will always be set to 0
, and replyContinuation
will always be set to null
.
If an invalid id
, continuation
or replyContinuation
string is provided, a 400 Bad Request
error response will be returned.
Below is a JavaScript example showing how to get the first two pages of top-level comments for the video with an ID of vpw_z9vBPAE
, as well as the first two pages of replies to the first comment.
const videoId = 'vpw_z9vBPAE';
/**
* Fetch page 1 of comments
*/
const commentsPageOneResponse = await fetch(
`https://videomentions.com/api/v1/comments?id=${videoId}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const commentsPageOneData = await commentsPageOneResponse.json();
const commentCount = commentsPageOneData.commentCount;
const commentsPageOne = commentsPageOneData.comments;
/**
* Check for next page
*/
const haveNextPage = commentsPageOneData.continuation !== null;
if (!haveNextPage) {
// Don't attempt to fetch the next page if no more pages remain
return;
}
/**
* Fetch page 2 of comments
*/
const commentsPageTwoResponse = await fetch(
`https://videomentions.com/api/v1/comments?continuation=${commentsPageOneData.continuation}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const commentsPageTwoData = await commentsPageTwoResponse.json();
const commentsPageTwo = commentsPageTwoData.comments;
/**
* Check if the first comment has replies
*/
const firstComment = commentsPageOne[0];
if (!firstComment.hasReplies) {
// Don't attempt to fetch replies for the first comment if it doesn't have replies
return;
}
/**
* Fetch replies for the first comment
*/
const repliesPageOneResponse = await fetch(
`https://videomentions.com/api/v1/comments?replyContinuation=${firstComment.replyContinuation}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const repliesPageOneData = await repliesPageOneResponse.json();
const repliesPageOne = repliesPageOneData.comments;
/**
* Check if the first comment has another page of replies
*/
const haveRepliesNextPage = repliesPageOneData.continuation !== null;
if (!haveRepliesNextPage) {
// Don't attempt to fetch the next page of replies if no more replies remain
return;
}
/**
* Fetch the next page of replies for the first comment
*/
const repliesPageTwoResponse = await fetch(
`https://videomentions.com/api/v1/comments?replyContinuation=${repliesPageOneData.continuation}`,
{
headers: {
'API-Key': 'your-api-key',
'API-Secret': 'your-api-secret',
},
}
);
const repliesPageTwoData = await repliesPageTwoResponse.json();
const repliesPageTwo = repliesPageTwoData.comments;
console.log({ commentCount, commentsPageOne, commentsPageTwo, repliesPageOne, repliesPageTwo });
{
"commentCount": 5271,
"commentsPageOne": [
{
"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg",
"channelId": "UCh-sQC1L3J7xicFO1Bo5DeQ",
"textDisplay": "Cool, my iPhone 5 looks modern again",
"publishedText": "2 years ago",
"likeCount": "3621",
"authorIsChannelOwner": false,
"author": {
"id": "UCh-sQC1L3J7xicFO1Bo5DeQ",
"name": "@leokimvideo",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/UvzzkQLzP3OFfkEa5FjqX4BM6_vfA9bFgPX6DotH9bHRneqZWtxgFr5Xg2Hpxq-3wx5X6oIw=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/UvzzkQLzP3OFfkEa5FjqX4BM6_vfA9bFgPX6DotH9bHRneqZWtxgFr5Xg2Hpxq-3wx5X6oIw=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/UvzzkQLzP3OFfkEa5FjqX4BM6_vfA9bFgPX6DotH9bHRneqZWtxgFr5Xg2Hpxq-3wx5X6oIw=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UCh-sQC1L3J7xicFO1Bo5DeQ"
},
"isPinned": false,
"hasReplies": true,
"replyCount": 45,
"replyContinuation": "Eg0SC3Zwd196OXZCUEFFGAYygwEaUBIaVWd4bDVZZDVRNUE2NjJxY09uQjRBYUFCQWciAggAKhhVQ2RkaVVFcGVxSmNZZUJ4WDFJVkJLdlEyC3Zwd196OXZCUEFFQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3hsNVlkNVE1QTY2MnFjT25CNEFhQUJBZw%3D%3D"
},
{
"id": "UgzvJ1vmcIcMCZlc2AJ4AaABAg",
"channelId": "UCw6rI6pJhakBc9h6LR7poTw",
"textDisplay": "The Verge editing team is goated for these fast condensed turnaround times. Not that simple",
"publishedText": "2 years ago",
"likeCount": "2073",
"authorIsChannelOwner": false,
"author": {
"id": "UCw6rI6pJhakBc9h6LR7poTw",
"name": "@AduKofs",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKb3_W9TzChttmJ2vUlhjDBYWzNtpXeJvOFkcWN9WA=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKb3_W9TzChttmJ2vUlhjDBYWzNtpXeJvOFkcWN9WA=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKb3_W9TzChttmJ2vUlhjDBYWzNtpXeJvOFkcWN9WA=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UCw6rI6pJhakBc9h6LR7poTw"
},
"isPinned": false,
"hasReplies": true,
"replyCount": 9,
"replyContinuation": "Eg0SC3Zwd196OXZCUEFFGAYygwEaUBIaVWd6dkoxdm1jSWNNQ1psYzJBSjRBYUFCQWciAggAKhhVQ2RkaVVFcGVxSmNZZUJ4WDFJVkJLdlEyC3Zwd196OXZCUEFFQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3p2SjF2bWNJY01DWmxjMkFKNEFhQUJBZw%3D%3D"
}
// etc.
],
"commentsPageTwo": [
{
"id": "Ugy16thudMV0Rdka0dx4AaABAg",
"channelId": "UCA1m0ctjv2pEimyisLDJYoQ",
"textDisplay": "I know I’m not the only one that’s underwhelmed with this year’s iPhone models.",
"publishedText": "2 years ago (edited)",
"likeCount": "125",
"authorIsChannelOwner": false,
"author": {
"id": "UCA1m0ctjv2pEimyisLDJYoQ",
"name": "@sheikhirfan1191",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKaDjma4kvKrug8YaKeL9VLpih6XeBYQkEr-Xfew4Q=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKaDjma4kvKrug8YaKeL9VLpih6XeBYQkEr-Xfew4Q=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKaDjma4kvKrug8YaKeL9VLpih6XeBYQkEr-Xfew4Q=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UCA1m0ctjv2pEimyisLDJYoQ"
},
"isPinned": false,
"hasReplies": true,
"replyCount": 4,
"replyContinuation": "Eg0SC3Zwd196OXZCUEFFGAYygwEaUBIaVWd5MTZ0aHVkTVYwUmRrYTBkeDRBYUFCQWciAggAKhhVQ2RkaVVFcGVxSmNZZUJ4WDFJVkJLdlEyC3Zwd196OXZCUEFFQAFICoIBAggBQi9jb21tZW50LXJlcGxpZXMtaXRlbS1VZ3kxNnRodWRNVjBSZGthMGR4NEFhQUJBZw%3D%3D"
},
{
"id": "UgxxncRLmi0EExg83hV4AaABAg",
"channelId": "UC4rb1tv1SDYSkb2aV-b028g",
"textDisplay": "Apple better start making better improvements in their iPhones! I don’t even use the cameras and yet they focus on that.\nThey should be focusing on what the community wants, like battery life and aesthetic",
"publishedText": "2 years ago (edited)",
"likeCount": "7",
"authorIsChannelOwner": false,
"author": {
"id": "UC4rb1tv1SDYSkb2aV-b028g",
"name": "@ForeverF1",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZh1ovARfQOV_PmoNqgZrP0AMWLCwOaxmHuBBK4Sw=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZh1ovARfQOV_PmoNqgZrP0AMWLCwOaxmHuBBK4Sw=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZh1ovARfQOV_PmoNqgZrP0AMWLCwOaxmHuBBK4Sw=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UC4rb1tv1SDYSkb2aV-b028g"
},
"isPinned": false,
"hasReplies": false,
"replyCount": 0,
"replyContinuation": null
}
// etc.
],
"repliesPageOne": [
{
"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg.9Eme8I70WK79Emj6gqZZ69",
"channelId": "UCugfL15GBuOkXiz3gCebSsw",
"textDisplay": "FR",
"publishedText": "2 years ago",
"likeCount": "24",
"authorIsChannelOwner": false,
"author": {
"id": "UCugfL15GBuOkXiz3gCebSsw",
"name": "@GGibberry",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ayoWaYJm3bxtIccadzXwbx7w0X7N2GgML2Z1zVrXFu674dJN-A6j9XrPqqbsQrgybhtlyiBTVw=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ayoWaYJm3bxtIccadzXwbx7w0X7N2GgML2Z1zVrXFu674dJN-A6j9XrPqqbsQrgybhtlyiBTVw=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ayoWaYJm3bxtIccadzXwbx7w0X7N2GgML2Z1zVrXFu674dJN-A6j9XrPqqbsQrgybhtlyiBTVw=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UCugfL15GBuOkXiz3gCebSsw"
},
"isPinned": false,
"hasReplies": false,
"replyCount": 0,
"replyContinuation": null
},
{
"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg.9Eme8I70WK79EmnZQ-47oA",
"channelId": "UC0Nq0vNj_17CEAqy4PDgJCw",
"textDisplay": "😆",
"publishedText": "2 years ago",
"likeCount": "4",
"authorIsChannelOwner": false,
"author": {
"id": "UC0Nq0vNj_17CEAqy4PDgJCw",
"name": "@baevoleg",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYX1aAhUL9LBOLuiu3fDBs4QsL_RrK7SsmZNGPL=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYX1aAhUL9LBOLuiu3fDBs4QsL_RrK7SsmZNGPL=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYX1aAhUL9LBOLuiu3fDBs4QsL_RrK7SsmZNGPL=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UC0Nq0vNj_17CEAqy4PDgJCw"
},
"isPinned": false,
"hasReplies": false,
"replyCount": 0,
"replyContinuation": null
}
// etc.
],
"repliesPageTwo": [
{
"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg.9Eme8I70WK79EnO7gjX9o-",
"channelId": "UC67IkQQkQIWIwdTuxPB5FJw",
"textDisplay": "Same",
"publishedText": "2 years ago",
"likeCount": "1",
"authorIsChannelOwner": false,
"author": {
"id": "UC67IkQQkQIWIwdTuxPB5FJw",
"name": "@gootchgaming5071",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYRWsEKwg90R0MRSFgiAwS9TxFNfwPahr-u84mT=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYRWsEKwg90R0MRSFgiAwS9TxFNfwPahr-u84mT=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKYRWsEKwg90R0MRSFgiAwS9TxFNfwPahr-u84mT=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UC67IkQQkQIWIwdTuxPB5FJw"
},
"isPinned": false,
"hasReplies": false,
"replyCount": 0,
"replyContinuation": null
},
{
"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg.9Eme8I70WK79EnYgP6MIS-",
"channelId": "UCWnDvrU-B5O3LbDkCHnwbpQ",
"textDisplay": "😂😂 exactly",
"publishedText": "2 years ago",
"likeCount": "1",
"authorIsChannelOwner": false,
"author": {
"id": "UCWnDvrU-B5O3LbDkCHnwbpQ",
"name": "@indhira2548",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZbHmVoe5dIuSXerAHxGSiiGh2Btj31O3QcNkALTA=s176-c-k-c0x00ffffff-no-rj",
"width": 176,
"height": 176
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZbHmVoe5dIuSXerAHxGSiiGh2Btj31O3QcNkALTA=s88-c-k-c0x00ffffff-no-rj",
"width": 88,
"height": 88
},
{
"url": "https://yt3.ggpht.com/ytc/APkrFKZbHmVoe5dIuSXerAHxGSiiGh2Btj31O3QcNkALTA=s48-c-k-c0x00ffffff-no-rj",
"width": 48,
"height": 48
}
],
"url": "https://www.youtube.com/channel/UCWnDvrU-B5O3LbDkCHnwbpQ"
},
"isPinned": false,
"hasReplies": false,
"replyCount": 0,
"replyContinuation": null
}
// etc.
]
}