← Main docs page

Get comments

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.

Parameters

Additional guidance on parameter usage

One and only one of the parameters listed above must be provided with each request.

When to use each:

Response

Notes

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.

Example

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 });

Response

{
	"commentCount": 5271,
	"commentsPageOne": [
		{
			"id": "Ugxl5Yd5Q5A662qcOnB4AaABAg",
			"videoId": "vpw_z9vBPAE",
			"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",
			"videoId": "vpw_z9vBPAE",
			"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",
			"videoId": "vpw_z9vBPAE",
			"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",
			"videoId": "vpw_z9vBPAE",
			"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",
			"videoId": "vpw_z9vBPAE",
			"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",
			"videoId": "vpw_z9vBPAE",
			"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-",
			"videoId": "vpw_z9vBPAE",
			"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-",
			"videoId": "vpw_z9vBPAE",
			"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.
	]
}