Skip to content

Instantly share code, notes, and snippets.

Last active September 3, 2023 00:46
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jonath92/0fd6419a2cfecbbe2f6b6d790dc84298 to your computer and use it in GitHub Desktop.
Create Radio Station list
// Usage: 1. Download as Zip 2. Run `npm i` 3. run `node getStations.js`
// Note that the process might take 1-2 minutes
import fetch from 'node-fetch';
import fs from 'fs';
import lodash from 'lodash';
const { uniqWith, uniqBy, isEqual, sortBy } = lodash;
async function main() {
const response = await fetch('')
const responseJson = await response.json()
const reducedProps = => {
const { name, url, ...others } = station
return { name: name.trim(), url: url.trim() }
const sorted = sortBy(reducedProps, 'name')
const onlyValue = => [, channel.url])
const unique = uniqWith(onlyValue, isEqual)
fs.writeFileSync('allStations.json', JSON.stringify(unique))
"name": "load-radio-stations",
"version": "1.0.0",
"main": "getAll.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"keywords": [],
"author": "Jonathan Heard",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.21",
"node-fetch": "^2.6.1"
"devDependencies": {},
"description": ""
Copy link

jonath92 commented Sep 5, 2021

This file has been used to create the radioStations list for the Radio++ Cinnamon Applet. I am planing to implement a Github Action which automatically updates the radio station List. The code is not very good to be honest - I wanted to get it work asap and improve it afterwards but haven't done it yet 😆. As soon the Update is part of the official Repo I will delete this gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment