上传文件至 /
This commit is contained in:
58
api_ca.html
Normal file
58
api_ca.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>音乐列表</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>音乐列表</h1>
|
||||
<div id="music-container"></div>
|
||||
|
||||
<script>
|
||||
// 主站API地址 - 请替换为实际的API地址
|
||||
const API_BASE_URL = 'https://shanwogou.cn/audio/api.php';
|
||||
|
||||
// 页面加载完成后初始化
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadAllMusic();
|
||||
});
|
||||
|
||||
// 加载所有音乐
|
||||
async function loadAllMusic() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}?action=getAllMusic`);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
const container = document.getElementById('music-container');
|
||||
data.data.forEach(music => {
|
||||
const musicDiv = document.createElement('div');
|
||||
musicDiv.innerHTML = `
|
||||
<p>歌曲名称: ${music.title}</p>
|
||||
<p>歌手: ${music.artist}</p>
|
||||
<p>分类: ${music.category}</p>
|
||||
<p>时长: ${music.duration}</p>
|
||||
<audio controls>
|
||||
<source src="${music.mp3}" type="audio/mpeg">
|
||||
您的浏览器不支持音频播放
|
||||
</audio>
|
||||
`;
|
||||
container.appendChild(musicDiv);
|
||||
});
|
||||
} else {
|
||||
document.getElementById('music-container').innerHTML = '<p>' + data.message + '</p>';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载音乐失败:', error);
|
||||
document.getElementById('music-container').innerHTML = '<p>加载音乐失败,请稍后再试</p>';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
<a href="https://shanwogou.cn/audio/api_ca.html" target="_blank" download>下载源码</a>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user