update
This commit is contained in:
@@ -21,7 +21,10 @@ async function fetchAll() {
|
||||
|
||||
// 首先查询有无正在爬取中的记录
|
||||
var songIds = await dbUtils.query(`
|
||||
SELECT song_id FROM comment_progress WHERE current_status != 2
|
||||
-- 本机
|
||||
SELECT song_id FROM comment_progress WHERE current_status != 2 AND song_id < 30000000 ORDER BY current_status DESC
|
||||
-- 服务器
|
||||
-- SELECT song_id FROM comment_progress WHERE current_status != 2 AND song_id > 30000000 ORDER BY current_status DESC
|
||||
`, []);
|
||||
songIds = songIds.map(item => item.song_id);
|
||||
|
||||
@@ -184,7 +187,7 @@ async function fetch({ songId, debug = false }) {
|
||||
current_status: progress.currentStatus,
|
||||
total: progress.total,
|
||||
}, songId]);
|
||||
await sleepUtils.sleep(global.sleepTime);
|
||||
// await sleepUtils.sleep(global.sleepTime);
|
||||
}
|
||||
// return commentInfo;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ async function fetchAll() {
|
||||
|
||||
// 获取歌词详情
|
||||
async function fetch({ songId, debug = false }) {
|
||||
var url = `https://music.163.com/api/song/lyric?id=${songId}&lv=1`;
|
||||
var url = `https://music.163.com/api/song/lyric?id=${songId}&lv=1`; // &kv=1&tv=-1
|
||||
try {
|
||||
// var json = fs.readFileSync(path.join(__dirname, "../../temp", `lyric-${songId}.json`), 'utf8');
|
||||
var json = await requestUtils.getApiResult(url);
|
||||
@@ -45,6 +45,16 @@ async function fetch({ songId, debug = false }) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof lyric == "undefined") {
|
||||
// 这首歌爬song的时候还在,但是现在不在了
|
||||
dbUtils.query('INSERT IGNORE INTO lyric SET ?', {
|
||||
song_id: songId,
|
||||
lyric: '',
|
||||
version: -1,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let lyricInfo = {
|
||||
songId: songId,
|
||||
lyric: lyric.lyric,
|
||||
|
Reference in New Issue
Block a user