资源简介
python下载音乐源代码,输入你想要下载的歌手的名字,你就可以下载
代码片段和文件信息
import requests
import re
import json
import os
def get_name(singer):
url = ‘https://c.y.qq.com/soso/fcgi-bin/client_search_cp‘
params = {
‘catZhida‘: ‘1‘
‘w‘: singer
}
headers = {
‘referer‘: ‘https://y.qq.com/portal/search.html‘
‘user-agent‘: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/66.0.3359.139 Safari/537.36‘
}
html = requests.get(urlheaders=headersparams=params).text
content = re.compile(‘callback\((.*)\)‘).findall(html)[0]
content = json.loads(content)
data = content.get(‘data‘)
song = data.get(‘song‘)
lists = song.get(‘list‘)
name = []
for list in lists:
singer = list.get(‘singer‘)[0].get(‘mid‘)
name.append(singer)
name = name[0]
return name
def get_html(namesinger):
url = ‘https://c.y.qq.com/v8/fcg-bin/fcg_v8_singer_track_cp.fcg‘
params = {
‘singermid‘: name
‘order‘: ‘listen‘
‘begin‘: ‘0‘
‘num‘: ‘10‘
}
headers = {
‘referer‘: ‘https://y.qq.com/n/yqq/singer/003aQYLo2x8izP.html‘
‘user-agent‘: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/66.0.3359.139 Safari/537.36‘
}
html = requests.get(urlheaders=headersparams=params).text
return html
def get_music(vkeysongnamefilenamesinger):
if vkey and songname:
url3 = ‘http://dl.stream.qqmusic.qq.com/‘ + filename + ‘?vkey=‘ + vkey + ‘&guid=7133372870&uin=0&fromtag=66‘
headers = {
‘referer‘: ‘https://y.qq.com/n/yqq/singer/003aQYLo2x8izP.html‘
‘user-agent‘: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/66.0.3359.139 Safari/537.36‘
}
music = requests.get(url3headers=headers).content
dir = singer
if not os.path.exists(dir):
os.mkdir(dir)
with open(dir+‘/‘+songname+‘.m4a‘‘wb‘) as f:
f.write(music)
print(songname‘__‘singer)
d
- 上一篇:用python实现基于情感词典的情感分析
- 下一篇:music.py
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论