@kevinwatt/yt-dlp-mcp
Version:
An MCP server implementation that integrates with yt-dlp, providing video and audio content download capabilities (e.g. YouTube, Facebook, Tiktok, etc.) for LLMs.
23 lines • 1.09 kB
JavaScript
export function resolveCommentRequestOptions(input) {
const maxComments = clampInteger(input.maxComments, 1);
return {
maxComments,
sortOrder: input.sortOrder ?? "top",
view: input.view ?? "flat",
responseFormat: input.responseFormat ?? "json",
maxParents: clampInteger(input.maxParents ?? maxComments, 0),
maxReplies: clampInteger(input.maxReplies ?? maxComments, 0),
maxRepliesPerThread: clampInteger(input.maxRepliesPerThread ?? maxComments, 0),
maxDepth: clampInteger(input.maxDepth ?? 2, 1),
};
}
export function buildCommentExtractorArgs(options) {
return `youtube:comment_sort=${options.sortOrder};max_comments=${options.maxComments},${options.maxParents},${options.maxReplies},${options.maxRepliesPerThread},${options.maxDepth}`;
}
export function countThreadComments(comment) {
return 1 + comment.replies.reduce((sum, reply) => sum + countThreadComments(reply), 0);
}
function clampInteger(value, minimum) {
return Math.max(minimum, Math.trunc(value));
}
//# sourceMappingURL=comments-types.js.map