咳咳…不知道关注我的各位是啥年龄段的呢
之前有人找我整个DJ歌曲批量下载
说是开场要用 我就给他打包发过去了
现在我们来康康是咋进行的吧~
源码、资料电子书点击这里
环境模块
软件
Python3.8
pycharm2021
模块
import requests
import re
requests是数据请求模块,第三方模块,
需要手动安装一下,win+r打开运行框,输入cmd按回车,
然后输入 pip install requests 按回车即可安装。
re是正则表达式模块,不需要安装,自带的。
效果展示
代码展示
部分代码,仅做展示,网址我打码了,不然不给过,
文末名片获取完整代码及视频讲解。
import requests
import re
url = 'http://****/xc/'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36'
}
response = requests.get(url=url, headers=headers)
id_list = re.findall('><a href="/play/(\d+)/" title=', response.text)
for index in id_list:
link = f'http://*****/play/{index}/'
response_1 = requests.get(url=link, headers=headers)
response_1.encoding = response_1.apparent_encoding
mp3_info = re.findall('var music_name = "(.*?)"; var info = \{ "playurl": "(.*?)"', response_1.text)
title = mp3_info[0][0]
# http://******/3606/23t/16394.m4a
mp3_url = 'http://****cn:8399/' + mp3_info[0][1]
mp3_content = requests.get(url=mp3_url, headers=headers).content
with open('mp3\\' + title + '.mp3', mode='wb') as f:
f.write(mp3_content)
print(title, mp3_url)
这波音乐和木鱼必须要配合一波啊哈哈哈
希望我的文章可以帮到更多的人~
本文含有隐藏内容,请 开通VIP 后查看