From b7fc10de6386bf3139d4d890e0a6515072e85074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Wed, 9 Nov 2022 16:15:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99playlist=E7=88=AC=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E6=B3=95-01=EF=BC=88=E8=B0=83=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E9=80=9A=E8=BF=87=E7=BD=91?= =?UTF-8?q?=E6=98=93=E4=BA=91=E9=9F=B3=E4=B9=90=E9=A6=96=E9=A1=B5=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netease_music/src/getInfo/commentUtils.js | 1 - ...{playlistUtils.js => playlistUtils_old.js} | 2 +- netease_music/src/getInfo/testUtils.js | 29 +++++++++++++++++++ netease_music/src/index.js | 2 ++ 4 files changed, 32 insertions(+), 2 deletions(-) rename netease_music/src/getInfo/{playlistUtils.js => playlistUtils_old.js} (96%) create mode 100644 netease_music/src/getInfo/testUtils.js diff --git a/netease_music/src/getInfo/commentUtils.js b/netease_music/src/getInfo/commentUtils.js index 1447d81..bd9cf25 100644 --- a/netease_music/src/getInfo/commentUtils.js +++ b/netease_music/src/getInfo/commentUtils.js @@ -1,7 +1,6 @@ const fs = require('fs'); const path = require('path'); -const requestUtils = require('../../../utils/requestUtils'); const sleepUtils = require('../../../utils/sleepUtils'); const dataManager = require('../dataManager'); diff --git a/netease_music/src/getInfo/playlistUtils.js b/netease_music/src/getInfo/playlistUtils_old.js similarity index 96% rename from netease_music/src/getInfo/playlistUtils.js rename to netease_music/src/getInfo/playlistUtils_old.js index 004f801..6a84328 100644 --- a/netease_music/src/getInfo/playlistUtils.js +++ b/netease_music/src/getInfo/playlistUtils_old.js @@ -9,7 +9,7 @@ const dbUtils = global.dbUtils; // refer: // https://neteasecloudmusicapi-docs.4everland.app/ // https://github.com/Binaryify/NeteaseCloudMusicApi -const { playlist_catlist, playlist_hot, playlist_detail } = require('NeteaseCloudMusicApi'); +const { playlist_detail } = require('NeteaseCloudMusicApi'); const dataManager = require('../dataManager'); async function fetchAll({ args }) { diff --git a/netease_music/src/getInfo/testUtils.js b/netease_music/src/getInfo/testUtils.js new file mode 100644 index 0000000..b87af4a --- /dev/null +++ b/netease_music/src/getInfo/testUtils.js @@ -0,0 +1,29 @@ +const fs = require('fs'); +const path = require('path'); + +const sleepUtils = require('../../../utils/sleepUtils'); + +const dbUtils = global.dbUtils; + +// refer: +// https://neteasecloudmusicapi-docs.4everland.app/ +// https://github.com/Binaryify/NeteaseCloudMusicApi +const { top_playlist, top_playlist_highquality, related_playlist } = require('NeteaseCloudMusicApi'); + +// 获取歌词详情 +async function fetch() { + try { + var result = await related_playlist({ + id: 1 + }); + fs.writeFileSync(path.join(__dirname, "../../temp", `test.json`), JSON.stringify(result.body)); + } catch (errors) { + console.error("error", errors); + await sleepUtils.sleep(10 * 1000); + } + console.log(result); +} + +module.exports = { + fetch: fetch, +} \ No newline at end of file diff --git a/netease_music/src/index.js b/netease_music/src/index.js index 39ecd95..95c733d 100644 --- a/netease_music/src/index.js +++ b/netease_music/src/index.js @@ -21,6 +21,7 @@ const commentUtils = require('./getInfo/commentUtils'); const playlistUtils = require('./getInfo/playlistUtils'); const assistantUtils = require('./assistantUtils'); +const testUtils = require('./getInfo/testUtils'); /** * 测试 @@ -37,6 +38,7 @@ async function test() { // let res = await artistInfoUtils.fetch({ artistId: "12023508" }); // let res = await songInfoUtils.fetch({ songId: "437608327" }); // let res = await playlistUtils.fetch({ playlistId: "4980157066", debug: true }); + // let res = await testUtils.fetch(); // let res = await albumInfoUtils.getFromDatabase({ albumId: "9156" }); // let res = await artistInfoUtils.getFromDatabase({ artistId: "12023508" });