Skip to content

Instantly share code, notes, and snippets.

@fruitcoder
Last active September 14, 2018 13:42
Show Gist options
  • Save fruitcoder/3769ec5573914586be2a4aabd014cd9d to your computer and use it in GitHub Desktop.
Save fruitcoder/3769ec5573914586be2a4aabd014cd9d to your computer and use it in GitHub Desktop.
This script waits for a new version and sends a local notification via AppleScript when it's available on the App Store
#!/usr/bin/ruby
# It's so annoying that the 'Ready for Sale' status on AppStoreConnect doesn't mean that the app
# is available for your users, since the cache might not have been invalidated yet.
# This is why I created this script to run and scrape the App Store page of an app and its currently live version.
# Once the expected version is live, a local notification is sent. This can be easily extended to send a Slack message via a web hook.
require 'open-uri'
require 'nokogiri'
puts('Enter the app store url of the app. i.e. https://itunes.apple.com/us/app/slack/id618783545')
appstoreUrl = gets.chomp
puts('Enter the version number you are waiting for. i.e. "1.2.3"')
versionRaw = gets.chomp
expectedVersion = "Version " + versionRaw
# get webpage
appstorePage = Nokogiri::HTML(open(appstoreUrl))
# something like "Version 1.2.3"
currentVersion = appstorePage.css('.whats-new__latest__version').text
while currentVersion != expectedVersion do
$stdout.puts "Current version is #{currentVersion}. Still waiting for #{expectedVersion}. Trying again in 1 min"
$stdout.flush
sleep 60
# get webpage
appstorePage = Nokogiri::HTML(open(appstoreUrl))
# something like "Version 1.2.3"
currentVersion = appstorePage.css('.whats-new__latest__version').text
end
puts("Version #{expectedVersion} is live.")
system ( "osascript -e 'display notification \"Version #{expectedVersion} is now available on the App Store\" with title \"🚀\"'" )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment