How can I fetch information about the app/song/video etc. from iTunes Store?

后端 未结 5 1478
生来不讨喜
生来不讨喜 2020-12-28 11:05

I need to get an info about the app/song/video by item id from iTunes Store.

I\'ve found this

But it doesn\'t work with apps.

Is there any public API

5条回答
  •  粉色の甜心
    2020-12-28 11:24

    I wrote this script for myself. It's not optimized or future-proof, but it's working for me in the meantime...

    Four stars: " . $ratings[1];
        echo "
    Three stars: " . $ratings[2]; echo "
    Two stars: " . $ratings[3]; echo "
    One star: " . $ratings[4]; echo "
    Total ratings: " . getTotalRatings($ratings); echo "
    Average rating: " . getAverageRating($ratings); } function getTotalRatings($ratings) { $temp = 1; for($i=0; $i < count($ratings); ++$i) $temp+=$ratings[$i]; return $temp; } function getAverageRating($ratings) { $totalRatings = getTotalRatings($ratings); return round(5*($ratings[0]/$totalRatings) + 4*($ratings[1]/$totalRatings) + 3*($ratings[2]/$totalRatings) + 2*($ratings[3]/$totalRatings) + 1*($ratings[4]/$totalRatings),2); } function getXML($ratings) { header('Content-type: text/xml'); header('Pragma: public'); header('Cache-control: private'); header('Expires: -1'); echo ''; echo ''; echo ''.$ratings[0].''; echo ''.$ratings[1].''; echo ''.$ratings[2].''; echo ''.$ratings[3].''; echo ''.$ratings[4].''; echo ''.getTotalRatings($ratings).''; echo ''.getAverageRating($ratings).''; echo ''; } ?>

提交回复
热议问题