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

yt-streamer

v6.7.23

Published

YouTube downloader

Downloads

185

Readme

yt-streamer

A Node.js YouTube downloader with support for YouTube, Instagram, and TikTok

Installation

npm install yt-streamer

Usage

YouTube Download (yt-dlp based)

const { DownloadMusic, DownloadVideo } = require('yt-streamer');
const fs = require('fs');

(async () => {
  // Download audio (M4A format)
  const audioPath = await DownloadMusic('VIDEO_ID');
  const audioBuffer = fs.readFileSync(audioPath);
  
  // Download video (default: 480p, MP4 format)
  const videoPath = await DownloadVideo('VIDEO_ID');
  const videoBuffer = fs.readFileSync(videoPath);
  
  // Download video with custom quality (720p, 1080p, etc.)
  const hdVideoPath = await DownloadVideo('VIDEO_ID', '720');
  const hdVideoBuffer = fs.readFileSync(hdVideoPath);
})();

YouTube API (Fast, URL-based)

const { YouTubeDL } = require('yt-streamer');

(async () => {
  const result = await YouTubeDL('https://www.youtube.com/watch?v=VIDEO_ID');
  console.log(result);
  // Returns: { title, vid, url, quality: "360p", type: "mp4" }
  
  // Use the URL to stream or download
  const response = await fetch(result.url);
  const videoBuffer = await response.arrayBuffer();
})();

Usage Tubidy


const { searchTubidy, getDetail } = require('yt-streamer');

(async () => {
  const results = await searchTubidy('eminem');
  const detail = await getDetail(results[0].link);
  console.log(detail);
})();

Instagram Download

const { InstagramDL } = require('yt-streamer');

(async () => {
  const result = await InstagramDL('https://www.instagram.com/p/POST_ID/');
  console.log(result);
  // Returns: { type: "video|image", url, quality, size, title, vid }
  
  // Download the media
  const response = await fetch(result.url);
  const mediaBuffer = await response.arrayBuffer();
})();

TikTok Download

const { TikTokDL } = require('yt-streamer');

(async () => {
  const result = await TikTokDL('https://www.tiktok.com/@user/video/VIDEO_ID');
  console.log(result);
  // Returns: { title, author, thumbnail, url }
  
  // Download the video
  const response = await fetch(result.url);
  const videoBuffer = await response.arrayBuffer();
})();

Function Details

DownloadMusic(videoId)

  • Downloads audio in M4A format using yt-dlp
  • Returns: File path to downloaded audio
  • Quality: Best available audio

DownloadVideo(videoId, quality = "480")

  • Downloads video in MP4 format using yt-dlp
  • Returns: File path to downloaded video
  • Quality: Default 480p, customizable (720, 1080, etc.)

YouTubeDL(url)

  • Fast API-based YouTube URL extraction
  • Returns: Object with title, video ID, direct URL, and quality info
  • Quality: 360p MP4

InstagramDL(url)

  • Instagram media URL extraction
  • Returns: Object with media type, URL, quality, and metadata
  • Supports: Videos and images

TikTokDL(url)

  • TikTok video URL extraction
  • Returns: Object with title, author, thumbnail, and video URL
  • Supports: TikTok videos

Notes

  • The DownloadMusic and DownloadVideo functions download files to disk
  • The API-based functions (YouTubeDL, InstagramDL, TikTokDL) return direct URLs for streaming
  • API functions are faster but may have quality limitations
  • yt-dlp functions are slower but offer better quality and reliability

Owner: Diegoson