adamayoung / TMDb

The Movie Database Swift Package
https://adamayoung.github.io/TMDb/documentation/tmdb
Apache License 2.0
109 stars 28 forks source link

Invalid url for tvEpisodeService.images #124

Closed dcamenisch closed 10 months ago

dcamenisch commented 10 months ago

Executing the following code

let images = try await tmdb.tvShowEpisodes.images(forEpisode: 43, inSeason: 1, inTVShow: 37854)

results in the following value for images: TVShowEpisodeImageCollection(id: 1153014, stills: []). However, the correct result (as tested on https://developer.themoviedb.org/reference/tv-episode-images) should be:

{
  "id": 1153014,
  "stills": [
    {
      "aspect_ratio": 1.778,
      "height": 720,
      "iso_639_1": null,
      "file_path": "/bYgszCXq8oBIWCmq2kUg0xx3ob6.jpg",
      "vote_average": 5.312,
      "vote_count": 1,
      "width": 1280
    },
    {
      "aspect_ratio": 1.333,
      "height": 300,
      "iso_639_1": null,
      "file_path": "/hsNpOdjCr9OEDttxbzbMwvkCtcw.jpg",
      "vote_average": 5.172,
      "vote_count": 1,
      "width": 400
    },
    {
      "aspect_ratio": 1.778,
      "height": 675,
      "iso_639_1": null,
      "file_path": "/13v7WFhcpNxLvefU3eicgFrjVb2.jpg",
      "vote_average": 0,
      "vote_count": 0,
      "width": 1200
    }
  ]
}

I used the latest release version of the package (9.0.0).

dcamenisch commented 10 months ago

I also tried this with the newest version (HEAD of main branch) and the result is the same.

let images = try await tvEpisodeService.images(forEpisode: 43, inSeason: 1, inTVSeries: 37854).stills
print(images) // prints: []
dcamenisch commented 10 months ago

The problem seems to be that the final URL looks like this:

https://api.themoviedb.org/3/tv/1429/season/1/episode/18/images?api_key=***&language=en

But it should look like:

https://api.themoviedb.org/3/tv/1429/season/1/episode/18/images?api_key=***

A possible solution would be to change language=en to language=en%2Cnull (or language=%2Cnull). This should only have an influence on images and video since only there the language can be null.

adamayoung commented 10 months ago

Thanks @dcamenisch 🙏🏻