pythonmp3mutageneyed3

Retrieve lyrics from an mp3 file in Python using 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>

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

Thank you so much in advanced.


Solution

  • It looks like that is a iterator. Try

    tag.lyrics[0]
    

    or

    for lyric in tag.lyrics:
      print lyric
    

    last resort print the objects directory and look for useful functions

    print dir(tag.lyrics)