Try 30 days of free premium.

Get episodes by date - not in order

lycanthrope7 wrote 6 years ago: 1

Hi guys,

I recently started playing with the API and I gotta say I'm loving it so far. I did come across one glitch though...

When getting episodes by date for the show Black Mirror, the eps for season 3 all aired on the same date, however the API doesn't return them in the correct order. The URL I used is http://api.tvmaze.com/shows/305/episodesbydate?date=2016-10-21 and the eps are returned in the order 4, 3, 1, 5, 6, 2. I've checked a few other shows with eps airing on the same date and they all return them in order, it's just this one show as far as I can tell. Is this something that can be fixed?

tnt wrote 6 years ago: 1

Apparently within the same date episodes are sorted by ID, i.e. in the order they was created.

lycanthrope7 wrote 6 years ago: 1

david wrote:
Indeed the episode order in the episodesbydate endpoint is currently undefined. It was designed for shows like daily talkshows, where more than one episode on the same date is possible though unlikely. Using it for "dumped" Netflix shows is interesting - though what's your usecase that this is more convenient than http://api.tvmaze.com/shows/305/episodes or http://api.tvmaze.com/seasons/44472/episodes?

Hi David,

I have a Filemaker Pro database that I use to track all the shows I watch (and download, but don't tell anyone). I use to manually add new episodes in, but now I use the API to retrieve them automatically. I usually add episodes on the day they air so, 99% of the time, I'm only grabbing one episode per show on any given date. It's only in cases where all the episodes are released at the same time, such as web channels like Netflix and Hulu, that I'd need to grab more than one episode per show. I still only want the episodes airing on that date though, not a whole season, or an entire episode list.

As I mentioned, that was the only show I found where the episodes weren't entered in the correct order, so I'm hoping this won't be a common issue, I just thought I'd point it out in case it was a mistake or something.

tnt wrote 6 years ago: 1

lycanthrope7 wrote:
Hi David,

I have a Filemaker Pro database that I use to track all the shows I watch (and download, but don't tell anyone). I use to manually add new episodes in, but now I use the API to retrieve them automatically. I usually add episodes on the day they air so, 99% of the time, I'm only grabbing one episode per show on any given date. It's only in cases where all the episodes are released at the same time, such as web channels like Netflix and Hulu, that I'd need to grab more than one episode per show. I still only want the episodes airing on that date though, not a whole season, or an entire episode list.

As I mentioned, that was the only show I found where the episodes weren't entered in the correct order, so I'm hoping this won't be a common issue, I just thought I'd point it out in case it was a mistake or something.

It seems that in your case the order of episodes is actually of no importance, since they all being released on the same day and you will be downloading all of them, one way or another :)

lycanthrope7 wrote 6 years ago: 1

tnt wrote:
It seems that in your case the order of episodes is actually of no importance, since they all being released on the same day and you will be downloading all of them, one way or another :)

True, I've modified my database to sort the episodes in the correct order, regardless of the order in which they were created. I appreciate your input and you've helped me gain a deeper understanding of how the API works. Thank you.


david wrote 6 years ago: 1

lycanthrope7 wrote:
I usually add episodes on the day they air so, 99% of the time, I'm only grabbing one episode per show on any given date. It's only in cases where all the episodes are released at the same time, such as web channels like Netflix and Hulu, that I'd need to grab more than one episode per show. I still only want the episodes airing on that date though, not a whole season, or an entire episode list.

Interesting usecase :) I think we can safely update this endpoint to return a sorted list of episodes. Will look into that!

lycanthrope7 wrote 6 years ago: 1

david wrote:
Interesting usecase :) I think we can safely update this endpoint to return a sorted list of episodes. Will look into that!

Thanks David. You guys are doing a fantastic job. I love the site and I'm really enjoying the benefits of my premium membership. Keep up the good work.


david wrote 6 years ago: 1

Thanks, that's great to hear!

The endpoint is now sorted by episode number. :)

Try 30 days of free premium.