-
Lib should use Expected behavior To Reproduce >>> from lyricsgenius import Genius
>>> genius = Genius(TOKEN)
>>> genius.search_song("Hello", "Adele")
Searching for "Hello" by Adele...
Traceback (most recent call last):
File "/root/testvenv/lib/python3.6/site-packages/lyricsgenius/api/base.py", line 80, in _make_request
response.raise_for_status()
File "/root/testvenv/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Hello+Adele
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/testvenv/lib/python3.6/site-packages/lyricsgenius/genius.py", line 401, in search_song
search_response = self.search_all(search_term)
File "/root/testvenv/lib/python3.6/site-packages/lyricsgenius/api/public_methods/search.py", line 210, in search_all
return self.search(search_term, per_page, page, endpoint)
File "/root/testvenv/lib/python3.6/site-packages/lyricsgenius/api/public_methods/search.py", line 45, in search
return self._make_request(path, params_=params, public_api=True)
File "/root/testvenv/lib/python3.6/site-packages/lyricsgenius/api/base.py", line 88, in _make_request
raise HTTPError(response.status_code, error)
requests.exceptions.HTTPError: [Errno 403] 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Hello+Adele
Version info
Additional context |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
genius.search_all
genius.song
genius.lyrics But as you have experienced, VPS and proxy users are very likely to get a 403 error because of Genius's captcha service. Even If we switched to using
You can view the list of developers' API methods in the docs. |
Beta Was this translation helpful? Give feedback.
-
@allerter I didn't thought about this. That's sad. Btw, thanks for explanation! |
Beta Was this translation helpful? Give feedback.
-
fwiw, it seems the authenticated APIs behind api.genius.com work fine behind the VPS, it's just the public ones without auth that run into the 403 issue. There is an authenticated version of the Search API with a similar response format that the library could probably be refactored to, however the auth API is also missing other APIs like /albums so this is an incomplete solution overall. |
Beta Was this translation helpful? Give feedback.
-
I have the same error!!!
I used the liyricsgenius package. But I don't know how to integrate Genius authentication method into Code. If anyone knows, please help!!! |
Beta Was this translation helpful? Give feedback.
Genius.search_song
is a convenience method and calls the following methods:But as you have experienced, VPS and proxy users are very likely to get a 403 error because of Genius's captcha service. Even If we switched to using
api.genius.com/search
, you would still get a 403 error ingenius.lyrics
.I suggest either going behind a proxy that works for Genius or limiting your calls to developers' API methods. For example, if you wanted to search for a song and get its info, you could try this which only uses developers' API methods: