iTunes Music Store Link Maker — 如何从我的应用程序内搜索?

发布于 2024-08-29 01:57:38 字数 971 浏览 4 评论 0原文

我正在编写一个音乐参考应用程序,并且对于每张专辑(从 last.fm 中提取)都希望链接到 ITMS(如果专辑在商店中)。

iTunes 链接制作器网络工具 http://apple.com/itunes/linkmaker/ 非常适合获取已知专辑的链接,但我需要从我的应用程序内以编程方式访问它。

这篇 NSLog 博文发表于 2003 年,但最近在另一个问题中引用似乎提供了唯一的解决方案到目前为止,我遇到过建议将查询提交到:

phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?

在其前面加上“itms://”,该链接将在 iTunes 中工作,在其前面加上“http://”,该链接将在 Camino 中工作(Safari 有时会返回格式错误的 XML 错误)。

重要的标签如下:

  • songTerm - 歌曲标题
  • artistTerm - 艺术家姓名
  • albumTerm - 专辑名称
  • composerTerm - 作曲家姓名
  • 术语 - 所有字段

建议使用http:// 而不是itms:// 服务器将返回结果的 XML 文档,而不是打开 iTunes,但无论哪种方式,我都会直接发送到 iTunes。

是否可以取回结果列表?

I'm writing a music reference app and for each album (pulled from last.fm) would like to link to the ITMS (if the album is in the store).

iTunes link maker web tool http://apple.com/itunes/linkmaker/ is great for getting links for a known album but I need to access it programatically from within my app.

This NSLog blogpost which is from 2003 but was referenced more recently in another question here seems to offer the only solution I've come across so far, suggesting to submit a query to:

phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?

Put "itms://" before it and the link will work in iTunes, put "http://" before it and the link will work in Camino (Safari sometimes spits back a malformed XML error).

The tags that are of importance are as follows:

  • songTerm - song title
  • artistTerm - artist name
  • albumTerm - album name
  • composerTerm - composer name
  • term - all fields

The suggestion is that would using http:// rather than itms:// the server will return an XML document of results instead of opening iTunes but either way I am sent directly to iTunes.

Is it possible to get back a list of results?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半寸时光 2024-09-05 01:57:38

我正在使用 LinkMaker 获取有关我正在播放的歌曲的 iTunes 详细信息。
为此,我发现 LinkMaker 能够返回 json 数据并且一次返回 1 个结果。

我正在使用此网址来执行我的查询:

http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?lang=1& ;output=json&country=%@&term=%@&media=%@&limit=1"

以下是您需要提供的参数:

> country : store country term : could
> contains artist name, song name, album
> media : music

例如,如果您想了解一首名为“的歌曲的详细信息”这里“U2”的“One”是正确的 URL:

http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/ itmsSearch?lang=1&output=json&country=US&term=U2%20one&media=music&limit=1

你将收到这样的 json 数据:

{
 "resultCount":1,
 "results": [
{"wrapperType":"track", "mediaType":"song", "artistName":"U2", "itemParentName":"Achtung Baby", "itemParentCensoredName":"Achtung Baby", "itemCensoredName":"One", "itemName":"One", "artistLinkUrl":"http://itunes.apple.com/us/artist/u2/id78500?uo=4", "artworkUrl60":"http://a1.phobos.apple.com/us/r1000/009/Features/32/9a/60/dj.mfynlttx.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r1000/009/Features/32/9a/60/dj.mfynlttx.100x100-75.jpg", "country":"USA", "currency":"USD", "discCount":1, "discNumber":1, "itemExplicitness":"notExplicit", "itemLinkUrl":"http://itunes.apple.com/us/album/one/id368713?i=368617&uo=4", "itemPrice":"1.29000", "itemParentExplicitness":"notExplicit", "itemParentLinkUrl":"http://itunes.apple.com/us/album/one/id368713?i=368617&uo=4", "itemParentPrice":"9.99000", "previewUrl":"http://a1.phobos.apple.com/us/r1000/019/Music/b6/8c/c5/mzm.epegonxg.aac.p.m4a", "primaryGenreName":"Rock", "trackCount":12, "trackNumber":3, "trackTime":276042}]
}

然后你需要解码这些 JSON 数据。

NSDictionary *jsonResultsParsed = [jsonResults JSONValue];

然后 终于得到你想要的:

NSDictionary *songDetailsDict = [[jsonResultsParsed objectForKey:@"results"] objectAtIndex:0];

如果你想确定用户的国家/地区,你将需要使用其区域设置确定其国家/地区,这是我正在使用的代码:

- (NSString *)getUserCountry
{
    NSLocale *locale = [NSLocale currentLocale];
    return [locale objectForKey: NSLocaleCountryCode];
}

希望这会有所帮助。

蒂埃里

编辑:终于有一个文档可用:

http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

I am using LinkMaker to get iTunes details about song I am playing.
For that, I found that LinkMaker is able to return json data and also 1 result at a time.

I am using this url to perfom my query :

http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?lang=1&output=json&country=%@&term=%@&media=%@&limit=1"

Here are parameters you need to give :

> country : store country term : could
> contains artist name, song name, album
> media : music

For exemple, if you want to have details for a song called "One" by "U2" here is the correct URL :

http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/itmsSearch?lang=1&output=json&country=US&term=U2%20one&media=music&limit=1

Then you will receive json data like this :

{
 "resultCount":1,
 "results": [
{"wrapperType":"track", "mediaType":"song", "artistName":"U2", "itemParentName":"Achtung Baby", "itemParentCensoredName":"Achtung Baby", "itemCensoredName":"One", "itemName":"One", "artistLinkUrl":"http://itunes.apple.com/us/artist/u2/id78500?uo=4", "artworkUrl60":"http://a1.phobos.apple.com/us/r1000/009/Features/32/9a/60/dj.mfynlttx.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r1000/009/Features/32/9a/60/dj.mfynlttx.100x100-75.jpg", "country":"USA", "currency":"USD", "discCount":1, "discNumber":1, "itemExplicitness":"notExplicit", "itemLinkUrl":"http://itunes.apple.com/us/album/one/id368713?i=368617&uo=4", "itemPrice":"1.29000", "itemParentExplicitness":"notExplicit", "itemParentLinkUrl":"http://itunes.apple.com/us/album/one/id368713?i=368617&uo=4", "itemParentPrice":"9.99000", "previewUrl":"http://a1.phobos.apple.com/us/r1000/019/Music/b6/8c/c5/mzm.epegonxg.aac.p.m4a", "primaryGenreName":"Rock", "trackCount":12, "trackNumber":3, "trackTime":276042}]
}

You need then to decode these JSON data.

NSDictionary *jsonResultsParsed = [jsonResults JSONValue];

And finally get what you want :

NSDictionary *songDetailsDict = [[jsonResultsParsed objectForKey:@"results"] objectAtIndex:0];

If you want to determine user's country you will need to determine its country using its locale, here is the code I am using :

- (NSString *)getUserCountry
{
    NSLocale *locale = [NSLocale currentLocale];
    return [locale objectForKey: NSLocaleCountryCode];
}

Hope this helps.

Thierry

Edit: Finally a doc is available:

http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

尬尬 2024-09-05 01:57:38

本文档适用于 iTunes Store Web Service Search API (pdf)陈旧且不完整,似乎是实现这一目标的方法。

不过,与联盟计划的其他部分一样,设置此功能是一次痛苦的经历。

This document for iTunes Store Web Service Search API (pdf), although old and incomplete, seems to be the way to accomplish this.

It's a painful experience setting this up though, as has been every other part of the affiliate programme.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文