AIMPYouTube
AIMPYouTube copied to clipboard
[BUG] Adding YouTube URL not working
Add YouTube URL
and Check for new videos
not working anymore since September 2023.
I checked the config file and found out that the url saved to retrieve video/playlist details returns a 403 error. Maybe that could be the issue.
{
"URL": "https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2Csnippet&hl=en&id=2ZSHzwkeGSI",
"Flags": 0,
"PlaylistID": "{325AD8B6-1855-42E7-A0A4-8A81FFA08DDE}",
"GroupName": "YouTube"
},
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"errors": [
{
"message": "The request is missing a valid API key.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
I did some fast tests and the problem is the missing API key in the request.
I enabled YouTube Data API v3 from here https://console.cloud.google.com/marketplace/product/google/youtube.googleapis.com
and generated a YouTube API key for public access, then appended it to the url
https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2Csnippet&hl=en&id=2ZSHzwkeGSI
&key=[KEY]
It returned the expected info.
Can this api be generated by accessing with my own youtube account from the preferences?
Nevermind, I found out the issue.
The API key used in this project exceeded request quota. I get the following response if I do the request with the default api key:
{
"error": {
"code": 403,
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"errors": [
{
"message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
"domain": "youtube.quota",
"reason": "quotaExceeded"
}
]
}
}
I think the best solution should be to allow users to use their own api key, maybe by adding a textbox in the preferences. what do you think?
I think the best solution should be to allow users to use their own api key, maybe by adding a textbox in the preferences. what do you think?
I'm working on a pull request for this. Did you ever end up looking into this further?
~~I noticed all of the endpoints I could find that use the API key, could instead use an OAuth 2.0 token. The plugin even uses OAuth already in some places. If this was to spread out the API quota allowance, I would imagine more of the API requests would be cached, but caching is prevented entirely (Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n
).~~
Edit: Did more research, did not realize OAuth and the API Key used the same quota. I can absolutely add a Key field to options, including the Client ID and Secret for OAuth (not sure if having the same client and a different key would set off Google security).
@cloewen8 I temporary solved the issue by manually generating an api key on my account and changing it in the dll.
This is the value that I replaced in mine, without touching client_id or client_secret: https://github.com/AdrianEddy/AIMPYouTube/blob/master/Config.h#L13
without touching client_id or client_secret
In testing I noticed some calls would not work unless the OAuth and key where from the same projects. In those cases I'd have to use the build-in key (I'm providing an option to supply a custom client).
I recompiled from latest master, but I haven't checked it, I don't use AIMP anymore Please check and let me know if it works aimp_YouTube_v1.8.zip
Working perfectly now with my own developer keys. thanks!
Thanks, it works fine with v1.8. You can close the issue once this version is officially released.