diff --git a/netease_music/src/getInfo/albumInfoUtils.js b/netease_music/src/getInfo/albumInfoUtils.js index af96dea..22ff399 100644 --- a/netease_music/src/getInfo/albumInfoUtils.js +++ b/netease_music/src/getInfo/albumInfoUtils.js @@ -159,7 +159,7 @@ async function fetch({ albumId, debug = false, update = false }) { songIds: songIds, }; // console.log("albumInfo", albumInfo); - if (albumId > 0) { + if (albumId > 0 && songIds.length > 0) { await dbUtils.query(` INSERT IGNORE INTO song_album_relation (song_id, album_id) VALUES ? `, [songIds.map(songId => [Number(songId), albumId])]); diff --git a/netease_music/src/getInfo/artistInfoUtils.js b/netease_music/src/getInfo/artistInfoUtils.js index dd40c5a..928bdba 100644 --- a/netease_music/src/getInfo/artistInfoUtils.js +++ b/netease_music/src/getInfo/artistInfoUtils.js @@ -110,7 +110,7 @@ async function fetch({ artistId, debug = false }) { songIds: songIds, }; // console.log("artistInfo", artistInfo); - if (artistId > 0) { + if (artistId > 0 && songIds.length > 0) { await dbUtils.query(` INSERT IGNORE INTO song_artist_relation (song_id, artist_id) VALUES ? `, [songIds.map(songId => [Number(songId), artistId])]);