Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the genre of a song? #255

Closed
Mohammad9760 opened this issue Mar 9, 2023 · 2 comments
Closed

how to get the genre of a song? #255

Mohammad9760 opened this issue Mar 9, 2023 · 2 comments

Comments

@Mohammad9760
Copy link

https://lyricsgenius.readthedocs.io/en/master/reference/types.html?highlight=song#song
there's no attribute for knowing the genre of the song.
I want to know if there's a way I can extract genre information about a song.
thanks!

@allerter

This comment was marked as outdated.

@allerter
Copy link
Collaborator

You can get the genres set for a song from the tags key if you get the song info from their WebAPI:

genius = lyricsgenius.PublicAPI()

song = genius.song(1)["song"]
for tag in song["tags"]:
    print(tag["name"], sep=", ")

There is a chance this might raise a HTTP 403 error which is referenced in #220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants