Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

itunesartwork - iTunes API artworkUrl512 method of getting different icon sizes no longer work, fix?

This is related to posts like this: iTunes API: get 100x100 px icon of an App

However since the method described in the accept answered there seems to be broken on a few, yet consistent, occasions, I'm gonna ask if there is a known workaround or other fix for this. How can we get artwork of an app in a requested size like 100x100 pixels, 150x150 pixels etc?

The method is like this:

  1. Get the Apple ID of the app. For ANgry birds, it's 343200656
  2. Use iTunes API to do a lookup. https://itunes.apple.com/lookup?id=343200656
  3. Get the artworkUrl512, it's likely the same as artworkUrl100 these days but whatever. For Angry birds, it's http://a1854.phobos.apple.com/us/r30/Purple3/v4/2d/5c/a1/2d5ca114-71f0-0687-6ebb-d10055b89fe6/pr_source.png?downloadKey=1429243548_2f0a88b4ea441432cc948d9377a86569
  4. I think we can cut the ? and everything to the right. Not sure about this step, this seems to be a fairly recent (?) thing. http://a1854.phobos.apple.com/us/r30/Purple3/v4/2d/5c/a1/2d5ca114-71f0-0687-6ebb-d10055b89fe6/pr_source.png
  5. Replace the last .png with .100x100-75.png where the NxN is the size in pixels you want. We try 100x100 so: http://a1854.phobos.apple.com/us/r30/Purple3/v4/2d/5c/a1/2d5ca114-71f0-0687-6ebb-d10055b89fe6/pr_source.100x100-75.png

Should be 100x100 pixels

Sweet.

  1. And this time it works. We should get a 100x100 picture back, instead of the 1024x1024 that artworkUrl512 gives by default.

And for SOME apps, step 5 just gives a 404 error back.

Possible lessons learnt:

  1. As this always was an undocumented feature, it was bound to break, without any notice, at some point.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Replace the filename with 100x100-85.png and it will work.

Currently the lookup API is returning the following URL for artworkUrl512:

http://is1.mzstatic.com/image/thumb/Purple1/v4/c4/12/b4/c412b4db-531b-21f9-00da-a80b4471ac37/mzl.xnxvmulj.png/0x0ss-85.jpg

If you replace 0x0ss-85.jpg with 100x100-85.png, you get the 100x100 file:

http://is1.mzstatic.com/image/thumb/Purple1/v4/c4/12/b4/c412b4db-531b-21f9-00da-a80b4471ac37/mzl.xnxvmulj.png/100x100-85.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...