Ran that call in a browser and it returns this:
{“errors”:[“Limit of maximum 20000 requests per hour exceeded.”]}
So clearly that’s the issue. Does anyone know what’s causing it to hit this limit? Looking at the logs, it can’t be my library making that many requests per hour. Is this a global limit on plex’s calls to the api? Any way around this? Cinematerial is a great resource, especially for more obscure titles.
On a side note, it would be great to pull posters from IMDB as well, but I assume it’s not possible or it would already be happening - it’s a pretty obvious source for posters.
The limit can be reached depending on a few factors:
How many calls the Agent does
This is obviously something you barely have any influence on. Speaking from my own experience it can be that you need to do multiple API calls to get all the information you need/want to generate a complete picture. For example, one for the general Information of the media item, one for a list of episodes that might even have a limit and one for configuration purposes (like themoviedb has)
Which endpoints are included in said limit
Depending on how sophisticated the API is, it could exclude some endpoints that do not count to the limit like some things that change frequently. Maybe an API could also only count not cached items. How that is might be documented in the API documentation which you might not get your hands on that easily.
How often metadata is refreshed
This is, of course, the most likely situation reaching an API limit, the more often you or plex refreshes the metadata the more requests are being made and could lead you hitting the limit sooner than later. So for example, if you just have 100 items in your library but each time 20 requests are being made (or counted) then you are already at 2000 requests.
How the Agent is configured
Each agent can specify how long a request is being held in the plex cache before it being requested new. If that is too low and you refresh your metadata say every half an hour or so then the Agent will always try to get fresh metadata instead of using the cache. Another thing could be that there is a general “api-key” used for that Agent instead of your own which could lead to many other people using the same API-key and doing requests on them which are all counted. I actually had this problem with the youtube metadata agent which also uses a default API key and I constantly hit the limit but after using my own the whole issue went away.
If I see that correctly, the Agent does use a pre-defined “secret” which could be the indicator that it could be used by other people as well.
After I few days of experimenting, I’ve found a couple things.
The 20,000 requests per hour limit does get reset at the top of each hour, so calls to the API do work in the browser for awhile at the top of each hour. Here’s a typical response:
However, when the API is accepting requests, Plex seems to be erroring instead of properly parsing the result. Here’s the error in the movieposterdb.log - full log here: com.plexapp.agents.movieposterdb.log (10.0 KB) : 2020-04-04 16:11:31,854 (f24) : DEBUG (networking:143) - Requesting 'https://api.cinematerial.com/1/request.json?imdb_id=tt0087100&key=plex&secret=raKlq2A.lN1K.&width=720&thumb_width=100.' 2020-04-04 16:11:31,882 (23a8) : DEBUG (services:362) - Loaded services 2020-04-04 16:11:31,894 (2fa4) : DEBUG (services:438) - No shared code to load 2020-04-04 16:11:33,976 (f24) : INFO (logkit:16) - Adding matching language poster for language: US 2020-04-04 16:11:33,977 (f24) : CRITICAL (core:574) - Exception in the update function of agent named 'CineMaterial', called with guid 'com.plexapp.agents.imdb://tt0087100?lang=en' (most recent call last): File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-513b381af\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1089, in _update agent.update(obj, media, lang, **kwargs) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-513b381af\MoviePosterDB.bundle\Contents\Code\__init__.py", line 42, in update valid_names.append(self.add_poster(metadata, secret, poster, i)) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-513b381af\MoviePosterDB.bundle\Contents\Code\__init__.py", line 55, in add_poster thumb_url = poster['thumbnail_location'] File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-513b381af\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\code\sandbox.py", line 108, in <lambda> _getitem_ = lambda x, y: x.__getitem__(y), KeyError: 'thumbnail_location'
Anybody got any ideas what might be causing this? I tried deleting the movieposterdb cache, didn’t help.