How do I search for a specific Movie or TV Show?

Post here any issues with the API or feature requests
Post Reply
Prometheus
Posts: 2
Joined: Thu Jul 18, 2019 5:25 am

How do I search for a specific Movie or TV Show?

Post by Prometheus »

Given the following URL, it is easy do find the relevant imaging data for a show listed on Fanart:

Code: Select all

http://webservice.fanart.tv/v3/tv/ZZZ_FANARTID_ZZZ?api_key=XXX_APIKEY_XXX&client_key=YYY_CLIENTKEY_YYY
This only works if I know what the Fanart ID is for a show.

My question is simple enough. Given known data IDs from themoviedb.org or thetvdb.com, or even just a show name, is there a way using the API to search for a set of results from which a particular FanArt show ID can be chosen?

In this case, my known data is as follows:
  • Series Name = "The Good Wife"
  • MovieDB ID = 1435
  • TheTVDB ID = 76761
Using one or all of the known criteria, how can I find the correct Fanart.tv ID?
Do you hear, huh? The Alpha and The Omega? Death and Rebirth? And as you die, so shall I be Reborn...
Prometheus
Posts: 2
Joined: Thu Jul 18, 2019 5:25 am

Re: How do I search for a specific Movie or TV Show?

Post by Prometheus »

A lack of response from other forum members prompted me to find an alternate solution, and what I found for myself is simple, to say the least.

If you have an API key for themoviedb.org, then you can use one of the following to acquire the information you need:

Code: Select all

https://api.themoviedb.org/3/tv/MOVIEDB_SHOW_ID/external_ids?api_key=MOVIEDB_API_KEY

Code: Select all

https://api.themoviedb.org/3/tv/MOVIEDB_SHOW_ID?api_key=MOVIEDB_API_KEY&append_to_response=external_ids
In either case, when you have access to the External IDs as listed by themoviedb.org, then all you need to do is parse the JSON results for the "tvdb_id" value. You can use this value safely for accessing Fanart.tv data:

Code: Select all

https://webservice.fanart.tv/v3/tv/TVDB_ID?api_key=FANART_TV_API_KEY
This seems to be working so far without the need for a Fanart.tv API Client Key, but that can also be added if needed...
Do you hear, huh? The Alpha and The Omega? Death and Rebirth? And as you die, so shall I be Reborn...
Schnappi
Posts: 1
Joined: Sat Dec 07, 2019 9:21 pm

Re: How do I search for a specific Movie or TV Show?

Post by Schnappi »

What I do is I first query TheMovieDB with a search like for a movie with year=2009 (in your case TV with first_air_date_year=2009):

Code: Select all

https://api.themoviedb.org/3/search/movie?api_key=[your_theMovieDB_api_key]&include_adult=false&query=Avatar&year=2009

Code: Select all

https://api.themoviedb.org/3/search/tv?api_key=1682fe428e733649f0cdf87993ef1c44&include_adult=false&query=The+good+wife&first_air_date_year=2009
Then parse that result to get among other things the [theMovieDB_id]
This can give you more than 1 result if you don't have the year for instance. You need to find a way to determine the result you need.
Then you can pass that to the Fanart.tv url like

Code: Select all

http://webservice.fanart.tv/v3/movies/19995?api_key=[your_FanartTv_api_key]
This at least works for movies
Post Reply