majd / ipatool

Command-line tool that allows searching and downloading app packages (known as ipa files) from the iOS App Store
MIT License
5.35k stars 468 forks source link

Enable skip existing file #156

Closed ViRb3 closed 1 year ago

ViRb3 commented 1 year ago

Adds --skip-existing flag, IMO useful for automation

majd commented 1 year ago

Let's skip this one for now. I can't decide whether I would like to include this functionality as an additional (imo unnecessary) flag in the CLI tool.

ViRb3 commented 1 year ago

The reason I added this is because it is currently impossible to skip an existing IPA, and this is a pain if you're, say, trying to keep a list of apps always up to date — you will always need to re-download everything! The user doesn't know the latest version of the app, and even if guessed, there's still the chance of it changing until ipatool is invoked. This is somewhat mitigated by one of my upcoming changes, which is exposing the lookup command, but even then, the problem with the latest version changing in between these two invocations remains. The change is extremely minor if we exclude the (automated) test refactors, so I personally think this is a much needed change. Please let me know what you think.

majd commented 1 year ago

The same thing can be achieved by looking up the latest available version of the app and then deciding whether you skip it or not. You can lookup the latest version either by using the search command, the upcoming lookup command or by calling the iTunes API directly:

$ curl https://itunes.apple.com/lookup\?country\=US\&entity\=software\&limit\=5\&media\=software\&bundleId\=com.apple.TestFlight | jq '.results[0].version'
"3.2.4"

I don't think that the version changing within milliseconds (in between both calls) is a valid argument. 🙂

ViRb3 commented 1 year ago

Sure they can, but if users need to curl the API manually, why even use ipatool in the first place? I agree that unnecessary things shouldn't be added, but in this case, there isn't a trivial way to achieve this, and IMO ipatool should be the one to provide the functionality. On top of that, with my next PR that allows downloading of unlisted apps, you can't use lookup at all for those unlisted apps, so your method just won't work.