Get multiple videos
Batch fetch multiple videos by comma-separated IDs.
import { Router } from 'express'import { client } from '../lib.js'const router = Router()router.get('/videos', async (req, res) => { const ids = (req.query.ids as string)?.split(',').map(s => s.trim()) ?? [] const videos = await client!.videos(ids) res.json(videos)})export const routes = router[
{
"id": "string",
"title": "string",
"description": "string",
"channel": "string",
"channelId": "string",
"views": 0,
"viewsFmt": "string",
"likes": 0,
"likesFmt": "string",
"comments": 0,
"commentsFmt": "string",
"duration": 0,
"durationFmt": "string",
"published": "string",
"publishedAt": "string",
"thumbnails": {
"default": {
"url": "string",
"width": 0,
"height": 0
},
"medium": {
"url": "string",
"width": 0,
"height": 0
},
"high": {
"url": "string",
"width": 0,
"height": 0
},
"standard": {
"url": "string",
"width": 0,
"height": 0
},
"maxres": {
"url": "string",
"width": 0,
"height": 0
}
}
}
]{
"error": {
"code": 0,
"message": "string",
"details": [
"string"
]
}
}