-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrss.js
More file actions
24 lines (24 loc) · 739 Bytes
/
rss.js
File metadata and controls
24 lines (24 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
fetch("https://raw.githubusercontent.com/Tarvey/Tarvey/refs/heads/main/news.rss")
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, "text/xml"))
.then(data => {
console.log(data);
const items = data.querySelectorAll("item");
let html = ``;
items.forEach(el => {
html += `
<article id="post">
<h3>
${el.querySelector("title").innerHTML}
</h3>
<p>
${el.querySelector("content").innerHTML}
</p><br>
<h5><i>
Date: ${el.querySelector("date").innerHTML}
</i></h5>
</article>
`;
});
document.getElementById('newsinner').innerHTML = html;
});