部分歌曲没有artist信息等,增加异常处理,增强稳健性

This commit is contained in:
holwell 2025-02-14 16:17:59 +08:00
parent ede9a1fd35
commit 43cfe4e85b
2 changed files with 35 additions and 22 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
__pycache__/
.history/
neteasecloudmusicapi/
cookies.txt
failed_ids.txt
*.json

View File

@ -131,7 +131,14 @@ def process_songs(song_info_list, cookie):
# 更新 song_info 添加 artist 和 album 信息
song_info['artist'] = song_artist
song_info['album'] = song_album
try:
try_to_upload_song(song_info, cookie)
except Exception as e:
print(f'上传过程异常,跳过该歌曲:{e}')
save_failed_id(song_id)
def try_to_upload_song(song_info, cookie):
song_id = song_info['id']
attempts = 0
while attempts < 3:
result = import_song(song_info, cookie)