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