python源码——万能音乐下载器,无损vip音乐随意下载! 发表于 2019-03-06 | 更新于 2019-11-10 | 分类于 软件分享 python源码——万能音乐下载器,无损vip音乐随意下载! 软件源码123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117from tkinter import *from re import findall, subfrom tkinter.ttk import Comboboxfrom requests import get, postheaders = { 'Cookie': 'Tip_of_the_day=2; encrypt_data=56f2bc9d081609eb8e605a176c9f144de8c9c6ac96288a2e51fce7143a94433d8c0c4fc70944b9163392d9ea977fc7343168112d1769b16d03bd4b9d7d56317224940c2824ccbeeccb73a633bdfeabdd7c124ff7f5064b6ef27b7959ebcb279cb52e5da22eff1a00fd6ee3efe7adc077a415e7bd0edfb126ed4487ef27904634; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1', 'Host': 'moresound.tk', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36', 'X-Requested-With': 'XMLHttpRequest',}def huoqu(urlid): url = 'http://moresound.tk/music/' + urlid res = get(url, headers=headers) ress = res.json() ff = ress['url'] # print(ff) return ffdef Save(urlid): url = huoqu(urlid) res = get(url).content Save_wenjian = sub('[\\\\/:*?\"<>|]', '', str(Save_name)) # 正则去掉文件名不支持的字符 with open('{}.mp3'.format(Save_wenjian), 'wb')as f: f.write(res) confirmLabel.insert(END, '已保存至本程序运行的文件下!!!!', '\n\n请继续搜索下载')def danqu_url(id): global Save_name url = 'http://moresound.tk/music/api.php?get_song={}'.format(sousuo_key) data = {'mid': id} res = post(url, data=data, headers=headers) ss = res.json() # AAC = ss['url']['24AAC'] mp3 = ss['url']['128MP3'] Save_name = ss['song'] + '__' + ss['singer'] Save(mp3)id_list = [] # 用于将sousuo()函数获取到的歌曲ID装起来def sousuo(): global sousuo_key sousuoyinqin = xialalan.get() # 获取输入的搜索引擎 dict_sousuo = {'QQ': 'qq', '酷我': 'kw', '虾米': 'xm', '酷狗': 'kg', '百度': 'bd', '网易': 'wy'} sousuo_key = dict_sousuo[sousuoyinqin] # 确认选择的搜索引擎 del id_list[:] # 清空列表,重置(使用多次以后列表装太多数据,不删除下次会出错) confirmLabel.delete(0, END) # 清空文本框 dd = namee_Entry.get() # 获取输入的歌名 url = 'http://moresound.tk/music/api.php?search={}'.format(sousuo_key) data = { 'w': '{}'.format(dd), 'p': '1', 'n': '20', } res = post(url, data=data, headers=headers) ress = res.json() for i in range(15): name_geshou = ress['song_list'][i]['singer'][0]['name'] name_geming = ress['song_list'][i]['songname'] name_zhuanji = ress['song_list'][i]['albumname'] name_id = ress['song_list'][i]['songmid'] name_geming1 = sub('<sup.*|\n|\r|', '', str(name_geming)[:10]) # 去掉多余的信息 isserts = name_geshou + ' ' + name_geming1 + ' 专辑: ' + name_zhuanji confirmLabel.insert(END, str(i) + ':' + isserts) # 将获取到的详细信息打印到GUI id_list.append(name_id) # 获取到的id添加到列表里面,供xuanze(event)函数使用。def xuanze(event): ff = confirmLabel.get(confirmLabel.curselection()) ff = findall('\d+', str(ff)) # print(id_list[ii],ii) confirmLabel.delete(0, END) # 清空文本框 confirmLabel.insert(END, '正在下载:请稍后...') window.update() if ff != []: ii = int(ff[0]) danqu_url(id_list[ii])window = Tk()weather = StringVar()window.geometry('800x600+500+200') # 窗口大小window.title('MP3歌曲下载===下载速度取决于您的网速')taitouLabel = Label(window, text="请输入要下载的歌曲: ", height=2, width=30, font=("Times", 20, "bold"), fg='red')sousuoLabel = Label(window, text="选择音乐库: ", height=1, width=10, font=("Times", 15, "bold"), fg='#00008b')xialalan = Combobox(window, width=4, textvariable=weather, font=("黑体", 18, "bold"), state='editable')xialalan['values'] = ('QQ', '酷我', '虾米', '酷狗', '百度', '网易')xialalan.current(0)namee_Entry = Entry(window, width=25, font=("Times", 20, "bold"))button = Button(window, text="搜索", command=sousuo, ) # .grid_location(33,44)GunDongTiao = Scrollbar(window) # 设置滑动块组件confirmLabel = Listbox(window, height=15, width=55, font=("Times", 15, "bold"), fg='red', bg='#EEE5DE', yscrollcommand=GunDongTiao.set) # Listbox组件添加Scrollbar组件的set()方法confirmLabel.bind('<Double-Button-1>', xuanze) # 双击选择文本框的内容GunDongTiao.config(command=confirmLabel.yview) # 设置Scrollbar组件的command选项为该组件的yview()方法taitouLabel.grid(column=1)sousuoLabel.grid(row=0, column=0)xialalan.grid(row=1, column=0)namee_Entry.grid(row=1, column=1, sticky=N + S)button.grid(row=1, column=1, sticky=E)confirmLabel.grid(row=3, column=1, sticky=E)GunDongTiao.grid(row=3, column=2, sticky=N + S + W) # 设置垂直滚动条显示的位置window.mainloop() 使用方法 在python中运行,就会出现软件界面 打包成.exe文件 欢迎订阅我的频道,发布最新资源https://ssrshare.github.io?id=3 精彩文章推荐💥 老司机必备——暗网网址最新版💥 以牙还牙,以血还血,暗网之圣战分子的红房子💥 史上最详细的暗网教程💥 暗网交易市场💥 洋葱浏览器手机版 广告专区 点击☟图片即可进入