npm install ytb-js
This package is built on top of googleapis and is basically a simplified version of the youtube v3 api.
// javascript
const { Youtube } = require('ytb-js');
// typescript
import { Youtube } from 'ytb-js';
const youtube = new Youtube("YOUR_API_KEY");
// This will return a JSON object that has data about the first 10 videos that the api found
ytb.search({ q: "Cat Videos", maxResults: 10 }).then((result) => {
console.log(result);
});
// This will return a JSON object that has data about the specified channel(s)
yt.searchChannels({ part: ["snippet"], forUsername: "jacksepticeye" }).then((result) => {
console.log(result);
});
// This will return a JSON object that has data about the comments of the specified video
yt.getVideoComments({ part: ["snippet"], videoId: "aV8bxGs3Wy4" }).then((result) => {
console.log(result);
});