feat: migrate ChKSz API and support API key authentication

This commit is contained in:
Jocay
2026-10-10 20:22:49 +08:00
parent 480233f01b
commit 5bd62645ab
13 changed files with 82 additions and 49 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ const fs = require('fs');
const http = require('http');
const https = require('https');
const path = require('path');
const { API, DOWNLOAD_DIR, NETEASE_BASE_URL } = require('./config');
const { API, DOWNLOAD_DIR, NETEASE_BASE_URL, buildApiUrl } = require('./config');
const { downloadBuffer, fetchJSON } = require('./network');
const { sanitizePathSegment } = require('./utils');
@@ -127,7 +127,7 @@ async function saveAlbumCover(coverUrl, outputDir) {
async function fetchFullMetadata(songId) {
const [songDetail, chkszData] = await Promise.all([
fetchNeteaseSongDetail(songId),
fetchJSON(`${API.music}?id=${songId}&level=standard`).catch(() => null),
fetchJSON(buildApiUrl(API.music, { id: songId, level: 'standard' })).catch(() => null),
]);
if (!songDetail) return null;