Get top comments
Fetch top comments sorted by relevance.
Path Parameters
videoId*string
Video ID or URL
Query Parameters
limit?integer
Max results to return
Default
10Response Body
application/json
application/json
import { Router } from 'express'import { client } from '../lib.js'const router = Router()router.get('/comments/:videoId/top', async (req, res) => { const { videoId } = req.params const limit = req.query.limit ? Number(req.query.limit) : 10 const threads = await client!.topComments(videoId, limit) 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"
]
}
}