1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
程序员小墨 2022-10-01 21:25:37 +08:00
parent c98d453e14
commit 5d2bfccb4b
5 changed files with 14 additions and 15 deletions

View File

@ -35,17 +35,16 @@ async function checkIsExit() {
async function test() { async function test() {
console.log("neteaseMusic test..."); console.log("neteaseMusic test...");
// getMusicInfo({ songId: "1855221507" });
// getArtistInfo({ artistId: "1079074" });
// getAlbumInfo({ albumId: "74268047" });
// 不是所有歌手都有个人主页 例如 https://music.163.com/#/artist?id=1079075 // 不是所有歌手都有个人主页 例如 https://music.163.com/#/artist?id=1079075
// getUserInfo({ userId: "37365202" });
// let res = await albumInfoUtils.getFromDatabase({ albumId: "34943450" }); let res = await albumInfoUtils.fetch({ albumId: "9156", debug: true });
// let res = await artistInfoUtils.getFromDatabase({ artistId: "12023508" }); // let res = await artistInfoUtils.getFromDatabase({ artistId: "12023508" });
// let res = await songInfoUtils.getFromDatabase({ songId: "437608327" }); // let res = await songInfoUtils.getFromDatabase({ songId: "437608327" });
// console.log(res);
// let res = await albumInfoUtils.getFromDatabase({ albumId: "9156" });
// let res = await artistInfoUtils.getFromDatabase({ artistId: "12023508" });
// let res = await songInfoUtils.getFromDatabase({ songId: "437608327" });
console.log(res);
} }

View File

@ -53,7 +53,7 @@ CREATE TABLE `song_artist_relation` (
CREATE TABLE `lyric` ( CREATE TABLE `lyric` (
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id', `song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
`version` int(10) unsigned NOT NULL COMMENT '版本', `version` int(10) unsigned NOT NULL COMMENT '歌词版本',
`lyric` text NOT NULL COMMENT '歌词', `lyric` text NOT NULL COMMENT '歌词',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', `modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',

View File

@ -21,9 +21,9 @@ async function getFromDatabase({ albumId }) {
} }
// 获取专辑详情 // 获取专辑详情
async function fetch({ albumId }) { async function fetch({ albumId, debug = false }) {
let result = await dbUtils.query('SELECT count(*) as count FROM album WHERE album_id = ?', [albumId]); let result = await dbUtils.query('SELECT count(*) as count FROM album WHERE album_id = ?', [albumId]);
if (result[0].count > 0) { if (result[0].count > 0 && !debug) {
console.log(`数据库中已有数据,跳过 albumId: ${albumId}`); console.log(`数据库中已有数据,跳过 albumId: ${albumId}`);
return; return;
} }
@ -132,7 +132,7 @@ SELECT
FROM FROM
album album
WHERE WHERE
version = 3 and full_description is null and description like '%专辑《%》,简介:%' full_description is null and description like '%专辑《%》,简介:%'
*/ */
async function update({ albumId }) { async function update({ albumId }) {
let result = await dbUtils.query('SELECT count(*) as count FROM album WHERE album_id = ?', [albumId]); let result = await dbUtils.query('SELECT count(*) as count FROM album WHERE album_id = ?', [albumId]);

View File

@ -21,9 +21,9 @@ async function getFromDatabase({ artistId }) {
} }
// 获取音乐人详情 // 获取音乐人详情
async function fetch({ artistId }) { async function fetch({ artistId, debug = false }) {
let result = await dbUtils.query('SELECT count(*) as count FROM artist WHERE artist_id = ?', [artistId]); let result = await dbUtils.query('SELECT count(*) as count FROM artist WHERE artist_id = ?', [artistId]);
if (result[0].count > 0) { if (result[0].count > 0 && !debug) {
console.log(`数据库中已有数据,跳过 artistId: ${artistId}`); console.log(`数据库中已有数据,跳过 artistId: ${artistId}`);
return; return;
} }

View File

@ -23,9 +23,9 @@ async function getFromDatabase({ songId }) {
} }
// 获取音乐详情 // 获取音乐详情
async function fetch({ songId }) { async function fetch({ songId, debug = false }) {
let result = await dbUtils.query('SELECT count(*) as count FROM song WHERE song_id = ?', [songId]); let result = await dbUtils.query('SELECT count(*) as count FROM song WHERE song_id = ?', [songId]);
if (result[0].count > 0) { if (result[0].count > 0 && !debug) {
console.log(`数据库中已有数据,跳过 songId: ${songId}`); console.log(`数据库中已有数据,跳过 songId: ${songId}`);
return; return;