johnwmillr / LyricsGenius

Download song lyrics and metadata from Genius.com 🎶🎤
http://www.johnwmillr.com/scraping-genius-lyrics/
MIT License
898 stars 159 forks source link

Changing Artist Name to Wrong Artist #118

Closed danielcliu closed 4 years ago

danielcliu commented 4 years ago

Describe the bug There is a bug where if a desired Artist is queried and they were/are part of a more well known musical act the package will change the artist name to the more well known act.

Expected behavior When running

genius = Genius(token)
genius.search_artist('Swae Lee', max_songs=10 )

The search return the top 10 most popular songs for the artist "Swae Lee".

To Reproduce As implied above

  1. Create a Genius object
  2. Run search_artist('Swae Lee') with the Genius object

You should get output

Searching for songs by Swae Lee...

Changing artist name to 'Rae Sremmurd'
Song 1: "Black Beatles"
Song 2: ...

Version info

Additional context This behavior seems to be happening because in _get_time_from_search_response() in api.py, if the first result is the correct "type", then it is automatically returned. I suspect, in this particular case, Genius is returning the artist "Rae Sremmurd" first because I guess Swae Lee isn't as well known for his solo stuff.

Proposed solution I think a way to fix this is to not return the top hit, but instead check all the hits for type and to see if the 'id' matches the artist_name. It will mean a performance hit, but seeing as the precedent is set by #32, speed doesn't seem to be the biggest focus of this package.

I am willing to work on this and open a PR if you are ok with it

johnwmillr commented 4 years ago

Thanks for the detailed issue report! Please feel free to work on a PR, this is an ongoing issue that I'd like to get sorted out.

johnwmillr commented 4 years ago

Resolved by #123