使用eyeD3从Python的mp3文件中检索歌词

使用eyeD3从Python的mp3文件中检索歌词

本文介绍了使用eyeD3从Python的mp3文件中检索歌词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我目前正在尝试使用Python及其eyeD3库从mp3文件中提取歌词.歌词已经嵌入到mp3文件中(通过:MusicBee).我正在尝试使用eyeD3返回歌词.我不知道该怎么做.我在网上进行了广泛的搜索,发现的所有教程都显示了如何设置歌词.我只想从文件中读取它们.这是我当前的代码:

I am currently trying to use Python and its eyeD3 library to extract the lyrics from an mp3 file. The lyrics have been embedded into the mp3 file already (via: MusicBee). I am trying to use eyeD3 to return the lyrics. I can't figure out how to do it. I have searched online extensively and all I've found were tutorials showing how to SET the lyrics. I just want to read them from the file. Here's my current code:

track = eyed3.load(path)
tag = track.tag
artist = tag.artist
lyrics = tag.lyrics

艺术家正确返回艺术家的姓名,但歌词返回以下内容:

artist returns the artist's name correctly but lyrics returns the following:

<eyed3.id3.tag.LyricsAccessor object at 0x27402d0>

我如何才能返回嵌入到mp3中的原始文本歌词?这可能吗?

How can I just return the raw text lyrics embedded into an mp3? Is this possible?

非常感谢您.

推荐答案

它看起来像是一个迭代器.尝试

It looks like that is a iterator. Try

tag.lyrics[0]

for lyric in tag.lyrics:
  print lyric

不得已时打印对象目录并查找有用的功能

last resort print the objects directory and look for useful functions

print dir(tag.lyrics)

这篇关于使用eyeD3从Python的mp3文件中检索歌词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 00:47