1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
程序员小墨 2022-10-02 12:03:36 +08:00
parent 7ced382c9f
commit 93db6371d9
4 changed files with 12 additions and 7 deletions

View File

@ -35,7 +35,7 @@ async function fetchAll({ isUpdate = false }) {
for (let i = 0; i < albumIds.length; i++) {
await global.checkIsExit();
const albumId = albumIds[i];
console.log(`${i}/${albumIds.length} | album: ${albumId}`);
console.log(`${i + 1}/${albumIds.length} | album: ${albumId}`);
try {
await fetch({ albumId: albumId, update: isUpdate });
} catch (err) {

View File

@ -31,7 +31,7 @@ async function fetchAll() {
for (let i = 0; i < artistIds.length; i++) {
await global.checkIsExit();
const artistId = artistIds[i];
console.log(`${i}/${artistIds.length} | artist: ${artistId}`);
console.log(`${i + 1}/${artistIds.length} | artist: ${artistId}`);
try {
await fetch({ artistId: artistId });
} catch (err) {
@ -72,9 +72,14 @@ async function fetch({ artistId, debug = false }) {
// console.log(artistInfoDict);
let image = /<meta property="og:image" content="http:\/\/p.\.music\.126\.net\/(.*?)" \/>/.exec(html)[1];
let songListJSONString = /<textarea id="song-list-pre-data" style="display:none;">(.*?)<\/textarea>/.exec(html)[1];
let songList = JSON.parse(songListJSONString);
let songIds = songList.map(song => song.id);
let songIds = [];
try {
let songListJSONString = /<textarea id="song-list-pre-data" style="display:none;">(.*?)<\/textarea>/.exec(html)[1];
let songList = JSON.parse(songListJSONString);
songIds = songList.map(song => song.id);
} catch (error) {
// 可能是歌手下面没有音乐 例如https://music.163.com/#/artist?id=30032762
}
let artistInfo = {
artistId: artistId,

View File

@ -16,7 +16,7 @@ async function fetchAll() {
for (let i = 0; i < songIds.length; i++) {
await global.checkIsExit();
const songId = songIds[i];
console.log(`${i}/${songIds.length} | lyric: ${songId}`);
console.log(`${i + 1}/${songIds.length} | lyric: ${songId}`);
try {
await fetch({ songId: songId });
} catch (err) {

View File

@ -35,7 +35,7 @@ async function fetchAll() {
for (let i = 0; i < songIds.length; i++) {
await global.checkIsExit();
const songId = songIds[i];
console.log(`${i}/${songIds.length} | song: ${songId}`);
console.log(`${i + 1}/${songIds.length} | song: ${songId}`);
try {
await fetch({ songId: songId });
} catch (err) {