1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

album,artist请求增加超时时间;小调整

This commit is contained in:
2022-10-29 14:32:51 +08:00
parent bf74284ab2
commit 71eb3b7ce5
8 changed files with 80 additions and 85 deletions

View File

@@ -59,7 +59,7 @@ async function fetch({ albumId, debug = false, update = false }) {
let url = `https://music.163.com/album?id=${albumId}`;
try {
// var html = fs.readFileSync(path.join(__dirname, "../../temp", `album-${albumId}.html`), 'utf8');
var html = await requestUtils.getApiResult(url);
var html = await requestUtils.getApiResult(url, { timeout: 3000 });
// fs.writeFileSync(path.join(__dirname, "../../temp", `album-${albumId}.html`), html);
} catch (errors) {
console.error(errors);

View File

@@ -52,7 +52,7 @@ async function fetch({ artistId, debug = false }) {
let url = `https://music.163.com/artist?id=${artistId}`;
try {
// var html = fs.readFileSync(path.join(__dirname, "../../temp", `artist-${artistId}.html`), 'utf8');
var html = await requestUtils.getApiResult(url);
var html = await requestUtils.getApiResult(url, { timeout: 3000 });
// fs.writeFileSync(path.join(__dirname, "../../temp", `artist-${artistId}.html`), html);
} catch (errors) {
console.error(errors);

View File

@@ -21,7 +21,7 @@ async function fetchAll({ args = {} }) {
for (let i = 0; i < count; i++) {
await global.checkIsExit();
var subArray = songIds.slice(i * step, (i + 1) * step);
console.log(`${i + 1}/${count} | song: ${subArray[0]}-${subArray.slice(-1)[0]} | ${args.min || "?"}-${args.max || "?"}`);
console.log(`${i + 1}/${count} | song: ${subArray[0]}-${subArray.slice(-1)[0]} (${subArray.length}) | ${args.min || "?"}-${args.max || "?"}`);
try {
await fetch({ songIdArray: subArray });
} catch (err) {