IMDB is a mess sometimes, but it's not always something that can be fixed.
I'll use Naked and Afraid as an example.
Discovery is streaming old episodes, but not in the original order.
As people capture those, they usually label them using the new order.
And if you go to the Wiki, they have them ordered by the original Airing date.
Which I'd prefer, but not everyone is going to go to that much trouble, including IMDB.
I don't see an answer to this type of conflict.
The next most common problem I see on IMDB is how the handle "Specials".
"When Calls the Heart" is a recent example I encountered.
Sometimes a season ends say in August, but they will have a Christmas or New Year special in December.
IMBD sometimes labels that as episode zero or episode 1 of the following season, or not at all.
Personally, I think it should be numbered as the last episode of the season that aired that year.
When IMDB fails to include it anywhere, users come up with there own schemes.
I've seen the specials numbered this way:
S00EXX Where XX is the season of the special. Sometimes the actual season, sometimes the following.
It's a mess and I don't see a solution other than what you've been doing, using IMDB as the guide for structure.
The one thing I don't understand, and it must be something in your/their software...
Why is the episode 0 such a problem if already exists in IMDB's structure?
Another thing I noticed was an episode folder/link was missing, even though it was in IMDB's structure.
I think it was ep 8. I can't remember the series. Would that have been some glitch unrelated to the episode 0 problem?
I've done some Basic programming, but have no idea how API's work.
I don't expect any quick fix, I don't envy your job here of keeping everything in order.
I just thought I'd add some of my observations.
If I can be of any assistance, just ask.
I'm very familiar with the problems of labeling episodes correctly.
Andor1999