喜玛拉雅——徐薇翻唱合集

import requests
import json
import re

# 获取URL网址
start_url = 'https://www.ximalaya.com/revision/play/album?albumId=243032&pageNum={}&sort=-1&pageSize=30'
page=1
for page in range(1,3):
url=start_url.format(page)
headers={'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0'}
json_str=requests.get(url,headers=headers).text
# print(json_str)
re_url='src":(.*?),"hasBuy"'
re_title = '"trackName":(.*?),"trackUrl"'
music_title=re.findall(re_title,json_str)
music_url=re.findall(re_url,json_str)

for xima_title,xima_music in zip(music_title,music_url):
title = xima_title
music_wz=xima_music
remove_str_title= json.loads(title)
remove_str_url = json.loads(music_wz)
print(remove_str_title)
print(remove_str_url)
print(type(remove_str_title))
print(type(remove_str_url))




music=requests.get(remove_str_url,headers=headers)

with open('徐薇/{}.mp3'.format(remove_str_title),'wb') as f:
f.write(music.content)
print('正在下载{}'.format(remove_str_title))






posted @ 2019-03-12 19:23  葵儿啊  阅读(346)  评论(0编辑  收藏  举报
/*粒子线条,鼠标移动会以鼠标为中心吸附的特效*/