museofficial / muse

🎧 a self-hosted midwestern Discord music bot that doesn't suck
MIT License
880 stars 229 forks source link

that doesn't exist (increase daily song query limit on YT) #315

Closed Defarus closed 3 years ago

Defarus commented 3 years ago

Hey! I've been enjoying the bot you've made and it worked near flawlessly for a few song searches before completely stopping top result searches. It will only respond with "that doesn't exist".

I've tried for an hour or two now with various restarts / reimplementations but haven't been able to replicate my initial success with the searches. I believe the issue lies with pulls from Youtube that aren't a direct link, as Spotify playlists have also stopped being played, even when it adds them to the queue.

Do you have any ideas on how I could go about fixing this? There's a good chance something just flew over my head, but I'm curious as to where I would've went wrong as well! Thanks!

hammondses commented 3 years ago

I'm trying to get it setup for the first time and I'm facing the same problems. None of the services seem to give me anything other than 'that doesn't exist'

codetheweb commented 3 years ago

YouTube's API comes with 10,000 credits per day. Doing a YouTube search consumes 100 credits, so you're effectively limited to 100 searches per day. The only way to increase this limit is to contact Google and ask nicely, but seeing as how their form asks for business details that avenue seems unlikely.

There's not really any good solution to this (although the error definitely could be improved). I could implement some kind of API key rotation scheme so you could double or triple your daily credits, but I'm guessing Google wouldn't be too happy with that. I used to use ytsr which scrapes the results page instead of making an API call and so doesn't require an API key / has much higher limits (in theory). However it kept breaking whenever a small change to YouTube's site was made and so I moved to their official API.

I think the best way forward might be to do a few things:

I probably won't get to this until this weekend, happy to accept PRs in the meantime. :)

Defarus commented 3 years ago

That makes sense and I appreciate the information. I think a slightly more descriptive error for that would be helpful but it's entirely understandable why it's not there already. You're great - thanks and have an awesome night!

Side note - for things such as Spotify playlists, I assume there's no real way to prevent it from immediately capping out besides converting to their own (YT's) playlists?

ghost commented 3 years ago

Testing this on my end and I have the same issue. Youtube API claim it has only received 12 requests, yet all play commands that aren't a youtube link now result in a ":no_entry_sign: that doesn't exist" or ":no_entry_sign: no songs found" message. This is slightly confusing as Spotify links don't work at all, and the Spotify dashboard claims no traffic has come through (I don't know how to test if this is due to the previous issue or it being set up wrong on my end though).

luisfavila commented 3 years ago

Same thing here, both youtube search and spotify links return no songs found. Is the spotify bit also related to the Google API limits (Search hasn't worked a single time so it's weird for it to have hit any limits - have just checked and Youtube Data API v3 has received 10 requests even though all the searches I tried returned no songs found)?

ssMMiles commented 3 years ago

this.youtubeVideo() expects a URL, not a video ID. I submitted #321 as an easy fix for now, but ytsr is easy to swap in.

codetheweb commented 3 years ago

I think @cheqpat @luisfavila @ssMMiles your issues were caused by a regression that should now be fixed, please let me know if you continue to get this error.

(This issue specifically is about upping the limit of song requests / day, so if your problem is unrelated to that please open a new issue.)

tymondouglas commented 3 years ago

I'm getting the error too. First time setup. I've checked the GCP and it received the requests, but with 100% ERROR

codetheweb commented 3 years ago

@tymondouglas are you saying that GCP reports that all requests errored or Muse is throwing errors? Please open a new issue with additional info if you still need help.

codetheweb commented 3 years ago

This should be now fixed.

A few notes: