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

Step by step setup with "403 Client Error" #270

Closed orlevit closed 3 months ago

orlevit commented 3 months ago

Hi πŸ‘‹ I am folllowing the usage instructions and I get the following error: "HTTPError: [Errno 403] 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Andy+Shauf"

The code + error: image

The token is the "generated access token" from the Genius API: image

Even with oauth2, I still get the same error image

What am i missing? Thanks for the help! 😊

allerter commented 3 months ago

Hi. You're not missing anything. Also, you don't need to set up OAuth2 unless you need it for authorizing people on your web app (which doesn't seem to be the case for you). The problem here is that geniust.search_artist sends requests to Genius's Web API; this API is the front-facing API that doesn't need a token to be used and subsequently is checked by Genius's IP checker. The solution here is to either: change your IP or use methods that don't send requests to the Web API (you will have limited functionality in this case).

orlevit commented 3 months ago

Thanks! It worked 😊

Louanes1 commented 2 months ago

It worked when I tried to run from a local python file. Same code wasn't working on google collab (not the same ip address) I was getting the 403 error code.