update
This commit is contained in:
@@ -6,7 +6,7 @@ const requestUtils = require('../../../utils/requestUtils');
|
||||
const sleepUtils = require('../../../utils/sleepUtils');
|
||||
|
||||
// 获取音乐详情
|
||||
async function get({ songId }) {
|
||||
async function fetch({ songId }) {
|
||||
let result = await dbUtils.query('SELECT count(*) as count FROM song WHERE song_id = ?', [songId]);
|
||||
if (result[0].count > 0) {
|
||||
console.log(`数据库中已有数据,跳过 songId: ${songId}`);
|
||||
@@ -30,9 +30,9 @@ async function get({ songId }) {
|
||||
let url = `https://music.163.com/song?id=${songId}`;
|
||||
|
||||
try {
|
||||
// var html = fs.readFileSync(path.join(__dirname, "../temp", `song-${songId}.html`), 'utf8');
|
||||
// var html = fs.readFileSync(path.join(__dirname, "../../temp", `song-${songId}.html`), 'utf8');
|
||||
var html = await requestUtils.getApiResult(url);
|
||||
// fs.writeFileSync(path.join(__dirname, "../temp", `song-${songId}.html`), html);
|
||||
// fs.writeFileSync(path.join(__dirname, "../../temp", `song-${songId}.html`), html);
|
||||
} catch (errors) {
|
||||
console.error(errors);
|
||||
return;
|
||||
@@ -102,5 +102,5 @@ async function get({ songId }) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get: get,
|
||||
fetch: fetch,
|
||||
}
|
Reference in New Issue
Block a user