// 你的 Gitee Raw 地址 const jsonUrl = 'https://gittea.dev/Vibrantly/Try/raw/branch/master/x.json'; fetch(jsonUrl) .then(response => response.text()) // 获取原始的 Base64 文本 .then(base64String => { // --- 核心解码逻辑 (完美支持中文) --- // 1. atob 将 Base64 转为二进制字符串 const binaryString = atob(base64String.trim()); // 2. 将二进制字符串映射为字节数组 const bytes = new Uint8Array(binaryString.length); for (let i = 0; i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); } // 3. 使用 TextDecoder 将字节数组解码为正常的 UTF-8 字符串 const jsonString = new TextDecoder('utf-8').decode(bytes); // --- 自动解析并运行 --- try { const configData = JSON.parse(jsonString); // 变回正常的 JS 对象 console.log("【自动转换并解析成功】:", configData); // 在这里写你拿到数据后要执行的后续代码 // 例如:configData.urls.forEach(item => console.log(item.name)); } catch (e) { console.error("JSON 解析失败:", e); } }) .catch(error => console.error("请求失败:", error));