AXCWG 4 tháng trước cách đây
mục cha
commit
42e446c77b
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      main.js

+ 4 - 2
main.js

@@ -240,9 +240,9 @@ app.post("/ncm/url", function (req, res) {
             }
         ).then(async result => {
             let result_json = await result.json()
-            if (result.status === 200) {
+            if (result_json.data.url !== null) {
                 let infos = await (await fetch(ncmAPIUrl + "/song/detail?ids=" + id)).json();
-                req.body.file = "data:audio/flac;base64,"+Buffer.from(await (await fetch(result_json.data.url)).arrayBuffer()).toString("base64")
+                req.body.file = "data:audio/flac;base64," + Buffer.from(await (await fetch(result_json.data.url)).arrayBuffer()).toString("base64")
                 req.body.name = infos.songs[0].name;
                 req.body.albumName = infos.songs[0].al.name
                 req.body.albumCover = infos.songs[0].al.picUrl
@@ -254,7 +254,9 @@ app.post("/ncm/url", function (req, res) {
                 Submit(req, res)
 
 
+            } else {
 
+                res.status(404).header("Access-Control-Allow-Origin", "*").send("未找到")
             }
 
         })