johnwmillr / LyricsGenius

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

Introduce an option to always use genius api with authorization. #224

Closed dzejkob1218 closed 2 years ago

dzejkob1218 commented 2 years ago

I'm developing a website that uses LyricsGenius to load lyrics from Spotify.

I want to host it on pythonanywhere, which, for non-paying users, limits domains that can be accessed by the server to those present on the whitelist.

All public, documented APIs are included in the whitelist, so accessing api.genius.com is no problem.

However, when searching for a song by title, LyricsGenius searches using the public api root, which is genius.com/api.

Unfortunately, the genius.com/api domain is not on pythonanywhere's whitelist.

It'd be nice to have an option to always make all requests through api.genius.com, perhaps via an attribute of the Genius class, as the problem probably could come up in different contexts and it's quite tricky to debug.

The only workaround I've come up with is changing the PUBLIC_API_ROOT attribute on Genius class instance to the same one as API_ROOT, but in that case the request still doesn't get it's header with authorization credentials, so it's rejected by genius and doesn't work.

dzejkob1218 commented 2 years ago

Okay after doing some more research I realized that genius doesn't provide access to the lyrics themselves through the developer API because of copyright reasons. Bummer.