YouTube downloader
npm install yt-streamerbash
npm install yt-streamer
`Usage
$3
`javascript
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);
})();
`$3
`javascript
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
`javascriptconst { searchTubidy, getDetail } = require('yt-streamer');
(async () => {
const results = await searchTubidy('eminem');
const detail = await getDetail(results[0].link);
console.log(detail);
})();
`
$3
`javascript
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();
})();
`$3
`javascript
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
$3
- Downloads audio in M4A format using yt-dlp
- Returns: File path to downloaded audio
- Quality: Best available audio$3
- Downloads video in MP4 format using yt-dlp
- Returns: File path to downloaded video
- Quality: Default 480p, customizable (720, 1080, etc.)$3
- Fast API-based YouTube URL extraction
- Returns: Object with title, video ID, direct URL, and quality info
- Quality: 360p MP4$3
- Instagram media URL extraction
- Returns: Object with media type, URL, quality, and metadata
- Supports: Videos and images$3
- TikTok video URL extraction
- Returns: Object with title, author, thumbnail, and video URL
- Supports: TikTok videosNotes
- The DownloadMusic and DownloadVideo functions download files to disk
- The API-based functions (YouTubeDL, InstagramDL, TikTokDL`) return direct URLs for streaming---
Owner: Diegoson