@puniko
Is your instances #rss configured differently somehow ?
This code works with other instances, but refuses to work with mk.absturztau.be
_____
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel="stylesheet" href="./style.css">
<body>
<!-- partial:index.partial.html -->
<!-- partial -->
<script>
const userFeed = 'https://mk.absturztau.be/@aoikurayami.rss';
const wrapper = document.body;
const tootHTML = (description, date, url) => `
<article>
<a href="${url}">?</a> | <time>${date}</time>____________
<div>${description}</div>
</article>`;
const formatToots = (domContent, container) => {
[...domContent.querySelectorAll('item')].map(item => {
const $toot = el => item.querySelector(el).textContent;
const description = $toot('description')
const url = $toot('guid')
const date = $toot('pubDate')
container.innerHTML = container.innerHTML + tootHTML(description, date, url)
});
};
const parser = new DOMParser();
fetch(userFeed)
.then(response => {
if (response.status >= 400) {
return <p>No toots available at the moment</p>
}
return response.text();
})
.then(response => formatToots(parser.parseFromString(response, "application/xml"), wrapper));
</script>
</body>
<div id="myTimeline" class="mastodon-timeline mastodon-timeline-light"></div>
</div>
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
aoikurayami@mk.absturztau.be's status on Monday, 12-Dec-2022 23:39:38 JSTaoikurayami