pythonjsonapirequestimdb

How to get more than 10 search results from the IMDB API?


I am trying to suggest movies to an user who has entered a movie genre, e.g. "horror", "sci-fi", etc. For this, I have written a function that makes an API call towards the IMDB API:

import requests
def search_movies(search, api_key):
    movies = []
    url = "https://imdb-api.com/API/SearchMovie/"+api_key+"/"+search
    response = requests.get(url)
    data = response.json()
    results = data['results']
    for result in results:
        movies.append(result['title'])
    return(movies)

The API only returns 10 search results, which is not enough for what I am trying to achieve. Is there a way to increase this number? I was unable to find any parameters for this on Swagger, and pagination also doesn't seem to be an option, as the request is not made via URL parameters.


Solution

  • I don't think you can get more results from that unofficial web service. I believe it is better to use the official IMDb API as stated on the official website.

    From the IMDb developer website:

    Get the latest IMDb data on-demand through our new GraphQL-backed API. Available exclusively via AWS Data Exchange