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` accepts non-numeric ids #111

Open ericpp opened 10 months ago

ericpp commented 10 months ago

The Podcasts By Feed ID endpoint seems to accept whatever id you throw at it as long as it has a number in it somewhere

For instance: https://api.podcastindex.org/api/1.0/podcasts/byfeedid?id=value4value

Returns results for id=4:

{
  "status": "true",
  "query": {
    "id": "4"
  },
  "feed": {
    "id": 4,
    "podcastGuid": "7fba92fb-42eb-56da-b562-cef9d2cf2546",
    "medium": "podcast",
    "title": "IdiotSpeakShow",
    "url": "https://feeds.soundcloud.com/users/soundcloud:users:150466516/sounds.rss",
    "originalUrl": "http://feeds.soundcloud.com/users/soundcloud:users:150466516/sounds.rss",
    "link": "https://soundcloud.com/idiotspeakshow",
    "description": "Podcast by IdiotSpeakShow",
    "author": "IdiotSpeakShow",
    "ownerName": "IdiotSpeakShow",
    "image": "https://i1.sndcdn.com/avatars-000143391344-h7vuir-original.png",
    "artwork": "https://i1.sndcdn.com/avatars-000143391344-h7vuir-original.png",
    "lastUpdateTime": 1684301388,
    "lastCrawlTime": 1694229180,
    "lastParseTime": 1694229187,
    "lastGoodHttpStatusTime": 1694229180,
    "lastHttpStatus": 200,
    "contentType": "application/rss+xml; charset=utf-8",
    "itunesId": 1000035657,
    "itunesType": "episodic",
    "generator": "",
    "language": "en",
    "explicit": false,
    "type": 0,
    "dead": 0,
    "chash": "3414348449422fc0970d059cc680d0ab",
    "episodeCount": 2,
    "crawlErrors": 0,
    "parseErrors": 0,
    "categories": null,
    "locked": 0,
    "imageUrlHash": 794829127
  },
  "description": "Found matching feeds."
}
daveajones commented 10 months ago

That’s right. I use an alpha filter to just suck the numbers out of the input. Do you think it should be an error instead?

stevencrader commented 10 months ago

I think it should be rejected. What it does now is undefined behavior. I'm a fan of strong type enforcement.

ericpp commented 10 months ago

It seemed a little strange that the API returned a result for value4value. I would've expected it to either return no results or complain that id isn't an integer.

daveajones commented 10 months ago

I can change it. I remember now why I did that. It’s because Apple’s api accepts feed id’s as “id123456789” and strips the “id” part off so I was mimicking that behavior. It’s not necessary.