Spaces:
Runtime error
Runtime error
Create index.html
Browse files- index.html +35 -0
index.html
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Peruvian Soccer News</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Peruvian Soccer News</h1>
|
10 |
+
<ul id="news-list"></ul>
|
11 |
+
|
12 |
+
<script>
|
13 |
+
async function fetchNews() {
|
14 |
+
try {
|
15 |
+
const response = await fetch("https://your-space-name.hf.space/peruvian_soccer_news");
|
16 |
+
const data = await response.json();
|
17 |
+
|
18 |
+
const newsList = document.getElementById("news-list");
|
19 |
+
data.articles.forEach(article => {
|
20 |
+
const listItem = document.createElement("li");
|
21 |
+
const link = document.createElement("a");
|
22 |
+
link.href = article.link;
|
23 |
+
link.textContent = article.title;
|
24 |
+
listItem.appendChild(link);
|
25 |
+
newsList.appendChild(listItem);
|
26 |
+
});
|
27 |
+
} catch (error) {
|
28 |
+
console.error("Error fetching news:", error);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
fetchNews();
|
33 |
+
</script>
|
34 |
+
</body>
|
35 |
+
</html>
|