Python——付费/版权歌曲下载
很多歌曲需要版权或者付费才能收听
正确食用方法:
1、找到歌曲编号
2、输入编号并点击下载歌曲
# coding:utf8 # author:Jery # datetime:2019/4/13 23:42 # software:PyCharm # function:输入编号下载歌曲,百度音乐/千千音乐歌曲下载 import tkinter as tk import requests root = tk.Tk() root.geometry('400x150') root.title('千千音乐歌曲下载') l1 = tk.Label(root, text='请输入编号:') l1.grid() e1 = tk.Entry(root, text='', width=57) e1.grid(row=1, column=0) def download(): songids = [] songids.append(e1.get()) s = ','.join(songids) url = 'http://play.taihe.com/data/music/songlink' data = { 'songIds': s, 'hq': '0', 'type': 'm4a,mp3', 'rate': '', 'pt': '0', 'flag': '-1', 's2p': '-1', 'prerate': '-1', 'bwt': '-1', 'dur': '-1', 'bat': '-1', 'bp': '-1', 'pos': '-1', 'auto': '-1' } response = requests.post(url, data=data) music_infos = response.json()['data']['songList'] for music_info in music_infos: songLink = music_info['songLink'] songName = music_info['songName'] response = requests.get(songLink) # 路径自己修改 with open('E:\\Jay2\\' + songName + '.mp3', 'wb')as f: f.write(response.content) b1 = tk.Button(root, text='下载歌曲', width=8, command=download) b1.grid(row=2, column=0) def clear(): e1.delete(0, 'end') b2 = tk.Button(root, text='清除内容', width=8, command=clear) b2.grid(row=3, column=0) root.mainloop()