c-eg / themoviedbapi

A Java wrapper around the JSON API provided by TheMovieDB.org
https://www.themoviedb.org/
Other
283 stars 95 forks source link

bug in TmdbTrending.java when calling getTrending() #211

Closed malaccan closed 7 months ago

malaccan commented 7 months ago

i found an issue with the query generation that is inconsistent with the actual api. this is regarding getting trending tv series or movies, and occurs inside TmdbTrending.java. i am using themoviedbapi version 2.0.2:

TmdbTvSeries tmdbTVSeries = tmdbApi.getTvSeries();
tmdbApi.getTrending().getTv(TimeWindow.WEEK, "en-US");

this throws an error:

TmdbResponseException(responseCode=TmdbResponseCode.RESOURCE_NOT_FOUND(tmdbCode=34, httpStatus=404, success=false, message=The resource you requested could not be found.)) at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:154) at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:110) at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:83) at info.movito.themoviedbapi.AbstractTmdbApi.mapJsonResult(AbstractTmdbApi.java:58)

the generated query is: https://api.themoviedb.org/3/trending/tv?time_window=week&language=en-US

checking the TMdB specifications at https://developer.themoviedb.org/reference/trending-tv the correct query should be: https://api.themoviedb.org/3/trending/tv/week?language=en-US

to fix this, the day or week syntax should be part of url path, rather than a parameter.

c-eg commented 7 months ago

Hi, thanks for reporting this. I'll try to get a fix & new release out this evening.

c-eg commented 7 months ago

Version 2.0.3 has been released, please use this and the problem should be fixed :)

malaccan commented 5 months ago

thanks!