Hi 🙂🖐
Welcome to a new post. Today I will share with you how to extract meta data from an audio file, such as album, artist, and more. To do this, I will use a library called tinytag, which is a library for reading the music meta data of most common audio files in pure Python.
step 1
install tinytag from pip install tinytag
step 2
from tinytag import TinyTag
song = TinyTag.get('test.mp3')
print(song.album)
print(song.year)
print(song.artist)
print(song.duration)
You can use print(song.as_dict())
to print all meta tags
Note
Some audio files do not have meta tags.
Form more information about tinytag
https://github.com/devsnd/tinytag
Now we're done 🤗
Don't forget to like and follow 🙂