Podcastindex-org / docs-api

Developer documentation for the podcastindex.org api.
https://podcastindex-org.github.io/docs-api/
MIT License
52 stars 29 forks source link

Podcasts By Feed ID endpoint /podcasts/byfeedid multiple IDs returning unexpected results? #119

Open prickle opened 4 months ago

prickle commented 4 months ago

I want to get each of the the latest episodes for a list of podcast IDs. I was doing it through repeated API calls but this is slow and painful. I thought I might try the multiple IDs feature but it won't cooperate.

If I send: https://api.podcastindex.org/api/1.0/episodes/byfeedid?id=41504,920666,318135,204504&max=4 then item 1 will be from 204504, item 2 from 318135, item 3 from 204504 and item 4 will be from ID 204504 again.

I would like one of each episode from each podcast ID in the list. However, I may get two or more episodes of one podcast and none of another.

Is this expected behavior? Am I doing it wrong?

Thanks!

stevencrader commented 4 months ago

I'm not sure how it should work, but I found that if you remove the max parameter, I get at least one episode for every feed id requested.

https://api.podcastindex.org/api/1.0/episodes/byfeedid?id=41504,920666,318135,204504

prickle commented 4 months ago

Hi Steven. That's good, but unfortunately it doesn't really help me. My intent was to reduce the amount of traffic while increasing the response time on a very resource limited system.

Since I am developing this podcast app on an esp32 microcontroller with a free heap measured in kilobytes, parsing such a large response would probably require ugly things and likely bog down a bit too much.

I initially expected &max=1 would return one episode per podcast ID. Of course, I only got one ID total. I cannot imagine how this would be helpful to anybody how it is.

Applying 'max' on a per-ID basis seems correct to me, but I'm not sure how that might affect existing software and libraries. Can you tell if the multiple IDs feature gets used much?

Thanks, Nick

stevencrader commented 4 months ago

I don't have access to the API source to see what is going on and how the max is supposed to be used. Additionally, I don't know what the use of this feature is. For both of these, @daveajones will have to answer.

prickle commented 4 months ago

Ok, thanks Steven.

daveajones commented 4 months ago

Are you trying to scrape the entire Index through the API? That's not allowed. If you are trying to get data (of any sort) about every show in the Index you need to use our downloadable database as the starting point and extend your code from there.

If I'm misunderstanding your aim let me know.

prickle commented 4 months ago

Hi Dave, great to hear from you. No, that is most certainly not my intention. I probably could not fit more than one hundred episodes in total at any one time on my hardware. It is a very resource-limited environment. I don't understand how you arrived at that concern? Is what I attempted that far off the mark?

So, I am developing a podcast client on a low power microcontroller based system to be used like an appliance. It is very small and simple. It is barely able to cooperate with encrypted connections, modern web services and large-bandwidth data, but it does.

In order to improve the user experience of this client I am looking for ways to make things faster and less resource-intensive. The multiple IDs query function of this API will be one of those ways, if I can get it to work.

What I would like to do is get only the most recent episodes for a small number (like 20 or so) of podcast IDs.

I am already doing this using one api call per ID but I expect it would be faster and more efficient to use the multiple IDs function of the API. However, I am not getting the results I expect, as described previously.

How may I retrieve a list of episodes, one per podcast ID, for a list of multiple podcast IDs? I have already described what I would like and my attempts and failures.

If you need any more information I am happy to supply it.

Thanks so much for your help. Nick

daveajones commented 3 months ago

Thanks for the explanation Nick. Let me look at it and see what’s going on.

prickle commented 3 months ago

Hi Dave. Have you had any time to look at this? Not urgent, just keeping it alive. Thanks!

daveajones commented 3 months ago

Yes. I've diagnosed the issue. It's a bigger fix than I'd hoped it would be. Thanks for the bump. Hoping to get it corrected within the next couple of weeks.

prickle commented 3 months ago

Thanks Dave, good luck.

daveajones commented 2 months ago

The underlying issue with max handling is now resolved. I'm not sure it exactly fixes your issue though, since max covers the entire set which is ordered by publish date. I think you're going to need a different endpoint or a different mode for this endpoint which would tell it to give you max per podcast instead of max overall.

I can see the usefulness of what you want. Let me work to add that functionality now that the bug is corrected.

SteveCutler commented 3 days ago

I would also find this feature useful!