The code to fetch the episodes of a tv series through Cinemagoer (previously IMDbPY) is not working, even if I directly pick up an example code from the documentation.
This doesn't seem to work for any TV series. I have tried reinstalling various versions of IMDbPY, but each of them gives the same error.
None of the previous questions on StackOverflow help either as this seems to have been broken recently, as the same code was working in June 2023.
import imdb
ia = imdb.Cinemagoer() //instead of imdb.IMDb() earlier
code = "6468322"
series = ia.get_movie(code)
ia.update(series, 'episodes')
episodes = series['episodes']
print(series)
...
This throws the following error:
CRITICAL [imdbpy] C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\__init__.py:850: caught an exception retrieving or parsing "episodes" info set for mopID "6468322" (accessSystem: http)
Traceback (most recent call last):
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\__init__.py", line 848, in update
ret = method(mopID)
^^^^^^^^^^^^^
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\parser\http\__init__.py", line 667, in get_movie_episodes
data_d['data']['episodes'][season] = other_d['data']['episodes'][season]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 2
Traceback (most recent call last):
File "C:\Users\...\OneDrive\Desktop\Python shit\stupid.py", line 7, in <module>
ia.update(series, 'episodes')
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\__init__.py", line 848, in update
ret = method(mopID)
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\parser\http\__init__.py", line 667, in get_movie_episodes
data_d['data']['episodes'][season] = other_d['data']['episodes'][season]
KeyError: 2
or sometimes
Traceback (most recent call last):
File "C:\Users\...\OneDrive\Desktop\Python shit\stupid.py", line 8, in <module>
episodes = series['episodes']
File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\imdb\utils.py", line 1503, in __getitem__
rawData = self.data[key]
KeyError: 'episodes'
The KeyError seems to vary between 2 to 4 for some reason.