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

岁酱吖の 提交于 2019-12-18 07:04:09

问题


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

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.

回答1:


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



来源:https://stackoverflow.com/questions/29666002/itunes-api-artworkurl512-method-of-getting-different-icon-sizes-no-longer-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!