The Movie Database Support

We are just testing the new TMDB TVShow scraper for Kodi (that will be default in the next version of Kodi) and coming up against 429 rate limit errors.

More info here: https://forum.kodi.tv/showthread.php?tid=200504&page=11

Testing shows like "The Walking Dead" which have 132 episodes in the series and Kodi is clearly going to hit the API limits.

So my question is, can the rate limits be expanded now TMDB supports TVShows? It seems they are a little restrictive for TVShow API calls. Or is the Kodi scraper just not doing it as efficiently as it should perhaps?

8 replies (on page 1 of 1)

Jump to last post

Hey @zag2me,

Do you know what calls are being made? Specifically, if individual episodes are being called, or is it a season call?

https://api.themoviedb.org/3/tv/1402/season/1?api_key=###

Will return an episodes array containing all of the episodes of the season for example. So they should be able to get away with only calling a single HTTP call for all of the episodes per season. But I am not sure on which calls are being made or how they are structured in the Kodi scraper.

Yeh looks like the current scraper is using the episode lookup:

12:39:13.940 T:4152  NOTICE: VideoInfoScanner: Starting scan ..
12:39:33.087 T:4152   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 429
12:39:33.087 T:4152   ERROR: CCurlFile::Open failed with code 429 for http://api.themoviedb.org/3/tv/1402/season/5/episode/10? 
12:39:33.087 T:4152   ERROR: ADDON::CScraper::Run: Unable to parse web site
12:39:33.095 T:4152  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:19
12:39:47.352 T:4152  NOTICE: VideoInfoScanner: Starting scan ..
12:39:55.430 T:4152   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 429
12:39:55.430 T:4152   ERROR: CCurlFile::Open failed with code 429 for http://api.themoviedb.org/3/tv/1402/season/7/episode/6?:
12:39:55.430 T:4152   ERROR: ADDON::CScraper::Run: Unable to parse web site
12:39:55.430 T:4152 WARNING: No information found for item 'C:\Users\00918203\Videos\Serie TV\The Walking Dead (2010)\', it won't be added to the library.
12:39:55.438 T:4152  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:08
12:39:59.111 T:4152  NOTICE: VideoInfoScanner: Starting scan ..
12:40:07.556 T:4152   ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 429

I'll see if we can get the scraper updated to what you suggest.

Thanks! the Kodi scraper has now been updated to use the series API call. Works well.

I can't help but think the API rate limit is still very low though. If we scrape in say 100 series with an average of 3 seasons (for example) that's at least 300 requests which is going to be very slowed down if only 40 are allowed each 10 seconds.

Was the API limit designed in a time when TMDB supported TVShows? Does the API rate limit reset when we move onto the next TVShow?

The rate limits were added after TV was added, yes. I've never really heard from anyone about this too much. There's lots of ways to do multiple requests in one by using append_to_response.

There's some basics like so:

https://api.themoviedb.org/3/tv/1402?api_key=###&append_to_response=images,videos
https://api.themoviedb.org/3/tv/1402/season/1?api_key=###&append_to_response=images,videos

But if you know that a season exists, you can even do this (get season 1 and 2 in a single call):

https://api.themoviedb.org/3/tv/1402?api_key=###&append_to_response=season/1,season/2

So it kind of all just depends on the specific use case and need.

Thanks for that, I think it doesn't help the Kodi so much as it would add quite a lot of complexity to the scraper.

See here for more : https://forum.kodi.tv/showthread.php?tid=200504&pid=2794769#pid2794769

I think we also lost multi episode thumbs compared to the TheTVDB scraper, but that's not a massive loss.

I think we also lost multi episode thumbs

Perhaps there's a tweak that Kodi could make in the future for a way to view all of the images of a particular episode? This would make a call to the detailed episode method with images (instead of what I would assume it does today, and reads the cached data?) I'm just looking at Karellen's example where they weren't happy with the highest rated image of a particular episode.

I have sometimes problem with this scraper, exception raised, but no info about it, another error, see

2020-11-17 10:46:22.689 T:5614   ERROR: [metadata.tvshows.themoviedb.org.python (1.1.18)]: *** Unhandled exception detected: <type 'exceptions.AttributeError'> 'NoneType' object has no attribute 'lower' ***
2020-11-17 10:46:22.689 T:5614   ERROR: [metadata.tvshows.themoviedb.org.python (1.1.18)]: *** Start diagnostic info ***
2020-11-17 10:46:22.718 T:5614   ERROR: [metadata.tvshows.themoviedb.org.python (1.1.18)]: System info: ('Linux', 'localhost', '4.19.87-19891288', '#1 SMP PREEMPT Fri Oct 16 09:31:49 KST 2020', 'aarch64', '')
2020-11-17 10:46:22.730 T:5614   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeDecodeError'>
                                            Error Contents: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.tvshows.themoviedb.org.python/main.py", line 32, in <module>
                                                router(sys.argv[2][1:])
                                              File "/home/jenkins/workspace/Android-ARM64-Leia/tools/depends/xbmc-depends/aarch64-linux-android-21-release/lib/python2.7/contextlib.py", line 35, in __exit__
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/metadata.tvshows.themoviedb.org.python/libs/debugger.py", line 96, in debug_exception
                                                logger_func('OS info: {0}'.format(xbmc.getInfoLabel('System.OSVersionInfo')))
                                            UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128)
                                            -->End of Python script error report<--

Hi @Marek71cz, looks like that scraper is tripping over some unicode. I would suggest heading over to the Kodi forums and post more details there. I don't maintain the scraper so I am not really able to help much.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login