Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the URL for podcast feeds from an iTunes id. (iTMS API)

I'm look at a way of turning an iTunes podcast id into the RSS feed that the podcast producer serves.

I'm aware of the RSS generator, which can be used to generate a feed of links to podcasts, but these links are to HTML pages.

If you have iTunes open, you can manually export the list of podcasts by exporting to OPML, so we can surmise that iTunes eventually knows how to decode them (i.e. they're not exclusively going through an iTMS host).

I have looked at the Affiliate API document which gives you some nice JSON back. This gives you a collectionViewUrl which is the same as the ones given in the RSS generator, and incidentally, the iTunes Link Generator. It also give you the id, and a whole load of other things including a preview audio file which is not hosted on the phobos.

At this point, I'm looking for anything that would help me solve this question, including any language, unofficial or not.

(in actual fact, I'd prefer something vaguely supported, and in Java, that didn't involve HTML scraping).

like image 391
jamesh Avatar asked Feb 21 '10 16:02

jamesh


People also ask

How do I find my Apple podcast feed URL?

If you go to your Podcasts listing in your iTunes library, you will see a list of the Podcasts you subscribe to. Right-click on the Podcast you want to copy the URL of and select "Copy Podcast URL". This will copy the URL to the RSS feed of the Podcast into your clipboard.

How do I get a podcast RSS feed URL?

You need to start by visiting the Google Play Podcast Portal. Once you make it to that area, you click on the button to add a podcast. Take your RSS feed URL and paste it into the text box field. You then verify you own the RSS feed via your e-mail, review the information, and click on the publishing button.

What is my podcast feed URL?

Click the Hosting Settings link inside the Podcast Hosting box. You should see your show's podcast RSS feed URL right above the Save button.


2 Answers

Through a combination of answers from these two questions, I have found a way to do what I want.

Example of finding podcasts

First: grab a list of podcasts from iTunes, using the RSS generator. I'm not sure how the query parameters work yet, but here is an RSS feed for top tech podcasts in the US.

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppodcasts/sf=143441/limit=25/genre=1318/xml
  • sf relates to country, and is optional. I would guess that this defaults to global if absent.
  • genre relates to genre, and is optional. I would guess that this defaults to "all genres" is absent.
  • limit is optional, and seems to default to 9.

This gives you an Atom feed of podcasts. You'll need to do some sperlunking with XPath to get to the ITMS id of podcast, but you're looking for the numeric id contained in the URL found at the following XPath:

/atom:feed/atom:entry/atom:link[@rel='alernate']/@href

For example, the excellent JavaPosse has an id of 81157308.

The Answer to the Question

Once you have that id, you can get another document which will tell you the last episode, and the original feed URL. The catch here is that you need to use an iTunes user-agent to get this document.

e.g.

wget --user-agent iTunes/7.4.1 \
     --no-check-certificate \ 
     "https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/com.apple.jingle.app.finance.DirectAction/subscribePodcast?id=81157308&wasWarnedAboutPodcasts=true"

This is a plist containing some metadata about the podcast, including the feed URL.

<key>feedURL</key><string>http://feeds.feedburner.com/javaposse</string>

The XPath for this could be something like:

//key[@text='feedURL']/following-sibling::string/text()

Disclaimer

Not entirely sure how stable any of this is, or how legal it is. YMMV.

like image 160
jamesh Avatar answered Sep 28 '22 11:09

jamesh


As soon as you have the id you can use it in lookup as defined in

https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/

You should get what you need by parsing the response with JSON

like image 27
juhariis Avatar answered Sep 28 '22 11:09

juhariis