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

@pigeonmal/react-native-youtube-downloader

v1.0.5

Published

Simple youtube extractor stream

Readme


🎥 @pigeonmal/react-native-youtube-downloader

A React Native TurboModule for extracting YouTube stream information (audio & video) directly from video IDs. Provides detailed playback metadata including formats, loudness data, and stream URLs.

A special thanks for Innertube implementation in android, newPipeExtractor, and Metrolist


🚀 Features

  • Extract YouTube video and audio stream URLs.
  • Supports configurable audio and video quality.
  • Returns rich metadata (bitrate, MIME type, quality label, etc.).
  • Built on React Native TurboModule for high performance.
  • Fully typed with TypeScript.

📦 Installation

# Using npm
npm install @pigeonmal/react-native-youtube-downloader

# Or with yarn
yarn add @pigeonmal/react-native-youtube-downloader

For React Native 0.71+ this module should link automatically. If not, follow standard TurboModule setup in your native code.


🔧 Usage

import YoutubeDownloader, { VideoQuality } from '@pigeonmal/react-native-youtube-downloader';
import type { ExtractStreamProps, PlaybackData } from '@pigeonmal/react-native-youtube-downloader';

const options: ExtractStreamProps = {
  videoId: 'dQw4w9WgXcQ', // YouTube video ID
  audioQuality: 'HIGH',
  videoQuality: VideoQuality.QUALITY_1080P,
};

async function getStreamData() {
  try {
    const streamData: PlaybackData = await YoutubeDownloader.extractYoutubeStream(options);
    console.log('Stream Data:', streamData);
  } catch (error) {
    console.error('Failed to extract stream:', error);
  }
}

🧠 API Reference

extractYoutubeStream(options: ExtractStreamProps): Promise<PlaybackData>

Extracts the playback data for a YouTube video.

Parameters

| Name | Type | Required | Description | | ------------------ | --------------------------- | -------- | ------------------------------------------ | | videoId | string | ✅ | The YouTube video ID | | audioQuality | 'AUTO' \| 'LOW' \| 'HIGH' | ✅ | Audio quality preference | | playlistId | string | ❌ | Optional playlist ID for context | | videoQuality | number | ❌ | Desired video resolution (e.g., 720, 1080) | | cookie | string | ❌ | Optional authentication cookie | | forceVisitorData | string | ❌ | Optional YouTube visitor data override |

Returns

A Promise resolving to a PlaybackData object containing:

  • audioStream: StreamPlayback — audio stream info and URL.
  • videoStream: StreamPlayback — video stream info and URL (if applicable).
  • videoDetails: VideoDetails — metadata like title, author, and duration.
  • audioConfig: AudioConfig — loudness and perceptual loudness levels.
  • streamExpiresInSeconds: number of seconds until stream expiration.

📄 Type Definitions

PlaybackData

interface PlaybackData {
  audioConfig?: AudioConfig;
  videoDetails?: VideoDetails;
  playbackTracking?: PlaybackTracking;
  streamExpiresInSeconds: number;
  audioStream: StreamPlayback;
  videoStream?: StreamPlayback;
  clientName: string;
}

AudioQuality

type AudioQuality = 'AUTO' | 'LOW' | 'HIGH';

AUTO = if wifi ? HIGHT else LOW

VideoQuality (enum)

enum VideoQuality {
  AUTO = -1,
  QUALITY_144P = 144,
  QUALITY_240P = 240,
  QUALITY_360P = 360,
  QUALITY_480P = 480,
  QUALITY_720P = 720,
  QUALITY_1080P = 1080,
  QUALITY_1440P = 1440,
  QUALITY_2160P = 2160,
}

AUTO = if wifi ? 1080p else 720p

🧑‍💻 Contributing

Pull requests are welcome! If you encounter issues or want to suggest improvements, please open an issue.


🪪 License

This project is open source and available under the MIT License