update
This commit is contained in:
parent
d6c78a28bd
commit
7ced382c9f
@ -13,7 +13,7 @@ global.dbUtils = dbUtils;
|
||||
console.log("global.useMysqlPool:", !!global.useMysqlPool);
|
||||
|
||||
// 两次请求之间停顿时间
|
||||
global.sleepTime = 500;
|
||||
global.sleepTime = 300;
|
||||
|
||||
// 引入utils
|
||||
const songInfoUtils = require('./src/getInfo/songInfoUtils');
|
||||
@ -47,9 +47,9 @@ async function main() {
|
||||
console.log("neteaseMusic Start fetch ...");
|
||||
while (true) {
|
||||
// 删除脏数据
|
||||
var affectRows1 = await dbUtils.query(`DELETE FROM song_artist_relation WHERE song_id = 0 OR artist_id = 0`, []);
|
||||
var affectRows2 = await dbUtils.query(`DELETE FROM song_album_relation WHERE song_id = 0 OR album_id = 0`, []);
|
||||
console.log(`删除脏数据 affectRows:`, affectRows1.affectedRows, affectRows2.affectedRows);
|
||||
var affectedRows1 = await dbUtils.query(`DELETE FROM song_artist_relation WHERE song_id = 0 OR artist_id = 0`, []);
|
||||
var affectedRows2 = await dbUtils.query(`DELETE FROM song_album_relation WHERE song_id = 0 OR album_id = 0`, []);
|
||||
console.log(`删除脏数据 affectedRows:`, affectedRows1.affectedRows, affectedRows2.affectedRows);
|
||||
|
||||
await songInfoUtils.fetchAll();
|
||||
await albumInfoUtils.fetchAll({});
|
||||
|
@ -67,7 +67,8 @@ async function fetch({ albumId, debug = false, update = false }) {
|
||||
}
|
||||
|
||||
if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
|
||||
// TODO 最后统一来处理这里 demo: artistId == 30084536
|
||||
let deleteResult = await dbUtils.query('DELETE FROM song_album_relation WHERE album_id = ?', [albumId]);
|
||||
console.log(`album: ${albumId} 不存在,从song_album_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,8 @@ async function fetch({ artistId, debug = false }) {
|
||||
}
|
||||
|
||||
if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
|
||||
// TODO 最后统一来处理这里 demo: artistId == 30084536
|
||||
let deleteResult = await dbUtils.query('DELETE FROM song_artist_relation WHERE artist_id = ?', [artistId]);
|
||||
console.log(`artist: ${artistId} 不存在,从song_artist_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,9 @@ async function fetch({ songId, debug = false }) {
|
||||
}
|
||||
|
||||
if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
|
||||
// TODO 最后统一来处理这里 demo: artistId == 30084536
|
||||
let deleteResult1 = await dbUtils.query('DELETE FROM song_album_relation WHERE song_id = ?', [songId]);
|
||||
let deleteResult2 = await dbUtils.query('DELETE FROM song_artist_relation WHERE song_id = ?', [songId]);
|
||||
console.log(`song: ${songId} 不存在,从song_album_relation, song_artist_relation表中删除. affectedRows: ${deleteResult1.affectedRows}, ${deleteResult2.affectedRows}`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user