I have a sort of whiteboard style question about efficiently querying The Movie DB API to find a list of characters in movies.
My overall aim is to:
- Search for a movie by title (1 request)
- Look up all the characters played in that movie (1 request)
- Look up which movies that character has been in, played by the same actor (1 request/movie)
- Repeat with that list of movies via step 2, and filter down to only characters in the original movie, until no unexplored characters remain.
My issue is that the DB call for step 3 only brings back the films those actors are in, as opposed to characters (in fact you can only search by actor id, not character id). This means that, for instance, step 3 for the ~23 actors returned in step 2 for the lord of the rings, it then returns 844 movies each one needing a request to find the characters in that movie. The problem is that most of these are going to be false positives.
Is there a more efficient way to query the API? I've considered combining pairs of actor IDs to narrow it down, but I don't think that would narrow down the movies returned by enough.
How can I efficiently make this query?