public
Last active

Searches the itunes store for ios applications that are compatible with the original iPad. Alter the term and rating parameters to filter results.

  • Download Gist
thisOldiPadiTunesSearch.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
require 'net/http'
require 'uri'
require 'json'
 
term = 'calendar'
rating = 4
 
uri = URI("https://itunes.apple.com/search?term="+ term +"&country=us&media=software&entity=iPadSoftware&limit=50")
resp = Net::HTTP.get_response(uri)
results = JSON.parse(resp.body)
 
output = Hash.new(0)
 
results['results'].each_with_index do |app, i|
output[[i,0]] = i
if app['price'] == 0
output[[i,1]] = 'free'
else
output[[i,1]] = app['price']
end
output[[i,2]] = app['primaryGenreName']
output[[i,3]] = app['trackName']
output[[i,4]] = "Not Compatible"
app['supportedDevices'].each do |d|
if d == "iPadWifi"
output[[i,4]] = "iPadWifi Compatible"
end
end
if app['averageUserRating'].nil?
output[[i,5]] = 0
else
output[[i,5]] = app['averageUserRating']
end
if app['averageUserRatingForCurrentVersion'].nil?
output[[i,6]] = 0
else
output[[i,6]] = app['averageUserRatingForCurrentVersion']
end
end
 
(1...50).each do |i2|
if output[[i2,4]] == "iPadWifi Compatible"
if output[[i2,5]] >= rating
puts
puts 'Name: ' + output[[i2,3]]
puts 'Price: ' + output[[i2,1]].to_s
puts 'Genre: ' + output[[i2,2]]
puts 'Overall Rating: ' + output[[i2,5]].to_s
puts 'Current Version Rating: ' + output[[i2,6]].to_s
end
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.