Python——付费/版权歌曲下载
生活随笔
收集整理的這篇文章主要介紹了
Python——付费/版权歌曲下载
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
很多歌曲需要版權或者付費才能收聽
?
?
?
?
正確食用方法:
1、找到歌曲編號
?
?2、輸入編號并點擊下載歌曲
?
?
# coding:utf8 # author:Jery # datetime:2019/4/13 23:42 # software:PyCharm # function:輸入編號下載歌曲,百度音樂/千千音樂歌曲下載 import tkinter as tk import requestsroot = 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()?
轉載于:https://www.cnblogs.com/Jery-9527/p/10703701.html
總結
以上是生活随笔為你收集整理的Python——付费/版权歌曲下载的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python2.7详细安装教程_pyth
- 下一篇: SaaSpace:10种最佳免费密码管理