-
Notifications
You must be signed in to change notification settings - Fork 0
/
fm.js
26 lines (26 loc) · 1.25 KB
/
fm.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
window.onload = function () {
const ids = ["20500092"];
const fms = document.getElementById("fms");
for (let i = 0; i < ids.length; i++) {
$.getJSON("https://rapi.qtfm.cn/channels/" + ids[i]).then((response) => {
const tr = document.createElement("tr");
const td = document.createElement("td");
const button = document.createElement("button");
button.innerText = response.Data.title;
button.addEventListener('click', () => {
const fmimg = document.getElementById("fmimg");
fmimg.src = response.Data.cover;
document.getElementById('nowplaying').innerText = response.Data.nowplaying.broadcasters.map((item) => item.username).join(",") + " - " +
response.Data.nowplaying.name + " -> " +
response.Data.nowplaying.start_time + " - " + response.Data.nowplaying.end_time;
const audio = document.getElementById('fm');
audio.src = "https://lhttp.qtfm.cn/live/" + ids[i] + "/64k.mp3";
audio.volume = 0.33;
audio.play();
});
td.appendChild(button);
tr.appendChild(td);
fms.appendChild(tr);
});
}
}