misc.anonradio: hopefully fix bad titles from bad json formatting on icecast's end

This commit is contained in:
Cynthia Foxwell 2022-08-19 22:53:14 -06:00
parent fe7d7b86d3
commit 947a7baa44

View file

@ -281,9 +281,9 @@ anonradio.callback = async function (msg, line) {
const schedule = await fetch("https://anonradio.net/schedule/").then((res) => const schedule = await fetch("https://anonradio.net/schedule/").then((res) =>
res.text() res.text()
); );
const icecast = await fetch("http://anonradio.net:8010/status-json.xsl").then( const icecast = await fetch("http://anonradio.net:8010/status-json.xsl")
(res) => res.json() .then((res) => res.text())
); .then((data) => JSON.parse(data.replace(/"title":-,/g, '"title":"-",')));
let lines = schedule.split("\n"); let lines = schedule.split("\n");
lines = lines.slice(4, lines.length - 2); lines = lines.slice(4, lines.length - 2);