def get_music(): music_list = cloudmusic.search(e1.get(),5) for music in music_list: if len(music.artist) == 1: artist = music.artist[0] else: artist = "" for ar in music.artist: artist += ar + " " music.name = music.name.replace('|', '') music.name = music.name.replace('/', '') music.name = music.name.replace('?', '') music.name = music.name.replace('*', '') music.name = music.name.replace('\\', '') music.name = music.name.replace('<', '') music.name = music.name.replace('>', '') music.name = music.name.replace(':', '') music.name = music.name.replace('"', '') music.name = music.name.replace('?', '') music.name = music.name.replace(':', '') name = music.name + " - " + artist + "." + music.type # print(f'歌曲名称:{name}\n歌手:{gehsou}') # print(f'音乐id:{Id}') # 文本框 text.insert(END, '名称:{}'.format(name)) text.insert(END, '歌手:{}'.format(artist)) # text.insert(END,'id:{}'.format(Id)) # 文本框滚动 text.see(END) # 更新 text.update()
def downloadone(): music_list = cloudmusic.search(e1.get(),1) for i in music_list: Id = i.id name = i.name musicid = cloudmusic.getMusic(Id) musicid.download(level='standard') messagebox.showinfo(message="{}下载成功".format(name))
def downloadall(): music_list = cloudmusic.search(e1.get(),5) for music in music_list: name = music.name Id = music.id musicid = cloudmusic.getMusic(Id) musicid.download(level='standard') messagebox.showinfo(message="{}下载成功".format(name))
def get(param): song = cloudmusic.search(param, 1) comment_list = song[0].getHotComments(5) songId = song[0].id comments = '' for i in range(len(comment_list) - 1): comments = comments + comment_list[i]['content'] + "|" + comment_list[ i]['nickName'] + "|" comments = comments + comment_list[4]['content'] + "|" + comment_list[4][ 'nickName'] print(songId + '+' + comments)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/05/27 下午 3:18 # @Author : 殇夜殇雪 # @File : 搜索.py import cloudmusic import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030') 专辑 = cloudmusic.getAlbum(81127107) 歌名 = input("请输入你想搜索的歌名:") search_list = cloudmusic.search(歌名, 20) print(search_list) for i in range(len(search_list)): print(f"第{i + 1}首:{search_list[i].name}")
def audition(): music_list = cloudmusic.search(e1.get(),1) driver = webdriver.Chrome(r'C:\Users\Desk\chromedriver.exe') driver.get(music_list[0].url)
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/05/27 下午 3:39 # @Author : 殇夜殇雪 # @File : 下载.py import cloudmusic import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='gb18030') 歌名 = input("请输入歌曲:") 搜索 = cloudmusic.search(歌名, 20) for i in range(len(搜索)): print(f"第:{i+1}首{搜索[i].name}") zz = f"作者:{搜索[i].artist[0]}" s = f"歌曲ID:{搜索[i].id}" print(s) print(zz) ID = input("对应歌的ID:") 下载 = cloudmusic.getMusic(ID) 下载.download("D:\Pycharm\普通程序\爬虫\音乐", level=" lossess ")
def getReCommend(param): song = cloudmusic.search(param, 1) comment_list = song[0].getHotComments(5) songId = song[0].id
def searchSong(arg): getSongList = cloudmusic.search(arg, 1) data = getSongList[0].name + '|' + getSongList[0].artist[ 0] + '|' + getSongList[0].id + '|' + getSongList[ 0].url + '|' + getSongList[0].picUrl print(data)