0

I'm developing a bot that will grab information about a specific movie from IMDb with the IMDbPY API. The error I think I'm having is with the 'get_movie()' method in the IMDb() class.

As seen in my code, I have no problem with grabbing the movieID based off string input containing the movie name.

As soon as I pass in the movieID to the get_movie() method, and print the contents to the screen, I get a massive error.

ia = imdb.IMDb()

fd = open('movielist.txt',"w")
print("Input your movie please: \n")
inp = input()
fd.write(inp)
fd.close()

def Main():
        c = """Python Movie Rating Scraper by Nickydimebags"""
        print(c)
        time.sleep(2)
        f1 = open('movielist.txt')
        movie_list = []
        for i in f1.readlines():
                movie_list.append(i)
                movie_list = ia.search_movie(i)
                movie_id = movie_list[0].movieID
                print(movie_id)
                m = ia.get_movie(movie_id)
                print(m)

Main()

I expect the output to contain information about the film, such as Title, Rating, Director, etc. It looks like the main error message is:

DOMHTMLMovieParser: caught exception extracting XPath "//b[text()='Series Crew']"
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/xml/etree/ElementPath.py", line 272, in iterfind
selector = _cache[cache_key]
KeyError: (".//b[text()='Series Crew']", None)

There are tons of other exceptions that show up that I'm not posting because of size constraints. But at the end of the errors I get this prompt:

Message: '%s: unable to gather refs: %s'
Arguments: ('DOMHTMLPlotParser',)

-I'm really not sure what any of this means. I've upgraded IMDbPY. If anyone has dealt with something familiar involving the IMDbPY, please let me know! Thanks

nick_rinaldi
  • 641
  • 6
  • 17
  • seems to be a bug in the library. Please identify a movieID that causes the bug and open an issue on https://github.com/alberanid/imdbpy/issues (disclaimer: I'm one of the authors of IMDbPY) – Davide Alberani Sep 09 '19 at 12:59
  • Doesn't seem to be one specific movieID, but any movie ID. Are there any other libraries you'd recommend that connect to IMDb? – nick_rinaldi Sep 09 '19 at 16:29
  • consider that beside a test on some actor biography, all the tests on the repository version of IMDbPY passed, so I doubt that every movieID is broken. Anyway, there are many alternatives https://pypi.org/search/?q=imdb – Davide Alberani Sep 10 '19 at 06:51

0 Answers0