Support needed? Reach out! ๐Ÿ“ง

How to Scrape Youtube Video Comments

This tutorial shows how to use Youtube Video Comments API to scrape and crawl structured Youtube data in real-time.
Scrape YouTube comment sections at scale and capture comment text, like counts, reply threads, and author data for sentiment analysis and audience research.

Access Youtube Data in 3 Steps

Start crawling Youtube video comments data. Follow these steps to extract social media data in minutes.

1

Create Your Account

Go to our registration page and make an account. It's free, no credit card, and you get credits right away to play around with.

2

Verify Your Email Address

You'll get a verification email, click the link in it. Once that's done, you can grab your API token from the dashboard.

3

Make Your First API Call

Copy the code snippet below, swap in your API key, and run it. You'll get Youtube data back as JSON within a few seconds.

Code Sample

Here's a JavaScript example to get you going. Swap out the token and you're good, works the same way in any language that can make HTTP requests. Start collecting video comments data via our REST API!

javascript-logo JavaScript
Youtube Video / Short Comments
1 const root = 'https://ensembledata.com/apis'
2 const endpoint = '/youtube/video/comments'
3 const params = {
4   "id""cKkb5tperxc",
5   "cursor""",
6   "token""YOUR-TOKEN-HERE"
7 }
8  
9 const queryString = new URLSearchParams(params).toString();
10 const url = `${root}${endpoint}?${queryString}`;
11  
12 await fetch(url)
13   .then(response => response.json())
14   .then(data => console.log(data))
15   .catch(error => console.error(error));
16  

Parameters

id (string) video or short ID. REQUIRED
cursor (string) Parameter to manually handle pagination. Each response contains a `nextCursor` which can be used to retrieve the next page of results by sending it as the next `cursor`. If the `nextCursor` is not present in the response, it means that there are no more results to retrieve.
token (string) Private token assigned to each client to access the APIs. REQUIRED

Example Response

Explore the fields returned by this endpoint. Click a row to expand nested objects and arrays, hover a value to copy it, or use "Expand all" to see everything at once.

JSON
Youtube Video / Short Comments
dataobject3 fields
infoobject2 fields
clickTrackingParamsstring"CAAQg2ciEwiQ44SeufGCAxXTxj8EHW8gCkI="
reloadContinuationItemsCommandobject3 fields
targetIdstring"comments-section"
continuationItemsarray1 item ยท schema from #0 1 item
commentsHeaderRendererobject10 fields
countTextobject1 field
runsarray2 items ยท schema from #0 2 items
textstring"25,138"
createRendererobject1 field
commentSimpleboxRendererobject7 fields
authorThumbnailobject2 fields
thumbnailsarray3 items ยท schema from #0 3 items
urlstring"https://yt3.ggpht.com/a/default-user=s48-c-k-c0x00ffffff-no-rj"
widthnumber48
heightnumber48
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"Default profile photo"
placeholderTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Add a comment..."
prepareAccountEndpointobject3 fields
clickTrackingParamsstring"CM8BEMF1IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passiโ€ฆ"
webPageTypestring"WEB_PAGE_TYPE_UNKNOWN"
rootVenumber83769
signInEndpointobject1 field
nextEndpointobject3 fields
clickTrackingParamsstring"CM8BEMF1IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"/watch?v=bGZplqeIb3w"
webPageTypestring"WEB_PAGE_TYPE_WATCH"
rootVenumber3832
watchEndpointobject1 field
videoIdstring"bGZplqeIb3w"
trackingParamsstring"CM8BEMF1IhMIkOOEnrnxggMV08Y_BB1vIApC"
avatarSizestring"SIMPLEBOX_AVATAR_SIZE_TYPE_DEFAULT"
emojiButtonobject1 field
buttonRendererobject4 fields
sizestring"SIZE_SMALL"
iconobject1 field
iconTypestring"EMOJI"
trackingParamsstring"CNkBEPBbIhMIkOOEnrnxggMV08Y_BB1vIApC"
accessibilityDataobject1 field
accessibilityDataobject1 field
labelstring"Show emoji picker"
emojiPickerobject1 field
emojiPickerRendererobject14 fields
idstring"emoji"
categoriesarray8 items ยท schema from #0 8 items
emojiPickerCategoryRendererobject5 fields
categoryIdstring"UCkszU2WH9gy1mb0dV-11UJg"
titleobject1 field
simpleTextstring"YouTube"
emojiIdsarray61 items ยท schema from #0 61 items
0string"U"
1string"C"
2string"k"
3string"s"
4string"z"
5string"U"
6string"2"
7string"W"
8string"H"
9string"9"
10string"g"
11string"y"
12string"1"
13string"m"
14string"b"
15string"0"
16string"d"
17string"V"
18string"-"
19string"1"
20string"1"
21string"U"
22string"J"
23string"g"
24string"/"
25string"G"
26string"8"
27string"A"
28string"f"
29string"Y"
30string"6"
31string"y"
32string"W"
33string"G"
34string"u"
35string"K"
36string"u"
37string"h"
38string"L"
39string"0"
40string"P"
41string"l"
42string"b"
43string"i"
44string"A"
45string"2"
46string"A"
47string"E"
trackingParamsstring"CNgBELeDCBgAIhMIkOOEnrnxggMV08Y_BB1vIApC"
categoryTypestring"CATEGORY_TYPE_GLOBAL"
categoryButtonsarray8 items ยท schema from #0 8 items
emojiPickerCategoryButtonRendererobject4 fields
categoryIdstring"UCkszU2WH9gy1mb0dV-11UJg"
iconobject1 field
iconTypestring"VIDEO_YOUTUBE"
tooltipstring"YouTube"
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"YouTube"
searchPlaceholderTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Search emoji"
searchNoResultsTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"No emoji found"
pickSkinToneTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Pick emoji skin tone"
trackingParamsstring"CNABELK0AiITCJDjhJ658YIDFdPGPwQdbyAKQg=="
clearSearchLabelstring"Clear search"
skinToneGenericLabelstring"Generic skin tone"
skinToneLightLabelstring"Light skin tone"
skinToneMediumLightLabelstring"Medium light skin tone"
skinToneMediumLabelstring"Medium skin tone"
skinToneMediumDarkLabelstring"Medium dark skin tone"
skinToneDarkLabelstring"Dark skin tone"
sortMenuobject1 field
sortFilterSubMenuRendererobject6 fields
subMenuItemsarray2 items ยท schema from #0 2 items
titlestring"Top comments"
selectedbooleantrue
serviceEndpointobject3 fields
clickTrackingParamsstring"CM4BEOPABxgAIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject2 fields
sendPostbooleantrue
apiUrlstring"/youtubei/v1/next"
continuationCommandobject3 fields
tokenstring"Eg0SC2JHWnBscWVJYjN3GAYyJSIRIgtiR1pwbHFlSWIzdzAAeAJCEGNvbW1lbnRzLXNlY3โ€ฆ"
requeststring"CONTINUATION_REQUEST_TYPE_WATCH_NEXT"
commandobject2 fields
clickTrackingParamsstring"CM4BEOPABxgAIhMIkOOEnrnxggMV08Y_BB1vIApC"
showReloadUiCommandobject1 field
targetIdstring"comments-section"
trackingParamsstring"CM4BEOPABxgAIhMIkOOEnrnxggMV08Y_BB1vIApC"
titlestring"Sort by"
iconobject1 field
iconTypestring"SORT"
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"Sort comments"
tooltipstring"Sort comments"
trackingParamsstring"CMwBEIHaBCITCJDjhJ658YIDFdPGPwQdbyAKQg=="
trackingParamsstring"CMsBEO6YARgXIhMIkOOEnrnxggMV08Y_BB1vIApC"
titleTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Comments"
commentsCountobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"25K"
showSeparatorbooleantrue
customEmojisarray61 items ยท schema from #0 61 items
emojiIdstring"UCkszU2WH9gy1mb0dV-11UJg/7cIfY5niDOmSkNAP08CA6A4"
shortcutsarray1 item ยท schema from #0 1 item
0string":"
1string"e"
2string"y"
3string"e"
4string"s"
5string"-"
6string"p"
7string"u"
8string"r"
9string"p"
10string"l"
11string"e"
12string"-"
13string"c"
14string"r"
15string"y"
16string"i"
17string"n"
18string"g"
19string":"
searchTermsarray1 item ยท schema from #0 1 item
0string"e"
1string"y"
2string"e"
3string"s"
4string"-"
5string"p"
6string"u"
7string"r"
8string"p"
9string"l"
10string"e"
11string"-"
12string"c"
13string"r"
14string"y"
15string"i"
16string"n"
17string"g"
imageobject2 fields
thumbnailsarray2 items ยท schema from #0 2 items
urlstring"https://yt3.ggpht.com/FrYgdeZPpvXs-6Mp305ZiimWJ0wV5bcVZctaUy80mnIdwe-Pโ€ฆ"
widthnumber24
heightnumber24
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"eyes-purple-crying"
isCustomEmojibooleantrue
unicodeEmojisUrlstring"https://www.gstatic.com/youtube/img/emojis/emojis-png-7.json"
loggingDirectivesobject3 fields
trackingParamsstring"CMsBEO6YARgXIhMIkOOEnrnxggMV08Y_BB1vIApC"
visibilityobject1 field
typesstring"12"
enableDisplayloggerExperimentbooleantrue
slotstring"RELOAD_CONTINUATION_SLOT_HEADER"
commentsarray1 item ยท schema from #0 1 item
commentThreadRendererobject6 fields
commentobject1 field
commentRendererobject17 fields
authorTextobject1 field
simpleTextstring"@shivam3vedi"
authorThumbnailobject2 fields
thumbnailsarray3 items ยท schema from #0 3 items
urlstring"https://yt3.ggpht.com/ytc/APkrFKb8j_CWoKBXJFgOwsR2xNnhnRaBZluuESy6PiP9โ€ฆ"
widthnumber48
heightnumber48
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"@shivam3vedi"
authorEndpointobject3 fields
clickTrackingParamsstring"CMMBELZ1IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject4 fields
urlstring"/channel/UCdJWSUcim5IfrGW-f0RPPlQ"
webPageTypestring"WEB_PAGE_TYPE_CHANNEL"
rootVenumber3611
apiUrlstring"/youtubei/v1/browse"
browseEndpointobject2 fields
browseIdstring"UCdJWSUcim5IfrGW-f0RPPlQ"
canonicalBaseUrlstring"/channel/UCdJWSUcim5IfrGW-f0RPPlQ"
contentTextobject1 field
runsarray3 items ยท schema from #0 3 items
textstring"I love how he conveyed this story"
publishedTimeTextobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"6 months ago"
navigationEndpointobject3 fields
clickTrackingParamsstring"CMMBELZ1IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"/watch?v=bGZplqeIb3w&lc=UgxKe4k0P1jv5g_MIAZ4AaABAg"
webPageTypestring"WEB_PAGE_TYPE_WATCH"
rootVenumber3832
watchEndpointobject2 fields
videoIdstring"bGZplqeIb3w"
paramsstring"ehpVZ3hLZTRrMFAxanY1Z19NSUFaNEFhQUJBZ6ICA8ABAA%3D%3D"
isLikedbooleanfalse
commentIdstring"UgxKe4k0P1jv5g_MIAZ4AaABAg"
actionButtonsobject1 field
commentActionButtonsRendererobject6 fields
likeButtonobject1 field
toggleButtonRendererobject12 fields
styleobject1 field
styleTypestring"STYLE_TEXT"
sizeobject1 field
sizeTypestring"SIZE_DEFAULT"
isToggledbooleanfalse
isDisabledbooleanfalse
defaultIconobject1 field
iconTypestring"LIKE"
trackingParamsstring"CMkBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
defaultTooltipstring"Like"
toggledTooltipstring"Unlike"
toggledStyleobject1 field
styleTypestring"STYLE_DEFAULT_ACTIVE"
defaultNavigationEndpointobject3 fields
clickTrackingParamsstring"CMkBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passiโ€ฆ"
webPageTypestring"WEB_PAGE_TYPE_UNKNOWN"
rootVenumber83769
signInEndpointobject1 field
nextEndpointobject3 fields
clickTrackingParamsstring"CMkBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"/watch?v=bGZplqeIb3w"
webPageTypestring"WEB_PAGE_TYPE_WATCH"
rootVenumber3832
watchEndpointobject1 field
videoIdstring"bGZplqeIb3w"
accessibilityDataobject1 field
accessibilityDataobject1 field
labelstring"Like this comment along with 13,767 other people"
toggledAccessibilityDataobject1 field
accessibilityDataobject1 field
labelstring"Unlike"
replyButtonobject1 field
buttonRendererobject5 fields
stylestring"STYLE_TEXT"
sizestring"SIZE_DEFAULT"
textobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Reply"
navigationEndpointobject3 fields
clickTrackingParamsstring"CMgBEPBbIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passiโ€ฆ"
webPageTypestring"WEB_PAGE_TYPE_UNKNOWN"
rootVenumber83769
signInEndpointobject1 field
nextEndpointobject3 fields
clickTrackingParamsstring"CMgBEPBbIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"/watch?v=bGZplqeIb3w"
webPageTypestring"WEB_PAGE_TYPE_WATCH"
rootVenumber3832
watchEndpointobject1 field
videoIdstring"bGZplqeIb3w"
trackingParamsstring"CMgBEPBbIhMIkOOEnrnxggMV08Y_BB1vIApC"
dislikeButtonobject1 field
toggleButtonRendererobject12 fields
styleobject1 field
styleTypestring"STYLE_TEXT"
sizeobject1 field
sizeTypestring"SIZE_DEFAULT"
isToggledbooleanfalse
isDisabledbooleanfalse
defaultIconobject1 field
iconTypestring"DISLIKE"
trackingParamsstring"CMcBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
defaultTooltipstring"Dislike"
toggledTooltipstring"Remove dislike"
toggledStyleobject1 field
styleTypestring"STYLE_DEFAULT_ACTIVE"
defaultNavigationEndpointobject3 fields
clickTrackingParamsstring"CMcBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"https://accounts.google.com/ServiceLogin?service=youtube&uilel=3&passiโ€ฆ"
webPageTypestring"WEB_PAGE_TYPE_UNKNOWN"
rootVenumber83769
signInEndpointobject1 field
nextEndpointobject3 fields
clickTrackingParamsstring"CMcBEJhNIhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject3 fields
urlstring"/watch?v=bGZplqeIb3w"
webPageTypestring"WEB_PAGE_TYPE_WATCH"
rootVenumber3832
watchEndpointobject1 field
videoIdstring"bGZplqeIb3w"
accessibilityDataobject1 field
accessibilityDataobject1 field
labelstring"Dislike this comment"
toggledAccessibilityDataobject1 field
accessibilityDataobject1 field
labelstring"Remove dislike"
trackingParamsstring"CMYBELV1IhMIkOOEnrnxggMV08Y_BB1vIApC"
protoCreationMsstring"1701543967872"
stylestring"COMMENT_ACTION_BUTTON_STYLE_TYPE_DESKTOP_TOOLBAR"
authorIsChannelOwnerbooleanfalse
voteStatusstring"INDIFFERENT"
trackingParamsstring"CMMBELZ1IhMIkOOEnrnxggMV08Y_BB1vIApC"
voteCountobject2 fields
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"13K likes"
simpleTextstring"13K"
expandButtonobject1 field
buttonRendererobject5 fields
stylestring"STYLE_TEXT"
sizestring"SIZE_DEFAULT"
textobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Read more"
accessibilityobject1 field
labelstring"Read more"
trackingParamsstring"CMUBEK_YAiITCJDjhJ658YIDFdPGPwQdbyAKQg=="
collapseButtonobject1 field
buttonRendererobject5 fields
stylestring"STYLE_TEXT"
sizestring"SIZE_DEFAULT"
textobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"Show less"
accessibilityobject1 field
labelstring"Show less"
trackingParamsstring"CMQBELDYAiITCJDjhJ658YIDFdPGPwQdbyAKQg=="
authorCommentBadgeobject1 field
authorCommentBadgeRendererobject4 fields
iconobject1 field
iconTypestring"CHECK"
authorTextobject2 fields
accessibilityobject1 field
accessibilityDataobject1 field
labelstring"@shivam3vedi, verified user"
simpleTextstring"@shivam3vedi"
authorEndpointobject3 fields
clickTrackingParamsstring"CMMBELZ1IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject4 fields
urlstring"/channel/UCdJWSUcim5IfrGW-f0RPPlQ"
webPageTypestring"WEB_PAGE_TYPE_CHANNEL"
rootVenumber3611
apiUrlstring"/youtubei/v1/browse"
browseEndpointobject2 fields
browseIdstring"UCdJWSUcim5IfrGW-f0RPPlQ"
canonicalBaseUrlstring"/channel/UCdJWSUcim5IfrGW-f0RPPlQ"
iconTooltipstring"Verified"
replyCountnumber66
loggingDirectivesobject3 fields
trackingParamsstring"CMMBELZ1IhMIkOOEnrnxggMV08Y_BB1vIApC"
visibilityobject1 field
typesstring"12"
enableDisplayloggerExperimentbooleantrue
repliesobject1 field
commentRepliesRendererobject5 fields
contentsarray1 item ยท schema from #0 1 item
continuationItemRendererobject2 fields
triggerstring"CONTINUATION_TRIGGER_ON_ITEM_SHOWN"
continuationEndpointobject3 fields
clickTrackingParamsstring"CMABEL51IhMIkOOEnrnxggMV08Y_BB1vIApC"
commandMetadataobject1 field
webCommandMetadataobject2 fields
sendPostbooleantrue
apiUrlstring"/youtubei/v1/next"
continuationCommandobject2 fields
tokenstring"Eg0SC2JHWnBscWVJYjN3GAYygwEaUBIaVWd4S2U0azBQMWp2NWdfTUlBWjRBYUFCQWciAgโ€ฆ"
requeststring"CONTINUATION_REQUEST_TYPE_WATCH_NEXT"
trackingParamsstring"CMABEL51IhMIkOOEnrnxggMV08Y_BB1vIApC"
viewRepliesobject1 field
buttonRendererobject4 fields
textobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"66 replies"
iconobject1 field
iconTypestring"ARROW_DROP_DOWN"
trackingParamsstring"CMIBEKLABCITCJDjhJ658YIDFdPGPwQdbyAKQg=="
iconPositionstring"BUTTON_ICON_POSITION_TYPE_LEFT_OF_TEXT"
hideRepliesobject1 field
buttonRendererobject4 fields
textobject1 field
runsarray1 item ยท schema from #0 1 item
textstring"66 replies"
iconobject1 field
iconTypestring"ARROW_DROP_UP"
trackingParamsstring"CMEBENvNBCITCJDjhJ658YIDFdPGPwQdbyAKQg=="
iconPositionstring"BUTTON_ICON_POSITION_TYPE_LEFT_OF_TEXT"
targetIdstring"comment-replies-item-UgxKe4k0P1jv5g_MIAZ4AaABAg"
trackingParamsstring"CL8BEMJ1GAIiEwiQ44SeufGCAxXTxj8EHW8gCkI="
renderingPrioritystring"RENDERING_PRIORITY_UNKNOWN"
isModeratedElqCommentbooleanfalse
loggingDirectivesobject3 fields
trackingParamsstring"CL8BEMJ1GAIiEwiQ44SeufGCAxXTxj8EHW8gCkI="
visibilityobject1 field
typesstring"12"
enableDisplayloggerExperimentbooleantrue
nextCursorstring"Eg0SC2JHWnBscWVJYjN3GAYy6QIKvwJnZXRfcmFua2VkX3N0cmVhbXMtLUNxUUJDSUFFRlโ€ฆ"

Response Codes

Status codes this endpoint can return, so you can handle errors before they surprise you in production.

200SuccessSuccessful Response
422Client ErrorValidation Error
491Client ErrorToken not found
492Client ErrorEmail not verified
493Client ErrorSubscription expired
495Client ErrorAll daily units used
500Server ErrorSomething went wrong

API Pricing

2 units Cost per successful call to this endpoint.

Fetch Youtube Data at Scale

Crawl YouTube comment data and feed it into your sentiment analysis or community research workflows without the scraping overhead.

deco-icon

Full Comment Data

Get comment text, author info, and like counts per comment.

deco-icon

Reply Threads

Reconstruct nested reply conversations under any YouTube video.

deco-icon

Sentiment Ready

Feed clean comment text straight into sentiment analysis tools.