Spaces:
Runtime error
Runtime error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Peruvian Soccer News</title> | |
</head> | |
<body> | |
<h1>Peruvian Soccer News</h1> | |
<ul id="news-list"></ul> | |
<script> | |
async function fetchNews() { | |
try { | |
const response = await fetch("https://your-space-name.hf.space/peruvian_soccer_news"); | |
const data = await response.json(); | |
const newsList = document.getElementById("news-list"); | |
data.articles.forEach(article => { | |
const listItem = document.createElement("li"); | |
const link = document.createElement("a"); | |
link.href = article.link; | |
link.textContent = article.title; | |
listItem.appendChild(link); | |
newsList.appendChild(listItem); | |
}); | |
} catch (error) { | |
console.error("Error fetching news:", error); | |
} | |
} | |
fetchNews(); | |
</script> | |
</body> | |
</html> | |