Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot search for movie, KeyError 'data' #490

Open
Kwieeciol opened this issue Nov 15, 2023 · 6 comments
Open

Cannot search for movie, KeyError 'data' #490

Kwieeciol opened this issue Nov 15, 2023 · 6 comments

Comments

@Kwieeciol
Copy link

Kwieeciol commented Nov 15, 2023

Issue description

Cannot search for movie with a title.

Version of Cinemagoer, Python and OS

cinemagoer==2023.5.1
Python 3.11.2
Windows 10

Steps to reproduce the issue

#!/usr/bin/env python
data = imdb.search_movie_advanced("The Gentlemen", results=5)

print(data)

What's the expected result?

Some sort of data output.

What's the actual result?

Error.

2023-11-15 21:35:02,150 ERROR [imdbpy.parser.http.domparser] E:\GITHUB\sithed-bot\.venv\Lib\site-packages\imdb\parser\http\utils.py:438: DOMHTMLSearchMovieAdvancedParser: caught exception postprocessing data
Traceback (most recent call last):
  File "E:\GITHUB\sithed-bot\.venv\Lib\site-packages\imdb\parser\http\utils.py", line 436, in parse
    data = self.postprocess_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\GITHUB\sithed-bot\.venv\Lib\site-packages\imdb\parser\http\searchMovieAdvancedParser.py", line 207, in postprocess_data      
    data['data'] = []
    ~~~~^^^^^^^^
TypeError: 'mappingproxy' object does not support item assignment
Traceback (most recent call last):
  File "E:\GITHUB\sithed-bot\movie_data.py", line 156, in <module>
    data = imdb.search_movie_advanced("The Gentlemen", results=5)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\GITHUB\sithed-bot\.venv\Lib\site-packages\imdb\__init__.py", line 485, in search_movie_advanced
    res = self._search_movie_advanced(title=title, adult=adult, results=results, sort=sort, sort_dir=sort_dir)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\GITHUB\sithed-bot\.venv\Lib\site-packages\imdb\parser\http\__init__.py", line 467, in _search_movie_advanced
    return self.smaProxy.search_movie_advanced_parser.parse(cont, results=results)['data']
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'

Additional details

@azmiozgen
Copy link

I have the exact error with,
cinemagoer==2023.5.1
Python 3.9.16
Ubuntu 22.04.3

Any update on this?

@Kwieeciol
Copy link
Author

Kwieeciol commented Nov 23, 2023

I have the exact error with,

cinemagoer==2023.5.1

Python 3.9.16

Ubuntu 22.04.3

Any update on this?

I just changed to TMDB, their API is free and mostly the same, and they even offer a partnership with JustWatch so you get the watch providers for each movie/show.

@azmiozgen
Copy link

I'd actually like to go with Cinemagoer. For now, I replaced search_movie_advanced function with search_movie and it's fine. I believe the error in search_movie_advanced is a temporary thing.

@uyar
Copy link
Collaborator

uyar commented Nov 26, 2023

I've implemented a very basic fix so that we should at least be able to get the link and the title of the search results.

@azmiozgen
Copy link

I've implemented a very basic fix so that we should at least be able to get the link and the title of the search results.

The error seems to have been fixed. But returned imdb.Movie.Movie instances after search, used to have more keys earlier. Keys like 'year' and 'kind' are not available with search_movie_advanced. Yet, those keys are returning with search_movie as expected.

@uyar
Copy link
Collaborator

uyar commented Nov 26, 2023

Yes, that's why I've called it "very basic" :) After fixing the episodes parser I didn't have much energy left for the search parser. Both pages are pretty difficult to work with. I'll get to the missing keys later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants