Try 30 days of free premium.

Cast order through API

zavoil123 wrote 4 years ago: 1

Currently, the API and the website show different cast orders.

For example:

https://api.tvmaze.com/shows/712/cast

First cast member is Henry Cavill, while on the website:

https://www.tvmaze.com/shows/712/the-tudors

he is listed second.

I've found that this discrepancy to be rule rather than the exception - if the website and the API happen to give the same cast order - it's more of a coincidence.

Can you please sort the cast members in the API the same way they're sorted on the website (by number of appearances)? Or maybe include the number of appearances in the data returned by the API so we can sort them ourselves?

 

 


david wrote 4 years ago: 1

Both the website and API return the cast entries sorted by their number of appearances.

What you are seeing occurs when multiple cast members have an identical number of appearances. At https://www.tvmaze.com/shows/712/the-tudors/characters you can see that the first two entries both have 38 appearances. This currently means the ordering between them is undefined, both on the website and API, and can indeed even differ between them (due to different caching layers).

zavoil123 wrote 4 years ago: 1

Thanks for your reply!

Ok I see.

Maybe it'll make sense to sort them by number of appearances first, then tvmaze_id second, if appearances are equal?

That way the "main" / more prominent actor for this series will get better billing as most likely they were entered first?

For all the cases I checked (where there are discrepancies between the website and the API) - when sorting by tvmaze_id - the casting order is perfect.

 


david wrote 4 years ago: 1

I'll definitely consider making the sorting based on TVmaze ID, to make the sorting more deterministic. Whether that makes it any "better" or "worse" is probably completely subjective and arbitraty though.

Tonks wrote 4 years ago: 1

David, how about alphabetical order ? That's less arbitrary and will sometime, if not often, coincide with the on screen credits.


david wrote 4 years ago: 1

I meant to have the sorting primarily based on the number of appearances, sorting only by ID when the number of appearances is equal. I don't want to change the sorting from number of appearances to alphabetical.

Tonks wrote 4 years ago: 1

Well, my bad and pity.


david wrote 4 years ago: 1

This is done, although you'll still see cached versions for the forseeable future.

Try 30 days of free premium.