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

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))






转载于:https://www.cnblogs.com/LQ970811/p/10518920.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值