热门推荐
热门推荐
This commit is contained in:
128
frontend/60sapi/热搜榜单/网易云榜单列表/css/background.css
Normal file
128
frontend/60sapi/热搜榜单/网易云榜单列表/css/background.css
Normal file
@@ -0,0 +1,128 @@
|
||||
/* 网易云音乐特色背景样式 */
|
||||
body {
|
||||
background: linear-gradient(135deg, #2b2b2b 0%, #1e1e1e 50%, #2b2b2b 100%);
|
||||
background-size: 400% 400%;
|
||||
animation: gradientShift 15s ease infinite;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 背景渐变动画 */
|
||||
@keyframes gradientShift {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
/* 网易云红色装饰元素 */
|
||||
body::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
radial-gradient(circle at 20% 80%, rgba(236, 65, 65, 0.15) 0%, transparent 50%),
|
||||
radial-gradient(circle at 80% 20%, rgba(236, 65, 65, 0.1) 0%, transparent 50%),
|
||||
radial-gradient(circle at 40% 40%, rgba(236, 65, 65, 0.08) 0%, transparent 50%);
|
||||
pointer-events: none;
|
||||
z-index: -2;
|
||||
}
|
||||
|
||||
/* 音符装饰效果 */
|
||||
body::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image:
|
||||
radial-gradient(2px 2px at 20px 30px, rgba(236, 65, 65, 0.4), transparent),
|
||||
radial-gradient(2px 2px at 40px 70px, rgba(236, 65, 65, 0.3), transparent),
|
||||
radial-gradient(1px 1px at 90px 40px, rgba(236, 65, 65, 0.4), transparent),
|
||||
radial-gradient(1px 1px at 130px 80px, rgba(236, 65, 65, 0.3), transparent),
|
||||
radial-gradient(2px 2px at 160px 30px, rgba(236, 65, 65, 0.4), transparent);
|
||||
background-repeat: repeat;
|
||||
background-size: 200px 100px;
|
||||
animation: particleFloat 20s linear infinite;
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* 音符浮动动画 */
|
||||
@keyframes particleFloat {
|
||||
0% {
|
||||
transform: translateY(0px);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-100px);
|
||||
}
|
||||
}
|
||||
|
||||
/* 音符装饰 */
|
||||
.music-note {
|
||||
position: absolute;
|
||||
font-size: 24px;
|
||||
color: rgba(236, 65, 65, 0.3);
|
||||
animation: floatNote 15s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
@keyframes floatNote {
|
||||
0% {
|
||||
transform: translateY(0) rotate(0deg);
|
||||
opacity: 0;
|
||||
}
|
||||
10% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
90% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-100vh) rotate(360deg);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 响应式背景调整 */
|
||||
@media (max-width: 768px) {
|
||||
body::after {
|
||||
background-size: 150px 75px;
|
||||
animation-duration: 25s;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
body::after {
|
||||
background-size: 100px 50px;
|
||||
animation-duration: 30s;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
/* 高性能模式 - 减少动画 */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
body {
|
||||
animation: none;
|
||||
background: linear-gradient(135deg, #2b2b2b 0%, #1e1e1e 50%, #2b2b2b 100%);
|
||||
}
|
||||
|
||||
body::after {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.music-note {
|
||||
animation: none;
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
389
frontend/60sapi/热搜榜单/网易云榜单列表/css/style.css
Normal file
389
frontend/60sapi/热搜榜单/网易云榜单列表/css/style.css
Normal file
@@ -0,0 +1,389 @@
|
||||
/* 背景样式 */
|
||||
.background-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
overflow: hidden;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.modern-gradient {
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(64, 169, 255, 0.4) 0%,
|
||||
rgba(120, 192, 255, 0.3) 25%,
|
||||
rgba(255, 175, 64, 0.2) 50%,
|
||||
rgba(255, 140, 50, 0.3) 75%,
|
||||
rgba(255, 122, 69, 0.4) 100%
|
||||
);
|
||||
animation: gradient-flow 20s ease-in-out infinite;
|
||||
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
|
||||
}
|
||||
|
||||
.modern-gradient::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(
|
||||
circle at 30% 70%,
|
||||
rgba(64, 169, 255, 0.5) 0%,
|
||||
transparent 50%
|
||||
), radial-gradient(
|
||||
circle at 70% 30%,
|
||||
rgba(255, 140, 50, 0.4) 0%,
|
||||
transparent 50%
|
||||
);
|
||||
animation: pulse-effect 15s ease-in-out infinite alternate;
|
||||
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
|
||||
}
|
||||
|
||||
@keyframes gradient-flow {
|
||||
0%, 100% {
|
||||
transform: rotate(0deg) scale(1);
|
||||
opacity: 0.8;
|
||||
}
|
||||
25% {
|
||||
transform: rotate(90deg) scale(1.1);
|
||||
opacity: 0.6;
|
||||
}
|
||||
50% {
|
||||
transform: rotate(180deg) scale(0.9);
|
||||
opacity: 0.9;
|
||||
}
|
||||
75% {
|
||||
transform: rotate(270deg) scale(1.05);
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse-effect {
|
||||
0% {
|
||||
transform: scale(1) rotate(0deg);
|
||||
opacity: 0.5;
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2) rotate(180deg);
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) rotate(360deg);
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
/* 主样式 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
color: #333;
|
||||
background-color: #f8f9fa;
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 24px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background-color: rgba(255, 255, 255, 0.85);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
|
||||
backdrop-filter: blur(10px);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
header {
|
||||
text-align: center;
|
||||
margin-bottom: 28px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
background: linear-gradient(135deg, #4096ff, #ff7a45);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
margin-bottom: 14px;
|
||||
font-size: 2.4rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
background-color: rgba(0, 0, 0, 0.03);
|
||||
padding: 8px 16px;
|
||||
border-radius: 24px;
|
||||
display: inline-block;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.hot-list {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
border-radius: 12px;
|
||||
background-color: white;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.hot-item:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
|
||||
border-color: rgba(64, 169, 255, 0.3);
|
||||
}
|
||||
|
||||
.hot-rank {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
color: #4096ff;
|
||||
margin-right: 18px;
|
||||
min-width: 38px;
|
||||
text-align: center;
|
||||
background-color: rgba(64, 169, 255, 0.1);
|
||||
border-radius: 50%;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.hot-rank.top-1 {
|
||||
background: linear-gradient(135deg, #ff4d4f, #ff7a45);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hot-rank.top-2 {
|
||||
background: linear-gradient(135deg, #ff7a45, #ffa940);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hot-rank.top-3 {
|
||||
background: linear-gradient(135deg, #ffa940, #ffec3d);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hot-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hot-title {
|
||||
font-size: 1.15rem;
|
||||
margin-bottom: 8px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
line-height: 1.5;
|
||||
font-weight: 500;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.hot-title:hover {
|
||||
color: #4096ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #666;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
margin-top: 30px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.06);
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* 音符装饰样式 */
|
||||
.music-note {
|
||||
position: fixed;
|
||||
font-size: 24px;
|
||||
color: rgba(236, 65, 65, 0.6);
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
animation: floatNote 20s linear infinite;
|
||||
text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
@keyframes floatNote {
|
||||
0% {
|
||||
transform: translateY(0) rotate(0deg);
|
||||
opacity: 0.7;
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-100px) rotate(180deg);
|
||||
opacity: 0.9;
|
||||
}
|
||||
100% {
|
||||
transform: translateY(-200px) rotate(360deg);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 1024px) and (min-width: 768px) {
|
||||
.container {
|
||||
max-width: 90%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 2.2rem;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.hot-title {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.music-note {
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 95%;
|
||||
margin: 12px auto;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1.8rem;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.update-time {
|
||||
font-size: 0.85rem;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 10px;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.hot-rank {
|
||||
font-size: 1.1rem;
|
||||
margin-right: 14px;
|
||||
min-width: 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.hot-title {
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 24px;
|
||||
padding-top: 16px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.music-note {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.container {
|
||||
margin: 8px auto;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.hot-item {
|
||||
padding: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.hot-rank {
|
||||
font-size: 1rem;
|
||||
margin-right: 12px;
|
||||
min-width: 30px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.hot-title {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.music-note {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 减少动画以节省电池 */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.modern-gradient,
|
||||
.modern-gradient::before {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.modern-gradient {
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(64, 169, 255, 0.3) 0%,
|
||||
rgba(255, 175, 64, 0.2) 50%,
|
||||
rgba(255, 122, 69, 0.25) 100%
|
||||
);
|
||||
}
|
||||
}
|
||||
306
frontend/60sapi/热搜榜单/网易云榜单列表/index.html
Normal file
306
frontend/60sapi/热搜榜单/网易云榜单列表/index.html
Normal file
@@ -0,0 +1,306 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>网易云音乐榜单列表</title>
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
<link rel="stylesheet" href="css/background.css">
|
||||
</head>
|
||||
<body>
|
||||
<!-- 音符装饰 -->
|
||||
<div id="musicNotes"></div>
|
||||
|
||||
<div class="container">
|
||||
<header class="header">
|
||||
<h1 class="title">🎵 网易云音乐榜单列表</h1>
|
||||
<p class="subtitle">发现音乐的魅力</p>
|
||||
</header>
|
||||
|
||||
<div class="loading" id="loading">
|
||||
<div class="spinner"></div>
|
||||
<p>正在加载榜单数据...</p>
|
||||
</div>
|
||||
|
||||
<div class="error" id="error" style="display: none;">
|
||||
<div class="error-icon">⚠️</div>
|
||||
<p class="error-message" id="errorMessage"></p>
|
||||
<button class="retry-btn" id="retryBtn">重试</button>
|
||||
</div>
|
||||
|
||||
<div class="rank-list" id="rankList" style="display: none;">
|
||||
<!-- 榜单列表将在这里动态生成 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<p>© 2025 网易云音乐榜单列表 - 数据来源于官方API</p>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// 创建音符装饰
|
||||
function createMusicNotes() {
|
||||
const musicNotes = document.getElementById('musicNotes');
|
||||
const noteSymbols = ['♪', '♫', '♬', '♩', '♭', '♮', '♯'];
|
||||
const containerWidth = window.innerWidth;
|
||||
const containerHeight = window.innerHeight;
|
||||
|
||||
// 创建20个音符
|
||||
for (let i = 0; i < 20; i++) {
|
||||
const note = document.createElement('div');
|
||||
note.className = 'music-note';
|
||||
note.textContent = noteSymbols[Math.floor(Math.random() * noteSymbols.length)];
|
||||
|
||||
// 随机位置
|
||||
const left = Math.random() * containerWidth;
|
||||
const top = Math.random() * containerHeight;
|
||||
|
||||
// 随机动画延迟
|
||||
const delay = Math.random() * 15;
|
||||
const duration = 10 + Math.random() * 20;
|
||||
|
||||
note.style.left = `${left}px`;
|
||||
note.style.top = `${top}px`;
|
||||
note.style.animationDelay = `${delay}s`;
|
||||
note.style.animationDuration = `${duration}s`;
|
||||
|
||||
musicNotes.appendChild(note);
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载完成后创建音符
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
createMusicNotes();
|
||||
});
|
||||
|
||||
// API接口列表
|
||||
const API_ENDPOINTS = [
|
||||
"https://60s.viki.moe",
|
||||
"https://60s-cf.viki.moe",
|
||||
"https://60s.b23.run",
|
||||
"https://60s.114128.xyz",
|
||||
"https://60s-cf.114128.xyz",
|
||||
"https://60s.api.shumengya.top",
|
||||
"https://api.03c3.cn/api/zb",
|
||||
"https://api.vvhan.com/api/60s",
|
||||
// 添加本地测试数据
|
||||
"../返回接口.json"
|
||||
];
|
||||
|
||||
// 当前使用的API索引
|
||||
let currentApiIndex = 0;
|
||||
|
||||
// DOM元素
|
||||
const loadingElement = document.getElementById('loading');
|
||||
const errorElement = document.getElementById('error');
|
||||
const errorMessageElement = document.getElementById('errorMessage');
|
||||
const retryBtnElement = document.getElementById('retryBtn');
|
||||
const rankListElement = document.getElementById('rankList');
|
||||
|
||||
// 初始化
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
loadRankList();
|
||||
retryBtnElement.addEventListener('click', loadRankList);
|
||||
});
|
||||
|
||||
// 显示加载状态
|
||||
function showLoading() {
|
||||
loadingElement.style.display = 'flex';
|
||||
errorElement.style.display = 'none';
|
||||
rankListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 显示错误状态
|
||||
function showError(message) {
|
||||
loadingElement.style.display = 'none';
|
||||
errorElement.style.display = 'flex';
|
||||
errorMessageElement.textContent = message;
|
||||
rankListElement.style.display = 'none';
|
||||
}
|
||||
|
||||
// 显示榜单列表
|
||||
function showRankList() {
|
||||
loadingElement.style.display = 'none';
|
||||
errorElement.style.display = 'none';
|
||||
rankListElement.style.display = 'block';
|
||||
}
|
||||
|
||||
// 加载榜单列表
|
||||
async function loadRankList() {
|
||||
showLoading();
|
||||
|
||||
try {
|
||||
const data = await fetchRankList();
|
||||
displayRankList(data);
|
||||
showRankList();
|
||||
} catch (error) {
|
||||
console.error('加载榜单列表失败:', error);
|
||||
showError(error.message || '加载榜单列表失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
// 获取榜单列表数据
|
||||
async function fetchRankList() {
|
||||
let lastError = null;
|
||||
let attemptedApis = 0;
|
||||
|
||||
// 尝试所有API接口
|
||||
while (attemptedApis < API_ENDPOINTS.length) {
|
||||
try {
|
||||
const apiUrl = API_ENDPOINTS[currentApiIndex];
|
||||
let url = `${apiUrl}/v2/ncm-rank-list`;
|
||||
|
||||
// 处理本地JSON文件
|
||||
if (apiUrl.includes('返回接口.json')) {
|
||||
url = apiUrl;
|
||||
console.log('使用本地测试数据:', url);
|
||||
}
|
||||
// 针对不同API接口格式进行适配
|
||||
else if (apiUrl.includes('03c3.cn') || apiUrl.includes('vvhan.com')) {
|
||||
// 这些API可能有不同的路径格式,需要特殊处理
|
||||
if (apiUrl.includes('03c3.cn')) {
|
||||
url = `${apiUrl}/ncm/toplist`;
|
||||
} else if (apiUrl.includes('vvhan.com')) {
|
||||
url = `${apiUrl}/music/netease/toplist`;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`尝试API ${currentApiIndex + 1}/${API_ENDPOINTS.length}:`, url);
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeoutId = setTimeout(() => controller.abort(), 8000); // 缩短超时时间
|
||||
|
||||
const response = await fetch(url, {
|
||||
signal: controller.signal,
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
// 添加缓存控制
|
||||
cache: 'no-cache',
|
||||
// 添加模式
|
||||
mode: apiUrl.includes('返回接口.json') ? 'same-origin' : 'cors'
|
||||
});
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
// 不同API可能有不同的成功状态码
|
||||
if (data.code !== undefined && data.code !== 200 && data.code !== 0) {
|
||||
throw new Error(data.message || data.msg || '获取数据失败');
|
||||
}
|
||||
|
||||
console.log('API调用成功:', data);
|
||||
return data;
|
||||
|
||||
} catch (error) {
|
||||
console.warn(`API ${currentApiIndex + 1} 失败:`, error.message);
|
||||
lastError = error;
|
||||
currentApiIndex = (currentApiIndex + 1) % API_ENDPOINTS.length;
|
||||
attemptedApis++;
|
||||
|
||||
if (error.name === 'AbortError') {
|
||||
lastError = new Error('请求超时,请重试');
|
||||
}
|
||||
|
||||
// 添加短暂延迟,避免过快请求下一个API
|
||||
await new Promise(resolve => setTimeout(resolve, 300));
|
||||
}
|
||||
}
|
||||
|
||||
throw lastError || new Error('所有API接口都无法访问,请稍后再试');
|
||||
}
|
||||
|
||||
// 显示榜单列表
|
||||
function displayRankList(data) {
|
||||
// 适配不同API返回的数据格式
|
||||
let ranks = [];
|
||||
|
||||
// 标准格式:data.data 是数组
|
||||
if (data.data && Array.isArray(data.data)) {
|
||||
ranks = data.data;
|
||||
}
|
||||
// 03c3.cn API格式:data.result 是数组
|
||||
else if (data.result && Array.isArray(data.result)) {
|
||||
ranks = data.result;
|
||||
}
|
||||
// vvhan.com API格式:data.list 是数组
|
||||
else if (data.list && Array.isArray(data.list)) {
|
||||
ranks = data.list;
|
||||
}
|
||||
// 其他可能的格式
|
||||
else if (Array.isArray(data)) {
|
||||
ranks = data;
|
||||
}
|
||||
else {
|
||||
// 尝试查找数据中的任何数组
|
||||
for (const key in data) {
|
||||
if (Array.isArray(data[key]) && data[key].length > 0) {
|
||||
ranks = data[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ranks.length === 0) {
|
||||
showError('没有找到榜单数据');
|
||||
return;
|
||||
}
|
||||
|
||||
rankListElement.innerHTML = '';
|
||||
|
||||
ranks.forEach(rank => {
|
||||
// 适配不同API的字段名
|
||||
const id = rank.id || rank.listId || rank.list_id || '';
|
||||
const name = rank.name || rank.listName || rank.list_name || '未知榜单';
|
||||
const cover = rank.cover || rank.coverImgUrl || rank.picUrl || rank.pic || 'https://p2.music.126.net/DrRIg6CrgDfVLEph9SNh7w==/18696095720518497.jpg';
|
||||
const description = rank.description || rank.desc || rank.updateFrequency || '暂无描述';
|
||||
const updateFrequency = rank.update_frequency || rank.updateFrequency || '定期更新';
|
||||
const updated = rank.updated || rank.updateTime || rank.update_time || '';
|
||||
|
||||
const rankItem = document.createElement('div');
|
||||
rankItem.className = 'rank-item';
|
||||
|
||||
rankItem.innerHTML = `
|
||||
<div class="rank-cover">
|
||||
<img src="${cover}" alt="${name}" onerror="this.src='https://p2.music.126.net/DrRIg6CrgDfVLEph9SNh7w==/18696095720518497.jpg'">
|
||||
</div>
|
||||
<div class="rank-info">
|
||||
<h3 class="rank-name">${name}</h3>
|
||||
<p class="rank-description">${description}</p>
|
||||
<div class="rank-meta">
|
||||
<span class="update-frequency">${updateFrequency}</span>
|
||||
<span class="update-time">更新: ${formatDate(updated)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="../网易云榜单详情/index.html?id=${id}&name=${encodeURIComponent(name)}" class="view-btn">查看详情</a>
|
||||
`;
|
||||
|
||||
rankListElement.appendChild(rankItem);
|
||||
});
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
function formatDate(dateStr) {
|
||||
if (!dateStr) return '未知';
|
||||
|
||||
try {
|
||||
const date = new Date(dateStr);
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
} catch (e) {
|
||||
return dateStr;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +1,7 @@
|
||||
[
|
||||
"https://60s.api.shumengya.top"
|
||||
"https://60s.viki.moe",
|
||||
"https://60s-cf.viki.moe",
|
||||
"https://60s.b23.run",
|
||||
"https://60s.114128.xyz",
|
||||
"https://60s-cf.114128.xyz"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user