LoginSignup
5
5

More than 5 years have passed since last update.

iTunes Store RSSのfeedをまとめてwgetする

Posted at

iTunes Store RSS

  • iTunes Store RSS
  • iTunes Storeの各国のランキングをフィードとして取得できる
  • Music/Free app/Paid app/Top sales app
  • 過去ログは存在せず、その時点でのランキングのみ取得可能

これをがんばって活用すれば

  • 毎日フィードを溜めていくことで、ランキングの動向を追っかけるウェブサイトとか作れる
  • 世界中のアプリ情報が取れるので、海外向けサイトにもなるよ

How to use

  • $countries に取得したい国コードを指定
<?php
$countries = array('jp', 'us', 'cn', 'kr');
$source_filename_prefix = array('topfree', 'toppaid', 'topgrossing');

foreach ($countries as $country) {
    foreach ($source_filename_prefix as $filename_prefix) {
        $filename = $country . "_" . $filename_prefix . ".list";
        $contents = @file($filename);
        foreach ($contents as $line) {
            $rss_data = explode("," ,$line);
            $category = trim($rss_data[0]);
            $xml_url = trim($rss_data[1]);
            $output_filename = $country . "/" . $filename_prefix . "_" . $category . "_" . date('Ymd') . ".xml";
            $cmd = "wget " . $xml_url . " -O " . $output_filename;
            system($cmd);
        }
    }
}
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5