Skip to content

Instantly share code, notes, and snippets.

@thlorenz
Last active February 10, 2023 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thlorenz/73e3d1e91db9dc4f575c6de647eb01e0 to your computer and use it in GitHub Desktop.
Save thlorenz/73e3d1e91db9dc4f575c6de647eb01e0 to your computer and use it in GitHub Desktop.
Get Di.fm and related stations playlist for all channels
// Run as a Chrome Snippetfrom either of the below urls:
// https://www.jazzradio.com/member/favorite/channels
// https://www.classicalradio.com/member/favorite/channels
// https://www.radiotunes.com/member/favorite/channels
// https://www.rockradio.com/member/favorite/channels
// https://www.zenradio.com/member/favorite/channels
const KEY = '<yourkeyhere>'
const subsidy = document.location.host.split('.')[1]
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}=https://listen.${subsidy}.com/premium_high/${info.id}.pls?${KEY}
Title${slot}=${info.title}
Length${slot}=0`
}
const channelInfos = getChannelInfos()
const entries = channelInfos.map(channelInfoToPlaylistEntry)
const playlist = `
[playlist]
NumberOfEntries=${entries.length}
${entries.join('\n')}
Version=2
`
copy(playlist)
/*
Get the below channelInfos by copy pasting a script that starts with `dip.app.start` (<script> tag)
Then run:
```js
const hash = x.channels.reduce((acc, c) => {
acc[c.key] = {
key: c.key,
title: c.name,
id: c.id,
desc: c.description_short,
}
return acc
}, {})
console.log(hash)
```
*/
const channelInfos = {
'00sclubhits': {
key: '00sclubhits',
title: '00s Club Hits',
id: 324,
desc: 'Your favorite dance tunes from the start of the decade. Familiar hits and overlooked classics in abundance.',
},
ambient: {
key: 'ambient',
title: 'Ambient',
id: 12,
desc: 'Electronic sounds and atmospheric textures create a genre to enhance your state of mind and take you deeper.',
},
atmosphericbreaks: {
key: 'atmosphericbreaks',
title: 'Atmospheric Breaks',
id: 403,
desc: 'Spaced out, melodic and full of warmth - these broken beat dance tunes will keep you dazed and amused.',
},
bassnjackinhouse: {
key: 'bassnjackinhouse',
title: "Bass & Jackin' House",
id: 290,
desc: 'From the funkiest grooves to the dirtiest beats. Hard-hitting, high energy 4/4 club cuts to move the masses.',
},
bassline: {
key: 'bassline',
title: 'Bassline',
id: 289,
desc: 'Blending together elements of house music, speed garage, and techno – it’s all about the low end frequencies.',
},
bigbeat: {
key: 'bigbeat',
title: 'Big Beat',
id: 325,
desc: 'Heavily focused on breakbeats and dusty samples. A defining 90s musical movement still going strong today.',
},
bigroomhouse: {
key: 'bigroomhouse',
title: 'Big Room House',
id: 209,
desc: 'Fusing together house elements from the past and the present - prime time music full of uplifting high energy.',
},
breaks: {
key: 'breaks',
title: 'Breaks',
id: 15,
desc: 'Inspired by hip hop and UK rave music, breaks features broken up drum loops and creative samples, synths and fx.',
},
chillntropicalhouse: {
key: 'chillntropicalhouse',
title: 'Chill & Tropical House',
id: 400,
desc: 'The sounds of Chill & Tropical House are expertly made for lounging and dancing alike with its deeper house vibes.',
},
chilledm: {
key: 'chilledm',
title: 'Chill EDM',
id: 504,
desc: 'Good EDM doesn’t have to blow out your speakers and our curated selection of Chill EDM is a testament to the strength of mellow, chilled out electronic music.',
},
chillhop: {
key: 'chillhop',
title: 'ChillHop',
id: 224,
desc: 'Mellow chill beats, lofi hip-hop, trip hop, downtempo beats and jazz, blended together in a laid back style for perfect listening.',
},
chillout: {
key: 'chillout',
title: 'Chillout',
id: 3,
desc: 'Electronic sounds, mellow mid-tempo rhythms, and a groove meant to calm the senses and ease the mind.',
},
chilloutdreams: {
key: 'chilloutdreams',
title: 'Chillout Dreams',
id: 68,
desc: 'The perfect musical soundtrack for when you want to close your eyes, get truly comfortable, and drift away.',
},
chillstep: {
key: 'chillstep',
title: 'Chillstep',
id: 275,
desc: 'The brilliant combination of dubstep rhythms with the mellow grooves of chillout. A unique sound all its own.',
},
classiceurodance: {
key: 'classiceurodance',
title: 'Classic EuroDance',
id: 69,
desc: 'European pop music born in the 90s full of high energy sounds and big hooks – now heard in gyms and malls worldwide.',
},
classiceurodisco: {
key: 'classiceurodisco',
title: 'Classic EuroDisco',
id: 183,
desc: 'Conceived in the European discos in the 70s, evolving through the decades into modern electronic masterpieces.',
},
classictrance: {
key: 'classictrance',
title: 'Classic Trance',
id: 90,
desc: 'The classic melodies, the epic breakdowns and gigantic builds. Re-experience Trance music in her prime.',
},
classicvocaltrance: {
key: 'classicvocaltrance',
title: 'Classic Vocal Trance',
id: 125,
desc: 'Classic sounds of Vocal Trance',
},
clubdubstep: {
key: 'clubdubstep',
title: 'Club Dubstep',
id: 177,
desc: 'The bassbin rattling, speaker-freaking hits of Dubstep – all tried, tested and approved to work in the clubs.',
},
russianclubhits: {
key: 'russianclubhits',
title: 'Club Hits (Slavic)',
id: 213,
desc: 'The hottest club hits.',
},
club: {
key: 'club',
title: 'Club Sounds',
id: 70,
desc: 'The music heard in the biggest venues worldwide. From prime time pushers to deeper house shakers - the sounds of now.',
},
darkdnb: {
key: 'darkdnb',
title: 'Dark DnB',
id: 181,
desc: 'Evil, gritty and twisted DnB / Drum & Bass. at 160+ BPM, hear the darkest basslines and the hardest hitting percussion.',
},
darkpsytrance: {
key: 'darkpsytrance',
title: 'Dark PsyTrance',
id: 346,
desc: 'The darker form of PsyTrance, which is a sound all its own – direct from Goa to your headphones.',
},
deephouse: {
key: 'deephouse',
title: 'Deep House',
id: 174,
desc: 'House music crafted for the smaller and mid-sized rooms - deeper tracks full of silky, smooth grooves.',
},
deepnudisco: {
key: 'deepnudisco',
title: 'Deep Nu-Disco',
id: 137,
desc: 'Elements of house, funk, and disco. Mid-tempo beats, soulful grooves and head nodding selections.',
},
deeporganichouse: {
key: 'deeporganichouse',
title: 'Deep Organic House',
id: 517,
desc: 'A deeper, more meditative, and slower pace of House music often featuring acoustic and ethnic instrumental samples.',
},
deepprogressivehouse: {
key: 'deepprogressivehouse',
title: 'Deep Progressive House',
id: 505,
desc: 'This smooth, groove-heavy selection of deep progressive house tracks is the perfect soundtrack for smaller and mid-sized rooms.',
},
deepprogressivetrance: {
key: 'deepprogressivetrance',
title: 'Deep Progressive Trance',
id: 520,
desc: 'A subgenre of Progressive Trance that features a deeper, more emotional and melodic sound.',
},
deeptech: {
key: 'deeptech',
title: 'Deep Tech',
id: 182,
desc: 'A fusion of deep house & techno. Punchy grooves, spaced out sounds and forward thinking productions.',
},
detroithousentechno: {
key: 'detroithousentechno',
title: 'Detroit House & Techno',
id: 353,
desc: 'Where would dance music be without Detroit? The city that started it all continues to inspire and educate. ',
},
discohouse: {
key: 'discohouse',
title: 'Disco House',
id: 92,
desc: 'The feel good sound inspired from 70s disco combined with the warm kick drum of modern house music.',
},
djmixes: {
key: 'djmixes',
title: 'DJ Mixes',
id: 10,
desc: 'From techno, deep house, progressive and trance – check out the sounds of the DJ deep in the mix.',
},
downtempolounge: {
key: 'downtempolounge',
title: 'Downtempo Lounge',
id: 180,
desc: 'Head nodding beats, chilled vocals, and lush soundscapes to bring down the sun and start the night.',
},
drumandbass: {
key: 'drumandbass',
title: 'Drum and Bass',
id: 13,
desc: 'Born in the mid 90s, Drum and Bass / DnB is all about fast breakbeats, urban vibes, and rib rattling basslines.',
},
drumstep: {
key: 'drumstep',
title: 'Drumstep',
id: 291,
desc: 'A hybrid of half-time Dubstep and intense Drum and Bass / DnB.',
},
dub: {
key: 'dub',
title: 'Dub',
id: 348,
desc: 'An emphasis on the bass and drums / DnB, delayed effects, sampled vocals and smokey Reggae inspired vibes.',
},
dubtechno: {
key: 'dubtechno',
title: 'Dub Techno',
id: 355,
desc: 'The beloved sounds of deep techno saturated with tape delays, heavy reverb and ice cold atmospherics.',
},
dubstep: {
key: 'dubstep',
title: 'Dubstep',
id: 91,
desc: 'The wobbles of the bass, the party rocking beats, and the biggest crowd destroying drops.',
},
edmfestival: {
key: 'edmfestival',
title: 'EDM Festival',
id: 210,
desc: 'The sound of the largest events. From the gargantuan festivals, the huge main rooms and the biggest DJs.',
},
edm: {
key: 'edm',
title: 'EDM Hits',
id: 474,
desc: 'Where dance meets pop. Crossover favorites, stadium-sized anthems and the biggest electronic tunes in existence.',
},
electro: {
key: 'electro',
title: 'Electro House',
id: 56,
desc: 'Buzzing basslines, huge kicks, party rocking drops. House music packed full of gigantic bass and massive synths.',
},
electroswing: {
key: 'electroswing',
title: 'Electro Swing',
id: 327,
desc: 'The combination of 1920s-1940s jazz and swing music, big band horns and modern day electro house.\r\n',
},
electronicpioneers: {
key: 'electronicpioneers',
title: 'Electronic Pioneers',
id: 280,
desc: 'The trailblazers, the renegades and the experimental musicians who gave early inspiration with electronic instruments.',
},
electropop: {
key: 'electropop',
title: 'Electropop',
id: 286,
desc: 'Catchy pop music blended together with vintage synthesizers and electronic instrumentation. ',
},
epictrance: {
key: 'epictrance',
title: 'Epic Trance',
id: 175,
desc: 'Trance in its most boisterous form. Uplifting melodies on top of high energy beats create these euphoric anthems.',
},
eurodance: {
key: 'eurodance',
title: 'EuroDance',
id: 6,
desc: 'Pop music infused with a high energy 4/4 pulse. Heavy on the synthesizers, the melodies and the vocals.',
},
funkyhouse: {
key: 'funkyhouse',
title: 'Funky House',
id: 58,
desc: 'Focused on the funkiest grooves, with plenty of the guitar licks and clever samples placed around a 4/4 swing.',
},
futurebass: {
key: 'futurebass',
title: 'Future Bass',
id: 424,
desc: 'Hard basslines, booming beats and insatiable grooves. Inspired by Trap, Juke and Garage - molded together into a unique booming style.',
},
futuregarage: {
key: 'futuregarage',
title: 'Future Garage',
id: 292,
desc: '2step Garage rhythms, chunky bass line driven grooves and plenty of forward thinking innovation.',
},
futuresynthpop: {
key: 'futuresynthpop',
title: 'Future Synthpop',
id: 53,
desc: 'Finest selection of futurepop and synthpop.',
},
gabber: {
key: 'gabber',
title: 'Gabber',
id: 16,
desc: 'The hardest form of techno with punishing tracks designed to drive the crowds into a sweaty frenzy.',
},
glitchhop: {
key: 'glitchhop',
title: 'Glitch Hop',
id: 198,
desc: 'The sound of digital malfunctions, electric hum and bit rate distortions perfectly placed alongside laid-back hip hop beats.',
},
goapsy: {
key: 'goapsy',
title: 'Goa-Psy Trance',
id: 8,
desc: 'A very psychedelic form of trance, Goa-Psy Trance is a sound full of arpeggiated synths and trippy effects.',
},
handsup: {
key: 'handsup',
title: 'Hands Up',
id: 176,
desc: 'A channel showcasing everything from hard dance, trance and happy hardcore to lift the spirits (and the arms).',
},
harddance: {
key: 'harddance',
title: 'Hard Dance',
id: 5,
desc: 'Concrete kicks and punching rhythms, hard dance is a tougher side of music with sharp edges and aggressive power.',
},
hardtechno: {
key: 'hardtechno',
title: 'Hard Techno',
id: 276,
desc: 'Tough as nails warehouse jams full of cold aggression, sinister structures and pounding rhythms that hit hard.',
},
hardcore: {
key: 'hardcore',
title: 'Hardcore',
id: 9,
desc: 'Strictly for the hardcore. These are the biggest and boldest bangers, and the hardest hitting tracks.',
},
hardstyle: {
key: 'hardstyle',
title: 'Hardstyle',
id: 60,
desc: 'Hard techno & hardcore. A global phenomenon with powerful kicks, distorted effects and infectious melodies.',
},
house: {
key: 'house',
title: 'House',
id: 4,
desc: 'Born in Chicago and now global, house music is always evolving but remains true to its pure 4/4 structure.',
},
indiebeats: {
key: 'indiebeats',
title: 'Indie Beats',
id: 404,
desc: 'Smooth, groovy and full of cutting-edge, fresh ideas - beats to kick back and enjoy far from the club setting.',
},
indiedance: {
key: 'indiedance',
title: 'Indie Dance',
id: 351,
desc: 'The spirit of Rock & Roll with an electronic soul. Club culture and live music combined.',
},
jazzhouse: {
key: 'jazzhouse',
title: 'Jazz House',
id: 349,
desc: 'One of the biggest cultural soundtracks with the infectious thump of house music. Expect sultry saxophones, trumpets, and finger snapping grooves.',
},
jungle: {
key: 'jungle',
title: 'Jungle',
id: 293,
desc: 'Jungle keeps the breakbeat tempos high and celebrates the diverse ideas found within urban and rave music.',
},
latinhouse: {
key: 'latinhouse',
title: 'Latin House',
id: 117,
desc: 'The sounds of Salsa, Brazilian beats and Latin Jazz with the steady grooves of modern East Coast dance music.',
},
liquiddnb: {
key: 'liquiddnb',
title: 'Liquid DnB',
id: 105,
desc: 'Smooth as water, with the fast paced rhythms, Liquid DNB / Drum and Bass flows with rolling ease without losing momentum.',
},
liquiddubstep: {
key: 'liquiddubstep',
title: 'Liquid Dubstep',
id: 184,
desc: 'Smooth, rolling and steady – this fresh formation of Dubstep keeps the sounds you love with a flowing Drum and Bass groove. ',
},
liquidtrap: {
key: 'liquidtrap',
title: 'Liquid Trap',
id: 352,
desc: 'The smoother side of Trap but still packed with mechanical grooves and hip hop moods. \r\n',
},
lofihiphop: {
key: 'lofihiphop',
title: 'LoFi Hip-Hop',
id: 492,
desc: 'Tastefully selected LoFi Hip-Hop tunes with textured atmospheres & laid back beats - with a dash of chillhop and perfectly designed to chill your ears.',
},
lofiloungenchill: {
key: 'lofiloungenchill',
title: 'LoFi Lounge & Chill',
id: 494,
desc: 'Punch your one-way ticket to peace of mind and mental clarity with this curated selection of LoFi Lounge & Chill tracks today. ',
},
lounge: {
key: 'lounge',
title: 'Lounge',
id: 11,
desc: 'Music to chill to. Music made for when it’s all about kicking off your shoes, laying back, and totally relaxing.',
},
melodicprogressive: {
key: 'melodicprogressive',
title: 'Melodic Progressive',
id: 402,
desc: 'The melodic side of progressive house, packed with driving rhythms and forward thinking sounds.',
},
minimal: {
key: 'minimal',
title: 'Minimal',
id: 59,
desc: 'Minimal fuses elements of house, techno and electronica and strips it back to focus on the spaces between the sound.',
},
nightcore: {
key: 'nightcore',
title: 'Nightcore',
id: 294,
desc: 'Pitched up vocals, happy hardcore beats, and high energy music non-stop.',
},
nudisco: {
key: 'nudisco',
title: 'Nu Disco',
id: 295,
desc: 'Modern disco music blending the familiar funk of the 70s and 80s with futuristic beats and up to date grooves.',
},
oldschoolacid: {
key: 'oldschoolacid',
title: 'Oldschool Acid',
id: 124,
desc: 'Acid, one of the characteristics of the TB-303, is celebrated here with the best tracks from house, techno and trance.',
},
oldschoolhouse: {
key: 'oldschoolhouse',
title: 'Oldschool House',
id: 104,
desc: 'The biggest classics and secret weapons – this is a true treasure chest of house tracks from back in the day.',
},
oldschoolrave: {
key: 'oldschoolrave',
title: 'Oldschool Rave',
id: 296,
desc: 'Grab your whistles, white gloves and reach for the laser beams. This is the sound of raving when raving was new.',
},
classictechno: {
key: 'classictechno',
title: 'Oldschool Techno & Trance ',
id: 14,
desc: 'Go back in time and hear the biggest and best tracks within techno and trance that defined a decade of dance culture.',
},
progressive: {
key: 'progressive',
title: 'Progressive',
id: 7,
desc: 'Always moving forward, progressive continues to reinvent itself into new sounds and styles made for the floor.',
},
progressivepsy: {
key: 'progressivepsy',
title: 'Progressive Psy',
id: 178,
desc: 'Progress your mind to undiscovered psychedelic dimensions.',
},
psybient: {
key: 'psybient',
title: 'Psybient',
id: 285,
desc: 'The psychedelic side of ambient.',
},
psychill: {
key: 'psychill',
title: 'PsyChill',
id: 67,
desc: 'Downtempo psychedelic dub grooves, goa ambient, and world beats.',
},
psydub: {
key: 'psydub',
title: 'PsyDub',
id: 509,
desc: 'Dub, ambient, and psychedelic trance, fused together in atmospheric harmony.\r\n',
},
slaphouse: {
key: 'slaphouse',
title: 'Slap House',
id: 518,
desc: 'Deep melodic house music with energetic bass rhythms.',
},
soulfulhouse: {
key: 'soulfulhouse',
title: 'Soulful House',
id: 47,
desc: 'House music saturated with feeling – full of melodies, vocals and true soul. Steady warm 4/4 vibes.',
},
spacemusic: {
key: 'spacemusic',
title: 'Space Dreams',
id: 64,
desc: 'Ambient space music for expanding minds.',
},
summerchillhouse: {
key: 'summerchillhouse',
title: 'Summer Chill House',
id: 506,
desc: 'This selection of summer chill house classics has been handpicked to elicit that special summer feeling year-round.',
},
synthwave: {
key: 'synthwave',
title: 'Synthwave',
id: 438,
desc: "Influenced by video games and movie soundtracks of the 80s, Synthwave's mission continues today with great new music keeping things future retro.",
},
techhouse: {
key: 'techhouse',
title: 'Tech House',
id: 66,
desc: 'Blending the warmth of house music with the cold structural precision of techno, tech house bridges the divide.',
},
techno: {
key: 'techno',
title: 'Techno',
id: 36,
desc: 'Techno is a true musical force full of structure and style. Robotic, mechanical and full of soul, always facing the future.',
},
trance: {
key: 'trance',
title: 'Trance',
id: 1,
desc: 'Emotive dance music which embraces incredible melodies, future-facing production and energetic anthems heard worldwide.',
},
trap: {
key: 'trap',
title: 'Trap',
id: 230,
desc: 'Born out of Southern Hip-Hop and influenced by techno, trap is analog drum machines / DnB & with hip-hop aesthetics.',
},
tribalhouse: {
key: 'tribalhouse',
title: 'Tribal House',
id: 57,
desc: 'The percussive side of the house and tech house scene, tribal house takes drums and puts them in the forefront.',
},
umfradio: {
key: 'umfradio',
title: 'UMF Radio',
id: 215,
desc: 'UMF Radio 24/7',
},
undergroundtechno: {
key: 'undergroundtechno',
title: 'Underground Techno',
id: 288,
desc: 'From gritty Berlin streets to dark corners of Brooklyn, this is techno made by artists pushing the genre further. ',
},
vocalchillout: {
key: 'vocalchillout',
title: 'Vocal Chillout',
id: 142,
desc: 'Relaxing vibes and a collection of vocal songs providing the laid back soundtrack to your day.',
},
vocalhouse: {
key: 'vocalhouse',
title: 'Vocal House',
id: 445,
desc: 'The glorious 4/4 thump of House music paired perfectly with the human voice. Sultry, soulful, sexy sounds.',
},
vocallounge: {
key: 'vocallounge',
title: 'Vocal Lounge',
id: 278,
desc: 'Laid back grooves and a collection of smooth vocals soothe the ears and relax the mind.',
},
vocaltrance: {
key: 'vocaltrance',
title: 'Vocal Trance',
id: 2,
desc: 'Lush vocals paired together with emotive dance music. Beautiful melodies and endless energy.',
},
}
const KEY = <Your Key Here>
function channelInfoToPlaylistEntry(info, idx) {
const slot = idx + 1
return `File${slot}=https://listen.di.fm/premium_high/${info.key}.pls?${KEY}
Title${slot}=${info.title}
Length${slot}=0`
}
const entries = Object.values(channelInfos).map(channelInfoToPlaylistEntry)
const playlist = `
[playlist]
NumberOfEntries=${entries.length}
${entries.join('\n')}
Version=2
`
console.log(playlist)
// Run with Node.js and save output to playlist
const KEY = '<yourkeyhere>'
// --------------
// Data
// --------------
// From JSON response `currently playing` then modified via
// const channelIds = channels.map(x => x.channel_key)
const channelIds = [
'00sclubhits',
'ambient',
'atmosphericbreaks',
'bassnjackinhouse',
'bassline',
'bigbeat',
'bigroomhouse',
'breaks',
'chillntropicalhouse',
'chilledm',
'chillhop',
'chillout',
'chilloutdreams',
'chillstep',
'classiceurodance',
'classiceurodisco',
'classictrance',
'classicvocaltrance',
'clubdubstep',
'club',
'darkdnb',
'darkpsytrance',
'deephouse',
'deepnudisco',
'deeporganichouse',
'deepprogressivehouse',
'deeptech',
'detroithousentechno',
'discohouse',
'djmixes',
'downtempolounge',
'drumandbass',
'drumstep',
'dub',
'dubtechno',
'dubstep',
'edmfestival',
'edm',
'electro',
'electroswing',
'electronicpioneers',
'electropop',
'epictrance',
'eurodance',
'funkyhouse',
'futurebass',
'futuregarage',
'futuresynthpop',
'gabber',
'glitchhop',
'goapsy',
'handsup',
'harddance',
'hardtechno',
'hardcore',
'hardstyle',
'house',
'indiebeats',
'indiedance',
'jazzhouse',
'jungle',
'latinhouse',
'liquiddnb',
'liquiddubstep',
'liquidtrap',
'lofihiphop',
'lofiloungenchill',
'lounge',
'melodicprogressive',
'minimal',
'nightcore',
'nudisco',
'oldschoolacid',
'oldschoolhouse',
'oldschoolrave',
'classictechno',
'progressive',
'progressivepsy',
'psybient',
'psychill',
'psydub',
'russianclubhits',
'slaphouse',
'soulfulhouse',
'spacemusic',
'summerchillhouse',
'synthwave',
'techhouse',
'techno',
'trance',
'trap',
'tribalhouse',
'umfradio',
'undergroundtechno',
'vocalchillout',
'vocalhouse',
'vocallounge',
'vocaltrance',
]
// Get those via from: https://www.di.fm/channels -> Select All
const channelTitles = [
'00s Club Hits',
'Ambient',
'Atmospheric Breaks',
"Bass & Jackin' House",
'Bassline',
'Big Beat',
'Big Room House',
'Breaks',
'Chill & Tropical House',
'Chill EDM',
'ChillHop',
'Chillout',
'Chillout Dreams',
'Chillstep',
'Classic EuroDance',
'Classic EuroDisco',
'Classic Trance',
'Classic Vocal Trance',
'Club Dubstep',
'Club Sounds',
'DJ Mixes',
'Dark DnB',
'Dark PsyTrance',
'Deep House',
'Deep Nu-Disco',
'Deep Organic House',
'Deep Progressive House',
'Deep Tech',
'Detroit House & Techno',
'Disco House',
'Downtempo Lounge',
'Drum and Bass',
'Drumstep',
'Dub',
'Dub Techno',
'Dubstep',
'EDM Festival',
'EDM Hits',
'Electro House',
'Electro Swing',
'Electronic Pioneers',
'Electropop',
'Epic Trance',
'EuroDance',
'Funky House',
'Future Bass',
'Future Garage',
'Future Synthpop',
'Gabber',
'Glitch Hop',
'Goa-Psy Trance',
'Hands Up',
'Hard Dance',
'Hard Techno',
'Hardcore',
'Hardstyle',
'House',
'Indie Beats',
'Indie Dance',
'Jazz House',
'Jungle',
'Latin House',
'Liquid DnB',
'Liquid Dubstep',
'Liquid Trap',
'LoFi Hip-Hop',
'LoFi Lounge & Chill',
'Lounge',
'Melodic Progressive',
'Minimal',
'Nightcore',
'Nu Disco',
'Oldschool Acid',
'Oldschool House',
'Oldschool Rave',
'Oldschool Techno & Trance',
'Progressive',
'Progressive Psy',
'PsyChill',
'PsyDub',
'Psybient',
'Russian Club Hits',
'Slap House',
'Soulful House',
'Space Dreams',
'Summer Chill House',
'Synthwave',
'Tech House',
'Techno',
'Trance',
'Trap',
'Tribal House',
'UMF Radio',
'Underground Techno',
'Vocal Chillout',
'Vocal House',
'Vocal Lounge',
'Vocal Trance',
]
// --------------
// Code
// --------------
const channelInfos = channelTitles.map((title, idx) => ({
id: channelIds[idx],
title,
}))
function channelInfoToPlaylistEntry(info, idx) {
const slot = idx + 1
return `File${slot}=https://listen.di.fm/premium_high/${info.id}.pls?${KEY}
Title${slot}=${info.title}
Length${slot}=0`
}
const entries = channelInfos.map(channelInfoToPlaylistEntry)
const playlist = `
[playlist]
NumberOfEntries=${entries.length}
${entries.join('\n')}
Version=2
`
console.log(playlist)
// Run on playlist with thumbnail view, i.e. https://www.youtube.com/playlist?list=PLW_omwEM1aid1jtpNhqigEcRHAVsR-Hmz
const YOUTUBE_ROOT = 'https://www.youtube.com'
const videoItemClass =
'yt-simple-endpoint style-scope ytd-playlist-video-renderer'
function getVideoInfos() {
const videoLinks = document.getElementsByClassName(videoItemClass)
const infos = []
for (let i = 0; i < videoLinks.length; i++) {
const url = videoLinks[i].href
const title = videoLinks[i].innerText.trim()
infos.push({ url, title })
}
return infos
}
function videoInfoToPlaylistEntry(info, idx) {
const slot = idx + 1
return `File${slot}=${info.url}
Title${slot}=${info.title}
Length${slot}=0`
}
const videoInfos = getVideoInfos()
const entries = videoInfos.map(videoInfoToPlaylistEntry)
const playlist = `
[playlist]
NumberOfEntries=${entries.length}
${entries.join('\n')}
Version=2
`
console.log(playlist)
document.querySelector('#copy')?.remove()
copy(playlist)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment