Get video comments
Fetch all comment threads for a video. Auto-paginates.
Path Parameters
videoId*string
Video ID or URL
Query Parameters
order?string
Sort order
Default
"time"Value in
"time" | "relevance"maxResults?integer
Max total results
Default
100search?string
Filter by keyword
Response Body
application/json
application/json
import { Router } from 'express'import { client } from '../lib.js'const router = Router()router.get('/comments/:videoId', async (req, res) => { const { videoId } = req.params const maxResults = req.query.maxResults ? Number(req.query.maxResults) : 100 const threads = await client!.comments(videoId, { order: req.query.order as any, searchTerms: req.query.search as string, maxResults, }) res.json(threads)})export const routes = router[
{
"id": "string",
"videoId": "string",
"channelId": "string",
"topLevelComment": {
"id": "string",
"authorName": "string",
"authorProfileImage": "string",
"authorChannelUrl": "string",
"authorChannelId": "string",
"text": "string",
"likeCount": 0,
"publishedAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"parentId": "string"
},
"totalReplyCount": 0,
"canReply": true,
"isPublic": true,
"replies": [
{
"id": "string",
"authorName": "string",
"authorProfileImage": "string",
"authorChannelUrl": "string",
"authorChannelId": "string",
"text": "string",
"likeCount": 0,
"publishedAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z",
"parentId": "string"
}
]
}
]{
"error": {
"code": 0,
"message": "string",
"details": [
"string"
]
}
}