重写playlist爬取方法-01(调接口,而不是通过网易云音乐首页获取)
This commit is contained in:
parent
6582bf8d40
commit
b7fc10de63
@ -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');
|
||||
|
||||
|
@ -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 }) {
|
29
netease_music/src/getInfo/testUtils.js
Normal file
29
netease_music/src/getInfo/testUtils.js
Normal file
@ -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,
|
||||
}
|
@ -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" });
|
||||
|
Loading…
Reference in New Issue
Block a user