Commit 70302005 authored by JP's avatar JP
Browse files

player.html - web audio player for latest tracks

parent ee59bef2
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css" integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY=" crossorigin="anonymous">
<script>
function main() {
fetch("https://botsin.space/@platypus.rss?maxitems=100")
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
const items = data.querySelectorAll("item");
let html = "";
items.forEach(el => {
enc=el.querySelector("enclosure")
if (enc != null) {
console.log(el.querySelector("description").textContent)
html += `
<div style="display:inline-block; ">
<div>${el.querySelector("description").textContent}</div>
<div><audio controls><source src='${enc.getAttribute("url")}' type='${enc.getAttribute("type")}'></audio>&nbsp;<a href="${el.querySelector("link").innerHTML}" target="_blank" rel="noopener"><i class="fa fa-mastodon" style="font-size:40px"></i></a></div>
</div>
`;
}
});
document.getElementById("main").innerHTML = html;
});
}
</script>
</head>
<body onload="main()">
<div id="header" style="width:1200px; height:100px;background-image:url(https://files.botsin.space/accounts/headers/108/210/076/035/783/698/original/351a0f25626d3698.jpg);"><h2 style="margin-left:45px;">PLATYPUS - LATEST TRACKS</h2>
<a rel="me" href="https://botsin.space/@platypus" style="margin-left:135px;">https://botsin.space/@platypus</a>
</div>
<div id="main" style="column-count:3;column-rule-style: solid;width:1200px;"></div>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment