如何从 iTunes 中获取前 400 个列表

How to get top 400 lists from iTunes

如何从 iTunes 中获取前 400 个(或更多)应用程序列表?我需要每个类别和整体的最高付费、免费和总收入列表。

我知道 rss 提要存在于 https://rss.itunes.apple.com/,但它只会为您提供前 200 名。然而 AppFigures 和 AppAnnie 等网站有前 400 或 500 名的列表,应用商店中的应用将显示你是前 400 名。

我尝试了 EPF 提要,受欢迎程度 table 只有 20 行,从其他论坛上看,该提要似乎已经几个月不可用了,而且它的更新频率不如这些其他网站似乎无论如何。

我正在直接从 Apple 寻找解决方案,而不是通过第三方。我 99% 确定 Apple 每小时提供此数据,但我不知道端点。

2015 年 10 月 12 日更新:根据 Apple 开发人员支持,截至 2015 年 10 月 9 日,该问题已得到解决。


RSS 提要目前确实上限为 200 个结果(尽管过去已设置为最多 400 个),

关于 EPF 关系 - 一些服务(例如 Chomp)过去依赖于它。我不确定它的当前状态,但如果您尝试使用它,请确保您获得完整的每周版本(大小必须在 5 GB 以上的范围内),而不仅仅是增量版本。也许这就是你只得到几行的原因?

目前我不知道还有其他方法可以直接从 Apple 获取此信息。您可以尝试 f6s 的免费服务或使用其他付费服务提供的 API。

更新 - 收到 Apple 反馈

这对我来说是个有趣的话题,所以我昨天联系了 Apple,问他们有没有办法直接从他们那里检索这些数据。今天早上,我从 Apple 的 iTunes Affiliate 团队收到了关于图表数据可用性的反馈。他们确认了 RSS 提要的局限性,并对 EPF 问题说了以下内容:

If you are an affiliate, you could look into the EPF Relational to develop your own search results.

The EPF is a multiple-gigabyte download of the complete set of metadata from the iTunes Store, App Store, and Mac App Store. EPF is available for affiliates to fully incorporate aspects of the iTunes and App Store catalogs into a website or app. This tool is only for tech-savvy affiliates, and knowledge of relational databases setup is required. Apple will not provide technical support for setting up or maintaining this tool.

EPF access is only available for approved Affiliate Program publishers. More information regarding the EPF can be found on the Enterprise Partner Feed documentation page. Review the documentation found there, and if you would then like access to the EPF, provide the following information: ...

在进一步调查 ERPF technical documentation 后,我发现数据库中的 table 之一包含按类型分类的前 1000 个应用程序:

因此,您应该首先将数据导入您自己的数据库,从每周(数 GB)发布开始,然后应用自每周发布以来可用的任何每日(数 MB)更新。根据 Apple 的说法,两者之间的区别是:

Feed Modes

iTunes generates the EPF data in two modes:

  • full mode

  • incremental mode

The full export is generated weekly and contains a complete snapshot of iTunes metadata as of the day of generation. The incremental export is generated daily and contains records that have been added or modified since the last full export. The incremental exports are located relative to the full export on which they are based.

假设您已将数据导入关系数据库,您应该能够使用类似于以下语句的简单 SELECT 语句获取所需数据:

SELECT application.title, applicationpopularityper_genre.application_rank 
FROM applicationpopularityper_genre 
JOIN application 
  ON application.application_id = applicationpopularityper_genre.application_id
WHERE applicationpopularityper_genre.genreid = XX
ORDER BY applicationpopularityper_genre.application_rank ASC;

关于每小时更新 - 通过查看关系结构,我看到 export_date 列可用。在执行上面的 select 时,您应该检查是否为每个应用程序获取多个日期 - 如果您这样做,您的数据粒度比一天更细。如果不是(这更有可能),并且这对您来说是一个交易破坏者,您应该考虑使用 Appannie 和我已经提出的其他人的服务,这些服务使用他们通过 itunes 连接从开发人员那里获得的数据来丰富这些数据。如果你想要免费的信息,你可以尝试从 Appannie 抓取(有一些 free tools 这样做,但你应该知道从长远来看这可能不是很可靠,所以你最好还是付钱);

更新二:

iTunes 附属团队确认他们知道此 table 的问题。

希望这能回答您的问题。

从 AppAnnie 抓取数据可以吗?

使用 phantomjs 和 casperjs 抓取免费、付费和总收入的前 500 名。

  1. 在你的系统中安装 phantomjs 和 casperjs
  2. 在终端中:casperjs appAnnieTop500Scraper.js

Sample Output

Free Apps
500 apps found:
// not shown: app names in json array format
// json array on file: freeTop500.json
Paid Apps
500 apps found:
// not shown: app names in json array format
// json array on file: paidTop500.json
Grossing Apps
500 apps found:
// not shown: app names in json array format
// json array on file: grossingTop500.json

appAnnieTop500Scraper.js

var free = [];
var paid = [];
var grossing = [];

var FREE_COLUMN_INDEX = 1;
var PAID_COLUMN_INDEX = 2;
var GROSSING_COLUMN_INDEX = 3;

var fs = require('fs');
var casper = require('casper').create();
casper.on("click", function() {
  this.echo();
});
casper.on("page.error", function() {
  this.echo();
});

function getAppListScraper(columnIndex) {
  var selector = document.querySelectorAll('tbody#storestats-top-table tr td:nth-child(' + columnIndex + ') div.item-info div.main-info span.title-info');
  return Array.prototype.map.call(selector, function(e) {
    return e.getAttribute('title');
  });
}

function printToConsole(casper, appList) {
  casper.echo(appList.length + ' apps found:');
  casper.echo(JSON.stringify(appList));
}

function writeToFile(fileName, content) {
  fs.write(fileName, content, 'w');
}

casper.start('https://www.appannie.com/apps/ios/top/?device=iphone', function() {
  // click load all button to load 500 apps list
  this.click('div#load-more-box span.btn-load p a.load-all');

  // wait 5000ms for the apps list to load then scrape it
  this.wait(5000, function() {
    free = this.evaluate(getAppListScraper, FREE_COLUMN_INDEX);
    paid = this.evaluate(getAppListScraper, PAID_COLUMN_INDEX);
    grossing = this.evaluate(getAppListScraper, GROSSING_COLUMN_INDEX);
  });
});

casper.run(function() {
  this.echo('Free Apps');
  printToConsole(this, free);
  writeToFile("freeTop500.json", JSON.stringify(free));

  this.echo('Paid Apps');
  printToConsole(this, paid);
  writeToFile("paidTop500.json", JSON.stringify(paid));

  this.echo('Grossing Apps');
  printToConsole(this, grossing);
  writeToFile("grossingTop500.json", JSON.stringify(grossing));

  this.exit();
});

这是您的操作方法....您可以按如下方式点击 URL 并提供 iOS5 用户代理。

_IOS_DEEP_RANK_URL_BASE = 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/topChartFragmentData?genreId=%s&popId=%s&pageNumbers=%d&pageSize=%d'

_IOS_DEEP_RANK_USERAGENT =  'iTunes-iPad/5.1.1 (64GB; dt:28)'

你也需要设置店面,根据你想要的国家。

"X-Apple-Store-Front: 143441-1,9"

我知道这是一个老问题,但我最近遇到了同样的问题。 从许多站点加入点后,我的解决方案是这样的:

您将需要以下流派列表: https://affiliate.itunes.apple.com/resources/documentation/genre-mapping/

国家代码列表: https://affiliate.itunes.apple.com/resources/documentation/linking-to-the-itunes-music-store/#Legacy

此 link 为您提供了基本的 RSS 概述和生成器,但遗漏了很多内容: https://rss.itunes.apple.com/en-us

接下来是我设法拼凑的示例:

Top 100 Christian & Gospel
https://itunes.apple.com/au/rss/topsongs/genre=22/explicit=true/limit=100/xml

Or, the same one with JSON results
https://itunes.apple.com/au/rss/topsongs/genre=22/explicit=true/limit=100/json

Or, without the explicit songs:
https://itunes.apple.com/au/rss/topsongs/genre=22/limit=100/json    

Top 100 CCM
https://itunes.apple.com/au/rss/topalbums/genre=1094/explicit=true/limit=100/xml

只需更改流派 ID 和国家/地区代码。

https://itunes.apple.com/{country code}/rss/topalbums/genre={genre code}/explicit=true/limit=100/xml