Ich habe eine Funktion, die get_top_tags()
Methode verwendet Top-Tags in last.fm API
zu holen:Python - Empfängt alle Genre-Tags von Last.fm API
def lastfm_tags(tag):
tag_weight = {}
result = last.get_top_tags()
for tag in result:
tag_weight[str(tag.item.get_name())] = str(tag.weight)
tag_weight = {k: int(v) for k, v in tag_weight.items()}
return tag_weight
print lastfm_tags('pop')
druckt:
{'industrial': 533792, 'punk': 849254, 'indie': 1972289, 'metal': 1214142, 'heavy metal': 652768, 'japanese': 428483, 'pop': 1874644, 'new wave': 399642, 'black metal': 772854, 'rap': 513369, 'ambient': 1030860, 'alternative': 2059622, 'hard rock': 821047, 'electronic': 2289385, 'blues': 531227, 'folk': 882684, 'classic rock': 1123889, 'alternative rock': 1123671, '90s': 447817, 'Progressive metal': 407423, 'indie rock': 850647, 'electronica': 614612, 'female vocalists': 1558073, 'Soundtrack': 529623, 'dance': 769325, 'psychedelic': 458873, '80s': 752035, 'piano': 410036, 'chillout': 636262, 'post-rock': 426621, 'punk rock': 518635, 'jazz': 1117396, 'seen live': 2098252, 'instrumental': 818216, 'singer-songwriter': 810484, 'acoustic': 461045, 'hardcore': 656385, 'funk': 399980, 'Classical': 539399, 'Hip-Hop': 814911, 'death metal': 671617, 'soul': 641317, 'british': 667770, 'thrash metal': 465438, 'hip hop': 395139, 'rock': 3879776, 'metalcore': 444620, 'german': 409117, 'Progressive rock': 693750, 'experimental': 1010752}
dann könnte ich auch abrufen tags
relativ zu den Künstlern:
def lastfm_artist_to_tags(artist):
tag_weight = {}
result = last.get_artist(artist).get_top_tags()
for tag in result:
tag_weight[str(tag.item.get_name())] = str(tag.weight)
tag_weight = {k: int(v) for k, v in tag_weight.items()}
return sorted(tag_weight.items(), key=lambda x: x[1], reverse=True)
welches Drucke mu ch spezifischere Tagging:
[('shoegaze', 100), ('experimental', 72), ('psychedelic', 70), ('seen live', 61), ('indie', 56), ('indie rock', 53), ('ambient', 14), ('post-rock', 12), ('noise rock', 11), ('dream pop', 9), ('Psychedelic Rock', 8), ('Neo-Psychedelia', 7), ('american', 7), ('rock', 7), ('post-punk', 6), ('Experimental Rock', 4), ('alternative', 4), ('art rock', 4), ('noise', 4), ('atlanta', 4), ('00s', 3), ('alternative rock', 3), ('Garage Rock', 3), ('ambient punk', 3), ('georgia', 3), ('noise pop', 3), ('USA', 2), ('Lo-Fi', 2), ('Avant-Garde', 2), ('Dreamy', 2), ('Psychedelia', 2), ('shoegazing', 2), ('psychedelic pop', 2), ('space rock', 2), ('kranky', 2), ('indie pop', 2), ('male vocalists', 1), ('10s', 1), ('deerhunter', 1), ('avantgarde', 1), ('4ad', 1)]
Gibt es eine Möglichkeit oder auch ein Verfahren -unknown mir, auf alle möglichen Tags zu holen?
macht total Sinn. Vielen Dank –