# 调用get_song_info函数,传入歌曲名和歌手名,得到歌曲信息 # 从我的回答中获取歌曲名和歌手名 song_name = input("What is the song name? ") artist_name = input("Who is the artist name? ") # 调用get_song_info函数,传入歌曲名和歌手名 song_info = get_song_info(song_name, artist_name) # 检查是否获取到了歌曲信息 if song_info is not None: # 打印歌曲信息 print(f"Song ID: {song_info['id']}") print(f"Song Title: {song_info['title']}") print(f"Artist Name: {song_info['artist']['name']}") print(f"Album Name: {song_info['album']['title']}") # 获取播放链接 preview_url = song_info["preview"] # 调用play_song函数,传入播放链接,在浏览器中打开并播放音乐 play_song(preview_url) else: # 如果没有获取到歌曲信息,打印提示信息 print("Sorry, I could not find the song you requested.")