import requests import json start_url ='https://www.ximalaya.com/revision/play/album?albumId=3595841&pageNum={}&sort=-1&pageSize=30' count=1 num=1 for count in range(1,8): url =start_url.format(count) headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'} response =requests.get(url,headers=headers).text # print(response) dicts =json.loads(response) list = dicts['data']['tracksAudioPlay'] #json 提取 list 使用 for in # print(list) for i in list: # print(i['src']) music = i['src'] music_html =requests.get(music,headers=headers) with open('./喜马拉雅/{}'.format(music[-33:]),'wb') as f: f.write(music_html.content) print(' 已经完成下载{}首音频'.format(num)) num+=1