01
“”"
1.使用以下代代码下载所有的歌曲!歌曲名最好用已有的.
2.想办法把 https://www.17k.com/list/3015690.html 页面中章节详情的内容URL给拿到
2.1 做进程划分,爬取章节页面详情存储到本地,一个章节一个html文件.
2.2 html = response.text
2.3 如果你的请求返回出来的是乱码,设置response.encoding=‘utf-8’/‘gbk’…
2.4 你把文章的内容给拿出来存到本地.
“”"
下载歌曲的代码
path = ‘https://webfs.yun.kugou.com/201908192103/34f30c50f3dddf902489d8329b5a8256/G072/M03/1B/04/iA0DAFc4Oq2ASH8UACk2YICuxZ0695.mp3’
import requests
response = requests.get(path)
mp3_ = response.content
with open(‘joker.mp3’,mode=‘wb’) as f:
f.write(mp3_)
获取歌曲URL
import json
with open(‘C:/Users/admin/Desktop/top_500.txt’,mode=‘r’) as f:
res = f.readlines()[0].strip(’\n’).split(’}’)
for json_ in res[:-1]:
json = json + ‘}’
_json = json.loads(_json)
song_play_url = _json[‘song_