/**
* Safely parses YouTube API numeric strings to numbers
* @param value - String value from YouTube API that represents a number
* @returns Parsed number or 0 if parsing fails, null, undefined, or empty
*/
export function parseYouTubeNumber(value: string | undefined | null): number {
if (value === null || value === undefined || value === "") {
return 0;
}
const parsed = parseInt(String(value), 10);
return isNaN(parsed) ? 0 : parsed;
}
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kirbah/mcp-youtube'
If you have feedback or need assistance with the MCP directory API, please join our Discord server