(I made a major edit as the C# code snippets were not helping but masked the issue - hopefully it is clearer now)
I am trying to get listing of podcasts by genre from iTunes and using the API as described in https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html the best I can.
I have no difficulties in searcing for a name and parsing / using the response in JSON e.g.the search
https://itunes.apple.com/search?term=Design&media=podcast&entity=podcast&limit=1
gives
{
"resultCount":1,
"results": [{"wrapperType":"track", "kind":"podcast", "artistId":127446766,"collectionId":73330703, "trackId":73330703, "artistName":"Frances Anderton", "collectionName":"KCRW's DnA: Design & Architecture", "trackName":"KCRW's DnA: Design & Architecture", "collectionCensoredName":"KCRW's DnA: Design & Architecture", "trackCensoredName":"KCRW's DnA: Design & Architecture", "artistViewUrl":"https://itunes.apple.com/us/artist/kcrw/id127446766?mt=2&uo=4", "collectionViewUrl":"https://itunes.apple.com/us/podcast/kcrws-dna-design-architecture/id73330703?mt=2&uo=4", "feedUrl":"http://feeds.kcrw.com/kcrw/de", "trackViewUrl":"https://itunes.apple.com/us/podcast/kcrws-dna-design-architecture/id73330703?mt=2&uo=4", "artworkUrl30":"http://a2.mzstatic.com/us/r30/Podcasts/v4/42/ef/6a/42ef6a04-7873-e82d-716d-ae3f1c6ebca8/mza_1492532737245560899.30x30-50.jpg", "artworkUrl60":"http://a4.mzstatic.com/us/r30/Podcasts/v4/42/ef/6a/42ef6a04-7873-e82d-716d-ae3f1c6ebca8/mza_1492532737245560899.60x60-50.jpg", "artworkUrl100":"http://a2.mzstatic.com/us/r30/Podcasts/v4/42/ef/6a/42ef6a04-7873-e82d-716d-ae3f1c6ebca8/mza_1492532737245560899.100x100-75.jpg", "collectionPrice":0.00, "trackPrice":0.00, "trackRentalPrice":0, "collectionHdPrice":0, "trackHdPrice":0, "trackHdRentalPrice":0, "releaseDate":"2014-12-30T08:00:00Z", "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "trackCount":25, "country":"USA", "currency":"USD", "primaryGenreName":"Design", "radioStationUrl":"https://itunes.apple.com/station/idra.73330703", "artworkUrl600":"http://a3.mzstatic.com/us/r30/Podcasts/v4/42/ef/6a/42ef6a04-7873-e82d-716d-ae3f1c6ebca8/mza_1492532737245560899.600x600-75.jpg", "genreIds":["1402", "26", "1301"], "genres":["Design", "Podcasts", "Arts"]}]
}
But when trying to get a list of podcasts based on genre, e.g. when using genre id "1402" for trying to get list from the genre "Design" (happens with whatever id number I use, actually) using the following
https://itunes.apple.com/search?term=1402&media=podcast&entity=podcast&attribute=genreIndex&limit=1
I get is this
{
"resultCount":0,
"results": []
}
(I am taking the ids from here http://www.apple.com/itunes/affiliates/resources/documentation/genre-mapping.html)
Obviously I am doing something trivial wrong here.. :(.. Is there something missing from the API description?
Why not use genreId like so? It's an undocumented search parameter that I stumbled on by accident.
https://itunes.apple.com/search?term=podcast&genreId=1402&limit=200
Okay - looks like the strategy was wrong and using that API does not work for getting list of podcasts of a desired genre.
The way forward is to use different API, e.g.
https://itunes.apple.com/us/rss/topaudiopodcasts/genre=1406/json
to get a list of podcasts. You do not get feed address directly from here but you get feed id and can use that to lookup rest of whatever you need via the search API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With