3

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.

3 Answers3

1

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

Andreas
  • 127
  • 8
  • Am I wrong or does the actual AWS IMDB API cost +$50,000? I just can't wrap my head around how to understand the AWS pricing quotes. – Cory Feb 19 '23 at 15:09
1

You can use AdvancedSearch, which returns up to 250 items. https://imdb-api.com/api#AdvancedSearch-header

Sample:

https://imdb-api.com/API/AdvancedSearch/{API_KEY}?title={TITLE_FOR_SEARCH}&count=250
https://imdb-api.com/API/AdvancedSearch/{API_KEY}?title={TITLE_FOR_SEARCH}&title_type=tv_series&genres=action,adventure&count=250
Haddad
  • 301
  • 3
  • 5
0

You should try features of PyMovieDb, It is a free python module for IMDB

itsmehemant7
  • 339
  • 1
  • 8