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 🙏

© 2026 – Pkg Stats / Ryan Hefner

radio-dl

v1.0.0

Published

Stream and record 1100+ live radio stations from 42 countries. Discord bot compatible.

Readme

radio-dl

Eine JavaScript-Library zum Streamen von Live-Radiostationen. Ähnlich wie ytdl, aber spezialisiert auf Live-Radio-Streaming mit über 1100+ internationalen Sendern.

Features

  • 🎙️ Streamen von 1100+ Live-Radiostationen
  • 📻 Unterstützung für verschiedene Radio-Formate (M3U, PLS, Shoutcast, Icecast)
  • 🎵 Metadaten-Abruf (Station-Name, Genre, Bitrate)
  • 📊 Stream-Qualitäts-Management
  • 🔄 Resiliente Stream-Verbindungen mit FFmpeg
  • 🔐 Cookie-basierte Authentifizierung für geschützte Streams
  • 🌍 42 Länder mit Sendern
  • 🎸 30+ verschiedene Musik-Genres
  • 🔍 Suche & Filter Funktionen
  • 💾 MP3 Aufnahme (30 Sekunden bis unbegrenzt)

Installation

npm install radio-dl

Abhängigkeiten:

  • FFmpeg (für Audio-Verarbeitung) - Download
  • Node.js 12+

Schnellstart

const RadioDownloader = require('radio-dl');

const radio = new RadioDownloader();

// Stream starten (z.B. für Discord Bot)
const stream = await radio.stream('energy');
// oder direkt mit URL
const stream = await radio.stream('https://ice1.somafm.com/groovesalad-128-aac');

API Referenz

Klasse: RadioDownloader

new RadioDownloader(options)

Parameter:

{
  timeout: 30000,           // Stream-Timeout in ms
  userAgent: '...',         // Custom User-Agent
  maxRedirects: 5,          // Max. HTTP Redirects
  retryAttempts: 3          // Retry-Versuche
}

Stream-Methoden

stream(stationKeyOrUrl, options)

Startet einen Audio-Stream.

Parameter:

  • stationKeyOrUrl - Station-Key (z.B. 'energy') oder URL
  • options - Optional: { headers: {...} }

Returns: Promise - Nodejs ReadableStream

Beispiel:

// Mit Station-Key
const stream = await radio.stream('energy');

// Mit URL
const stream = await radio.stream('https://example.com/stream.mp3');

// Mit Custom Headers
const stream = await radio.stream('bigfm', {
  headers: { 'Authorization': 'Bearer token' }
});

streamStation(stationKey, options)

Startet Stream einer vordefinierten Station.

Parameter:

  • stationKey - Name der Station (z.B. 'energy', 'bigfm', 'rockantenne')
  • options - Optional

Returns: Promise

Beispiel:

const stream = await radio.streamStation('energy');

Aufnahme-Methoden

recordStream(stationKeyOrUrl, outputPath, duration)

Nimmt einen Stream auf und speichert als MP3.

Parameter:

  • stationKeyOrUrl - Station oder URL
  • outputPath - Pfad zur Output MP3 Datei
  • duration - Dauer in Sekunden (default: 30)

Returns: Promise<{success, file, station, duration, size}>

Beispiel:

const result = await radio.recordStream('energy', './radio.mp3', 30);
console.log(result);
// {
//   success: true,
//   file: './radio.mp3',
//   station: 'Energy',
//   duration: 30,
//   size: 567890
// }

recordMultipleStations(stationArray, outputDir, duration)

Nimmt mehrere Stationen nacheinander auf.

Parameter:

  • stationArray - Array von Stations-Keys
  • outputDir - Output-Ordner
  • duration - Dauer pro Station in Sekunden

Returns: Promise

Beispiel:

const results = await radio.recordMultipleStations(
  ['energy', 'bigfm', 'rockantenne'],
  './downloads',
  30
);

Such & Filter Methoden

getAllStations()

Gibt alle 1100+ Stationen als Array zurück.

Returns: Array<{id, name, url, genre, country}>

const allStations = radio.getAllStations();
console.log(allStations[0]);
// {
//   id: 'energy',
//   name: 'Energy',
//   url: 'https://...',
//   genre: 'Pop',
//   country: 'DE'
// }

getAvailableStations()

Gibt nur die Station-Keys zurück.

Returns: Array

const keys = radio.getAvailableStations();
// ['energy', 'bigfm', 'rockantenne', ...]

getStationsByGenre(genre)

Findet Stationen nach Genre.

Parameter:

  • genre - Genre-Name (z.B. 'Rock', 'Pop', 'Jazz')

Returns: Array

const rockStations = radio.getStationsByGenre('Rock');
// Findet alle Rock-Sender

getStationsByCountry(country)

Findet Stationen nach Länder-Code.

Parameter:

  • country - 2-Buchstaben Länder-Code (z.B. 'DE', 'US', 'UK')

Returns: Array

const germanRadios = radio.getStationsByCountry('DE');
// Findet alle deutschen Sender

searchStations(keyword)

Sucht Stationen nach Keyword.

Parameter:

  • keyword - Suchtext

Returns: Array

const results = radio.searchStations('jazz');
// Findet alle Stationen mit 'jazz' im Namen/Genre/etc.

getRandomStation()

Gibt eine zufällige Station zurück.

Returns: Station

const random = radio.getRandomStation();
console.log(random.name); // z.B. "Berlin Jazz Radio"

getStationInfo(stationKey)

Gibt Info zu einer spezifischen Station.

Parameter:

  • stationKey - Station-ID

Returns: Station | undefined

const station = radio.getStationInfo('energy');

getStats()

Gibt Statistiken über die Sender-Datenbank.

Returns: {totalStations, totalCountries, totalGenres, countries[], genres[]}

const stats = radio.getStats();
// {
//   totalStations: 1100+,
//   totalCountries: 42,
//   totalGenres: 30,
//   countries: ['DE', 'AT', 'US', ...],
//   genres: ['Pop', 'Rock', 'Jazz', ...]
// }

Praktische Beispiele

Discord Bot Integration

const discord = require('discord.js');
const RadioDownloader = require('radio-dl');

const radio = new RadioDownloader();
const client = new discord.Client();

client.on('message', async (message) => {
  if (message.content.startsWith('!radio ')) {
    const stationKey = message.content.replace('!radio ', '').trim();
    
    try {
      // Stream starten
      const stream = await radio.stream(stationKey);
      
      // In Voice Channel abspielen
      const voiceChannel = message.member.voice.channel;
      const connection = await voiceChannel.join();
      const dispatcher = connection.play(stream, { type: 'unknown' });
      
      message.reply(`🎙️ Jetzt am streamen: ${stationKey}`);
    } catch (error) {
      message.reply(`❌ Fehler: ${error.message}`);
    }
  }
});

Radio aufnehmen

const radio = new RadioDownloader();

// 60 Sekunden aufnehmen
await radio.recordStream('energy', './record.mp3', 60);

// Mehrere Sender
await radio.recordMultipleStations(
  ['energy', 'bigfm', 'rockantenne'],
  './downloads',
  30
);

Zufällige Station

const radio = new RadioDownloader();

// Zufälligen Sender streamen
const randomStation = radio.getRandomStation();
const stream = await radio.stream(randomStation.id);

console.log(`Jetzt: ${randomStation.name}`);

Nach Genre filtern

const radio = new RadioDownloader();

// Alle Rock-Sender
const rockStations = radio.getStationsByGenre('Rock');

// Ersten wählen
const station = rockStations[0];
const stream = await radio.stream(station.id);

Verfügbare Länder (42)

DE, AT, CH, UK, FR, ES, IT, BE, NL, SE, NO, DK, FI, PL, CZ, HU, RO, GR, PT, US, CA, AU, NZ, JP, IN, BR, MX, RU, KR, SG, TR, ZA, IE, IL, AE, TH, MY, PH, ID, VN, CN, TW, HK


Verfügbare Genres (30+)

Pop, Rock, Jazz, Classical, Electronic, Hip Hop, Country, News, Talk, Sports, Metal, Alternative, Indie, R&B, Reggae, Latin, World, Folk, Blues, Soul, Funk, Disco, Dance, House, Techno, Ambient, Experimental, Comedy, Podcast, Kids


Fehlerbehandlung

const radio = new RadioDownloader();

try {
  const stream = await radio.stream('energy');
  stream.on('error', (error) => {
    console.error('Stream Fehler:', error);
  });
} catch (error) {
  console.error('Fehler beim Starten:', error.message);
}

Lizenz

MIT

Autor

[Dein Name]