26 lines
701 B
Python
26 lines
701 B
Python
import requests
|
|
|
|
# 获取曲目信息的函数
|
|
|
|
def get_recording_info(mbid):
|
|
url = f'https://musicbrainz.org/ws/2/recording/{mbid}?fmt=json'
|
|
response = requests.get(url)
|
|
if response.status_code == 200:
|
|
return response.json() # 返回曲目信息
|
|
else:
|
|
return {'error': 'Not Found', 'status_code': response.status_code}
|
|
|
|
# 测试 MBID 列表
|
|
mbids = [
|
|
'a34ecc5d-388e-40fb-a2a2-5354db8fdfaa', # 示例 MBID
|
|
'c6f24108-1f3f-4bf7-a52d-818ec956c2de',
|
|
'cd2d5cc0-7cfa-4f7c-99f5-4fd05b07873c'
|
|
]
|
|
|
|
# 循环查询每个 MBID
|
|
for mbid in mbids:
|
|
info = get_recording_info(mbid)
|
|
print(f'情報for MBID {mbid}:')
|
|
print(info)
|
|
print('-' * 40) # 分隔线
|