Open cool-aid-man opened 3 weeks ago
What do you mean "Client Access Token"? The cog doesn't do any authentication.
Are you sure your IP didn't just get banned somehow? The cog still works for me
What do you mean "Client Access Token"? The cog doesn't do any authentication.
Yes, the cog doesn't. I meant that since it's throwing me the error, I wanted to check if the API is working or not (for debugging purposes, basically)—hence, I used another service, Postman
, to check whether the API is up or down (and that service requires a Token, which you can generate via Genius).
Sorry, I could have been more clearer.
Are you sure your IP didn't just get banned somehow? The cog still works for me
Oh god! How do I check it? In our use case, the cog barely gets used 2-3 times a day, sometimes even less or none. So unless it's related to that YouTube ban (where YouTube banned a large number of ASNs—the reason why audio is unusable/broken for many many users - including me), I don't see any viable reason why my IP could get banned from using the cog alone 😥! Unless, of course, I'm missing something else.
A bit more info (if it helps): Since the YouTube ban, I had unloaded the Audio
cog but the smartlyrics
cog was working fine until it stopped and started erroring a few days ago.
Ryan, looks like it is an IP ban.
Tried with this:
<p>eval
headers = {"X-Genius-iOS-Version": "6.7.0",
"X-Genius-Logged-Out": "true",
"User-Agent": "Genius/1015 CFNetwork/1390 Darwin/22.0.0",
}
async with aiohttp.ClientSession(headers=headers) as session:
parms = {"q": "hello",}
async with session.get('https://api.genius.com/search/multi', params=parms) as resp:
print(resp.status)
j = await resp.json()
print(j)
And it returned 403
👇
(Looks like the YouTube ban did effect the cog)
403
Traceback (most recent call last):
File "<eval command - snippet #8>", line 9, in func
j = await resp.json()
^^^^^^^^^^^^^^^^^
File "/home/ubuntu/redenv/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1176, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://api.genius.com/search/multi?q=hello')
I suppose there's very little to do here but I still wanna ask -
(We actually love the cog so much and honestly, this is the only cog that has this ability to fetch the lyrics which is why asking this question, so if there's anything you could do would really be appreciated)
Update
Ryan, looks like it is an IP ban.
Tried with this:
<p>eval headers = {"X-Genius-iOS-Version": "6.7.0", "X-Genius-Logged-Out": "true", "User-Agent": "Genius/1015 CFNetwork/1390 Darwin/22.0.0", } async with aiohttp.ClientSession(headers=headers) as session: parms = {"q": "hello",} async with session.get('https://api.genius.com/search/multi', params=parms) as resp: print(resp.status) j = await resp.json() print(j)
And it returned
403
👇 (Looks like the YouTube ban did effect the cog)
PS. this was the actuall responce we got back: https://gist.github.com/cool-aid-man/ab3f304871ece051914edaef80142fe3
This doesn't have anything to do with a YouTube ban - it's just Cloudflare blocking your requests
I just changed the headers used to contact Genius, let me know if it changes anything
Its still not able to fetch results
This isn't really a thing that I can fix it seems - I'm not sure exactly how but Genius blocked you via Cloudflare. If you can get a new IP address it should fix it
we did some testing and making request using curl_cffi seems to work
Is this running on the same server though?
Is this running on the same server though?
Yep, that's on the same server that is getting blocked otherwise without the lib
Hey Ryan,
Getting
Command raised an exception: Exception: Could not get search results.
fromly
.postman
by using my own "Client Access Token" and it's returning200 ok
, so something else is acting weird.Result from that test: https://gist.github.com/cool-aid-man/2e0b64db5db36c426469ac848662680d
traceback
from the errored command:The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1366, in invoke await ctx.command.invoke(ctx) File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Exception: Could not get search results.