yt-dlx
Version:
Effortless Audio-Video Downloader And Streamer!
27 lines • 933 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const colors_1 = __importDefault(require("colors"));
const youtubei_1 = require("youtubei");
async function searchPlaylists({ query }) {
try {
var youtube = new youtubei_1.Client();
var searchPlaylists = await youtube.search(query, {
type: "playlist",
});
var result = searchPlaylists.items.map((item) => ({
id: item.id,
title: item.title,
videoCount: item.videoCount,
thumbnails: item.thumbnails,
}));
return result;
}
catch (error) {
throw new Error(colors_1.default.red("@error: ") + error.message);
}
}
exports.default = searchPlaylists;
//# sourceMappingURL=searchPlaylists.js.map