jellyfin / jellyfin-plugin-bookshelf

https://jellyfin.org
MIT License
205 stars 20 forks source link

Google Books API Daily Limit Exceeded #4

Closed dbsleiman closed 4 years ago

dbsleiman commented 4 years ago

When trying to refresh book metadata, received this in logs:

jellyfin_1  | [01:23:06] [ERR] Error in Google Books
jellyfin_1  | MediaBrowser.Model.Net.HttpException: Forbidden
jellyfin_1  |    at Emby.Server.Implementations.HttpClientManager.HttpClientManager.EnsureSuccessStatusCode(HttpResponseMessage response, HttpRequestOptions options)
jellyfin_1  |    at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsyncInternal(HttpRequestOptions options, HttpMethod httpMethod)
jellyfin_1  |    at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsync(HttpRequestOptions options, HttpMethod httpMethod)
jellyfin_1  |    at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.GetSearchResultsInternal(BookInfo item, CancellationToken cancellationToken)
jellyfin_1  |    at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.FetchBookId(BookInfo item, CancellationToken cancellationToken)
jellyfin_1  |    at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.GetMetadata(BookInfo item, CancellationToken cancellationToken)
jellyfin_1  |    at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)

When trying to run a basic search against the google books api in the browser using the keys and info in ApiUrls.cs, got this:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceeded",
    "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/books.googleapis.com/quotas?project=75039668320",
    "extendedHelp": "https://console.developers.google.com/apis/api/books.googleapis.com/quotas?project=75039668320"
   }
  ],
  "code": 403,
  "message": "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/books.googleapis.com/quotas?project=75039668320"
 }
}

Possible solution might be an option for the user to provide their own API key to google books api.

hauntingEcho commented 4 years ago

this affects me at startup time as well, seeing several hundred of these in the log:

[...]
[07:09:03] [INF] Validating media library
[07:10:54] [ERR] Error in Google Books
MediaBrowser.Model.Net.HttpException: Forbidden
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.EnsureSuccessStatusCode(HttpResponseMessage response, HttpRequestOptions options)
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsyncInternal(HttpRequestOptions options, HttpMethod httpMethod)
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsync(HttpRequestOptions options, HttpMethod httpMethod)
   at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.FetchBookData(String googleBookId, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.GetMetadata(BookInfo item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
[07:10:55] [ERR] Error in Google Books
MediaBrowser.Model.Net.HttpException: Forbidden
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.EnsureSuccessStatusCode(HttpResponseMessage response, HttpRequestOptions options)
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsyncInternal(HttpRequestOptions options, HttpMethod httpMethod)
   at Emby.Server.Implementations.HttpClientManager.HttpClientManager.SendAsync(HttpRequestOptions options, HttpMethod httpMethod)
   at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.GetSearchResultsInternal(BookInfo item, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.FetchBookId(BookInfo item, CancellationToken cancellationToken)
   at Jellyfin.Plugin.Bookshelf.Providers.GoogleBooks.GoogleBooksProvider.GetMetadata(BookInfo item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
[...]
anthonylavado commented 4 years ago

A new version of the plugin will be auto built. Can you give version 2 a try and let me know if you still get any errors?

hauntingEcho commented 4 years ago

Thanks! It doesn't look like a release built though - https://github.com/jellyfin/jellyfin-plugin-bookshelf/releases

anthonylavado commented 4 years ago

@hauntingEcho Oh wow I totally spaced on that. Thanks for the note. Creating now. The auto builder should pick it up shortly.

anthonylavado commented 4 years ago

Grab it while it's hot! Should be in the catalog soon too. https://github.com/jellyfin/jellyfin-plugin-bookshelf/releases/tag/v2

hauntingEcho commented 4 years ago

Thanks! Updated, re-enabled, and rescanned. I'm not seeing this error in the log so far.