-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (81 loc) · 2.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your GitHub Repository</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
text-align: center;
}
h1 {
color: #333;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin: 10px 0;
}
a {
text-decoration: none;
color: #007BFF;
font-weight: bold;
}
button {
padding: 10px 20px;
font-size: 16px;
background-color: #28a745;
color: #fff;
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #218838;
}
</style>
</head>
<body>
<h1>Your GitHub Repository Files</h1>
<ul id="fileList"></ul>
<button onclick="downloadCSV()">Show CSV</button>
<script>
// Replace 'ascendantaditya' and 'Pycamp' with your GitHub username and repository name
const username = 'ascendantaditya';
const repo = 'Pycamp';
const apiUrl = `https://api.github.com/repos/${username}/${repo}/contents`;
async function fetchRepoFiles() {
try {
const response = await fetch(apiUrl);
const data = await response.json();
const fileList = document.getElementById('fileList');
data.forEach(file => {
const listItem = document.createElement('li');
const link = document.createElement('a');
link.href = file.html_url;
link.textContent = file.name;
listItem.appendChild(link);
fileList.appendChild(listItem);
});
} catch (error) {
console.error('Error fetching repository files:', error);
}
}
function downloadCSV() {
// Replace 'nba.csv' with the actual name you want for the downloaded CSV file
const csvUrl = `https://raw.githubusercontent.com/${username}/${repo}/master/nba.csv`;
const link = document.createElement('a');
link.href = csvUrl;
link.download = 'nba.csv';
link.click();
}
fetchRepoFiles();
</script>
</body>
</html>