2.2.3 • Published 2 years ago

radio-browser v2.2.3

Weekly downloads
98
License
MIT
Repository
github
Last release
2 years ago

RadioBrowser API Client

Nodejs module for Radio-browser API

Install

npm install radio-browser

Usage

Every method returns a promise so you have to use then and catch or async and await.

const RadioBrowser = require('radio-browser')

let filter = {
    limit: 5,          // list max 5 items
    by: 'tag',         // search in tag
    searchterm: 'jazz' // term in tag
}
RadioBrowser.getStations(filter)
    .then(data => console.log(data))
    .catch(error => console.error(error))

Methods

Properties

  • filter_by_types list of types using in getStations({by: {type}, ...})
  • category_types list of categories using in getCategory({type} ...)
  • service_url get or set the api-url. Default is null to get a random API host at first request.

Examples:

Get Server Stats from a random API-Host by using async/await

// file: examples/server-stats.js

const RadioBrowser = require('radio-browser')

const start = async () => {
    try {
        let data = await RadioBrowser.getServerStats()
        console.log(`API Server: ${RadioBrowser.service_url}`)
        console.log('stats', data)
    }
    catch (e) {
        console.error(e)
    }
}

start()
// example output
API Server: https://de1.api.radio-browser.info/
stats { supported_version: 1,
  software_version: '0.6.14',
  status: 'OK',
  stations: 25603,
  stations_broken: 767,
  tags: 6757,
  clicks_last_hour: 2707,
  clicks_last_day: 59547,
  languages: 374,
  countries: 246 }

Get the 5 top voted station

let filter = {
	by: 'topvote', // stations by topvote
	limit: 5    // top 5 stations
}
RadioBrowser.getStations(filter)
    .then(data => console.log(data))
    .catch(err => console.error(err))

data looks like this

2.2.3

2 years ago

2.2.2

2 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.10

3 years ago

2.1.9

3 years ago

2.1.8

4 years ago

2.1.7

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.0

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

1.5.3

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago