Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript: /* Save 181fm station history into CSV */
- fetch(cfg_historyURL + "?i=" + streams[0].id).then(r => r.json().then(j => {
- (r = document.createElement("A")).href = URL.createObjectURL(new Blob([
- "Time,Song,Title,Artist\n" +
- j.map(o => `"${
- Intl.DateTimeFormat(navigator.language, {month: "2-digit", day: "2-digit", year: "numeric", hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit"}).format(new Date(o.time))
- }","${o.song.replace(/"/g, "'")}","${o.title.replace(/"/g, "'")}","${o.artist.replace(/"/g, "'")}"`).join("\n")
- ], {type: "text/csv"}));
- r.download = document.title + " history.csv";
- r.click()
- }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement