从iTunes商店获取最新的播客,并带有RSS,JSON或其他链接 [英] get the latest podcasts from itunes store with link by RSS, JSON or something

查看:228
本文介绍了从iTunes商店获取最新的播客,并带有RSS,JSON或其他链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从"itunes存储"中获取最新的播客信息,以便在多个应用程序(iphone应用程序和Web应用程序)中使用此数据.

i'm trying to get the latest podcast informations out of "itunes store" to work with this data in several applications (iphone app and web app).

有没有办法获取这些信息? RSS,JSON或其他内容?

Is there a way to get this informations? RSS, JSON or something?

我想在Objective-C和带有php或js的网站上使用这些信息.

i want to work with this informations in objective-c and on a website with php or js.

我的问题清楚了吗? :(

Is my question clear? :(

//edit:有什么不清楚的地方吗?留下评论,如果可以的话

//edit: anything unclear? leave a comment, if yes

推荐答案

基于您的问题,我只是试图找到一种方法来实现此目的.

Based on your question, I just tried to find a way to do this.

  1. 因此,您需要播客ID(如果有的话,在URL上应该很明显;例如,http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=82884735的ID为"82884735",而http://itunes.apple.com/us/podcast/this-week-in-tech-mp3-edition/id73329404的ID为"73329404").

  1. So you'll need the podcast ID (should be obvious from the URL if you have it; for instance http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=82884735 has the ID "82884735", and http://itunes.apple.com/us/podcast/this-week-in-tech-mp3-edition/id73329404 has the ID "73329404").

???

将ID插入URL https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/com.apple.jingle.app.finance.DirectAction/subscribePodcast?id={ID}&wasWarnedAboutPodcasts=true中并获取数据,其中{ID}是您的播客ID. 在这里将用户代理字符串更改为iTunes很重要.在本实验中,我使用了"iTunes/7.4.1".如果您不进行更改,则会得到与众不同的东西.

Plug the ID into the URL https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/com.apple.jingle.app.finance.DirectAction/subscribePodcast?id={ID}&wasWarnedAboutPodcasts=true and get the data, where {ID} is your podcast ID. It's important here to change your user agent string to iTunes. For this experiment, I used "iTunes/7.4.1". If you don't change it, you'll get something very different.

您最终将获得XML数据;包含在DocumentProtocol标记中的XML plist.看起来像

You'll end up with XML data; an XML plist enclosed in Document and Protocol tags. It will look like

<文档> <协议> < plist version ="1.0"> ... </plist> </协议> </Document>

<Document> <Protocol> <plist version="1.0"> ... </plist> </Protocol> </Document>

您可以从中提取plist数据,如果您选择的语言有一个,可以使用一个库对其进行操作.本质上将有一个根"字典,并且其中有一个名为"subscribe-podcast"的字典.该订阅播客"字典将具有一个名为"feedURL"的键-取其值,您将获得RSS feed.我建议尝试这些步骤并继续进行.

You can pull the plist data from this and use a library to manipulate it if your language of choice has one. Essentially there'll be a "root" dictionary and a dictionary inside it called "subscribe-podcast". This "subscribe-podcast" dictionary will have a key called "feedURL" – nab the value, and you'll have your RSS feed. I'd recommend trying these steps and following along.

plist的一种更易于理解的表示法是 NeXTSTEP格式,它实际上看起来有点像JSON.转换为这种格式的虚拟播客plist的摘录如下(请记住,您实际上将取回类似XML的文件):

An easier to follow representation of the plist is the NeXTSTEP format, which actually looks a bit like JSON. An excerpt of a dummy podcast plist transformed into this format is as follows (remember that you'll really be getting back an XML-like file):

{
    "subscribe-podcast" = {
        …
        feedURL = "http://feeds.feedburner.com/yaddayaddayadda"; 
        …
        podcastName = "Lorem Ipsum"; 
        …
    }; 
}

现在,您会在我描述的步骤中注意到步骤2丢失了.这是因为我查看了Apple在步骤3中手动返回给我的数据,以获取URL.很有可能您可能想自己解析数据,以防Apple决定更改URL,但可能是因为中间HTML仍然会更改和破坏您的程序.我可能会回过头来看看记录在步骤3中获取魔术URL应该采取的步骤.

Now you'll notice in the steps I described that step 2 is missing. This is because I looked at the data that Apple was giving me back manually to get to the URL in step 3. Chances are that you'll want to parse the data yourself in case Apple decides to change the URL, but maybe it's probable for the intermediate HTML to change and break your program anyway. I might go back and look at documenting the steps that should be taken to get at our magic URL in step 3.

我尝试了一些播客,尝试了这种策略,在为我提供RSS feed方面似乎效果很好.由于我不知道您所要求的任何语言,因此我无法以代码形式提出任何建议.希望它能带您上路.

I tried out this strategy with a few podcasts, and it seems to work well in giving me the RSS feed. Since I don't know any of the languages that you asked for, I can't make any recommendations code-wise. Hope it can get you on your way, though.

这篇关于从iTunes商店获取最新的播客,并带有RSS,JSON或其他链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆