npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ytdlku

v1.0.1

Published

Lightweight YouTube downloader module with search, suggestions, and download capabilities

Readme

ytdlku

Lightweight YouTube downloader module with search, suggestions, and download capabilities. Supports both ESM and CommonJS with TypeScript.

Features

  • 🔍 YouTube Search - Search videos with customizable results
  • 💡 Search Suggestions - Get YouTube search suggestions
  • ℹ️ Video Information - Get detailed video metadata
  • 🎵 Audio Download - Download audio in MP3 format
  • 🎬 Video Download - Download video in MP4 format
  • 📱 Format Selection - Choose quality using itag
  • 🔑 API Key Support - Optional authentication

Installation

npm install ytdlku

Usage

Import

// ES Module
import YTDownloader from 'ytdlku';

// CommonJS
const YTDownloader = require('ytdlku').default;

Initialize

const yt = new YTDownloader({
  baseUrl: 'https://ytdl.siputzx.my.id', // optional
  apiKey: 'your-api-key', // optional
  timeout: 30000 // optional, default 30s
});

Search Suggestions

const suggestions = await yt.getSuggestions('kucing');
console.log(suggestions);
// ['kucing', 'kucing lucu', 'kucing berantem', ...]

Search Videos

const results = await yt.search('kucing', 10); // limit 10 results
console.log(results);
/*
[
  {
    type: 'video',
    id: 'bnVUHWCynig',
    title: 'Video Title',
    thumbnail: 'https://...',
    channel: { name: '...', id: '...', url: '...' },
    views: '1,000 views',
    published: '2 days ago',
    url: 'https://youtube.com/watch?v=...'
  }
]
*/

Get Video Information

const info = await yt.getVideoInfo('bnVUHWCynig');
console.log(info);
/*
{
  id: 'bnVUHWCynig',
  title: 'Video Title',
  description: '...',
  duration: '3:45',
  thumbnail: 'https://...',
  video_formats: [...],
  audio_formats: [...],
  // ... more info
}
*/

Download Audio (Simple)

// Quick download - waits for completion
const downloadUrl = await yt.downloadAudioComplete(
  'https://youtube.com/watch?v=bnVUHWCynig',
  140
);
console.log('Download URL:', downloadUrl);

Download Video (Simple)

// Quick download - waits for completion
const downloadUrl = await yt.downloadVideoComplete(
  'https://youtube.com/watch?v=bnVUHWCynig',
  136
);
console.log('Download URL:', downloadUrl);

Manual Download Control

// Start download task
const task = await yt.downloadAudio('https://youtube.com/watch?v=...', 140);
console.log('Task ID:', task.taskId);

// Check status manually
const status = await yt.getDownloadStatus(task.taskId);
console.log('Status:', status.data.status);

// Or wait for completion with custom polling
const finalStatus = await yt.waitForDownload(task.taskId, 1000, 60); // 1s interval, 60 attempts
console.log('Download URL:', finalStatus.data.result.downloadUrl);

API Limits

| Feature | Free | Premium | |---------|------|---------| | Video Duration | 30 minutes | Unlimited | | File Size | 100MB | Unlimited | | Resolution | 720p | Unlimited | | Rate Limit | 10/10min | 100/10min |

Error Handling

try {
  const downloadUrl = await yt.downloadAudioComplete(url, 140);
  console.log('Success:', downloadUrl);
} catch (error) {
  console.error('Error:', error.message);
}

TypeScript

Full TypeScript support with interfaces:

import YTDownloader, { VideoInfo, SearchResult } from 'ytdlku';

const yt = new YTDownloader();
const info: VideoInfo = await yt.getVideoInfo('video_id');
const results: SearchResult[] = await yt.search('query');

License

MIT License

Support

For issues and feature requests, please visit the GitHub repository.