I'd like to make a kind of homemade algorithm, which from a list of all the movies I have, will return accurate suggestions of movies I haven't seen and I could like. But for that I need to know if IMDBpy can return the "suggestions" part.
Indeed, when you search for a movie on the web site, you are given a list of movies matching the kind a movie you searched for.
But I can't find an answer on the doc of IMDBpy. Is there a way to get the suggestions with it ?
Since get_movie_recommendations doesn't really work as you wish (e.g. it doesn't return anything for 12 Years a Slave), you could scrape the recommendations with BeautifulSoup.
import bs4
import imdb
import requests
src = requests.get('http://www.imdb.com/title/tt2024544/').text
bs = bs4.BeautifulSoup(src)
recs = [rec['data-tconst'][2:] for rec in bs.findAll('div', 'rec_item')]
print recs
This prints:
['1535109', '0790636', '1853728', '0119217', '2334649', '0095953', '1935179', '2370248', '1817273', '1210166', '0169547', '1907668']
After that you can search for those movies with IMDBpy...
ia = imdb.IMDb()
for rec in recs:
movie = ia.get_movie(rec)
print movie.movieID, movie.get('title')
... which outputs:
1535109 Captain Phillips
0790636 Dallas Buyers Club
1853728 Django Unchained
0119217 Good Will Hunting
2334649 Fruitvale Station
0095953 Rain Man
1935179 Mud
2370248 Short Term 12
1817273 The Place Beyond the Pines
1210166 Moneyball
0169547 American Beauty
1907668 Flight
Link!
There's a line in here:
def get_movie_recommendations(self, movieID):
Maybe this can lead you in the right direction.