Try 30 days of free premium.

Show - Get Recent Episode

TheSpoilerGirl wrote 2 years ago: 1

Hi.

Is there a way in the API, given a specific showid , to get the latest episode entered for a show.

Basically what I want to do is to see when specific shows have new episodes added.

At the moment the only way I think I can do this is 

1) Get the Show ID

2) List through all the seasons and the get highest Season no.

3) Go through all the Episode for that Season and get the highest number.

It seems like a lot of unnessary processing if I can avoid it.

Something like Show->GetMaxSeason and Show->GetMaxEpisode that would return this for me.

Any help/advice/suggestions would be most welcome

TheSpoilerGirl wrote 2 years ago: 1

@david wrote:
If you want the latest aired episode, you can use the "_links.previousepisode" property in http://api.tvmaze.com/shows/253

If you want the latest listed episode, you could simply request http://api.tvmaze.com/shows/253/episodes and take the last element in the array. That only takes a single request and hardly any complicated processing, no?

Thanks David, yes, that would work great. I feel a bit silly now.

Appreciate you explaining it to me.

fredrikomfg wrote 2 years ago: 1

@david wrote:If you want the latest listed episode, you could simply request http://api.tvmaze.com/shows/253/episodes and take the last element in the array. That only takes a single request and hardly any complicated processing, no?

That requires that the episode API is always sorted in season/episode order. Is that always the case or could it be listed out of order?


david wrote 2 years ago: 2

@fredrikomfg wrote:
That requires that the episode API is always sorted in season/episode order. Is that always the case or could it be listed out of order?

They're always returned in order.

fredrikomfg wrote 2 years ago: 1

@david wrote:
They're always returned in order.

Great! :)

Try 30 days of free premium.