experts,
I currently want to use all the song's tags in a research project. Of course, I have Pylast on my hand. But there is no detailed doc about Pylast.
Then, is there anyone can tell me how to use Pylast to get all tags of song's through last.fm api?
Many thanks.
It does not seem that what you want is actually possible with the last.fm api. Through the api only top tags are available.However they are not entierly clear on what constitutes a top tag. So it could be enough for your needs. Trying a couple of different artist the amounts of results I get are quite varying.
Here's a code example to get you started.
from pylast import *
#Set up the api key, secret, user and password here
network = get_lastfm_network(API_KEY,API_SECRET, user, password_hash)
userData = User(user, network)
track = network.get_track("Cher", "Believe")
#Get the tags a a TopItem object.
topItems = track.get_top_tags(limit=None)
for topItem in topItems:
print topItem.item.get_name(), topItem.weight
pylast actually have really good documentation. What I most often do is just fire up the shell and call help on the different pylast objects. There most of the functionalliy is explained. The source is also very readable so that is also a good place to find out how it actually works. So in this case:
help(TopItem)
help(Track)
help(Tag)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With