Last active
April 12, 2025 11:57
-
-
Save thlorenz/73e3d1e91db9dc4f575c6de647eb01e0 to your computer and use it in GitHub Desktop.
Get Di.fm and related stations playlist for all channels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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