网易云爬虫系列-打印歌词

爬虫功能,批量输出歌曲的歌词

使用方法:

pip install cloudmusic
pip install re
pip install python
请先确保自己已经安装了以上的库
首先输出你要的查询的歌曲
其次输出你要打印的数量(默认为5首)

注意:由于本人技术原因,输出的歌词前面带有出现的时间点,需要用到正则表达式来提取,(但是暂时不会),所以请自行处理!



import cloudmusic
import re
def remove_stop_words(f):
	stop_words = ['作词', '作曲', '编曲', 'Arranger', '录音', '混音', '人声', 'Vocal', '弦乐', 'Keyboard', '键盘', '编辑', '助理', 'Assistants', 'Mixing', 'Editing', 'Recording', '音乐', '制作', 'Producer', '发行', 'produced', 'and', 'distributed','合作人:','/母带处理:','专辑封面设计:','/母带处理:',':','  :']
	for stop_word in stop_words:
		f = f.replace(stop_word, '')
	return f
content =input('Please enter music name ')
number = input('Please enter the number of result')
songs = cloudmusic.search(content,number)
for single_song in songs:
	song = cloudmusic.getMusic(single_song.id)
	print('+++++++++++++++{}歌词+++++++++++++++'.format(song.name))
	print('++++++++++++++++++++++++++++++++++++++++++')
	lyrics = song.getLyrics()
	print(remove_stop_words(lyrics[0]))
	
	

效果图,运行于cmd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山河锦绣放眼好风光

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值