Skip to content

Instantly share code, notes, and snippets.

@thlorenz
Last active April 12, 2025 11:57
Show Gist options
  • Select an option

  • Save thlorenz/73e3d1e91db9dc4f575c6de647eb01e0 to your computer and use it in GitHub Desktop.

Select an option

Save thlorenz/73e3d1e91db9dc4f575c6de647eb01e0 to your computer and use it in GitHub Desktop.
Get Di.fm and related stations playlist for all channels
// Run from: https://www.jazzradio.com/member/favorite/channels
const KEY = '<yourkeyhere>'
function getChannelInfos() {
const classes = document.getElementsByClassName('header-channel-nav__link')
const infos = []
for (let i = 0; i < classes.length; i++) {
const id = classes[i].href.split('/').pop()
const title = classes[i].innerText.trim()
infos.push({ id, title })
}
return infos
}
function channelInfoToPlaylistEntry(info, idx) {
const slot = idx + 1
return `File${slot}=http://prem4.jazzradio.com:80/${info.id}?${KEY}
Title${slot}=JAZZRADIO.com - ${info.title}
Length${slot}=0`
}
const channelInfos = getChannelInfos()
const entries = channelInfos.map(channelInfoToPlaylistEntry)
const playlist = `
[playlist]
NumberOfEntries=${entries.length}
${entries.join('\n')}
Version=2
`
console.log(playlist)
copy(playlist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment