Python爬虫——爬歌曲

import requests

url_api = "http://musicapi.taihe.com/v1/restserver/ting?method=baidu.ting.song.playAAC&songid=33895538"
response = requests.get(url_api)
data = response.json()
file_link = data['bitrate']['file_link']
title = data['songinfo']['title']
print(file_link, title)
response = requests.get(file_link)
with open(title+".m4a",mode = 'wb') as f:
   f.write(response.content)

你可能感兴趣的:(Python)