Skip to content

Instantly share code, notes, and snippets.

@camateg
Created December 3, 2016 15:27
Show Gist options
  • Select an option

  • Save camateg/0645b7cbc4eeeef4cc94116fd234a71f to your computer and use it in GitHub Desktop.

Select an option

Save camateg/0645b7cbc4eeeef4cc94116fd234a71f to your computer and use it in GitHub Desktop.
iTunes top 100 list...
require 'open-uri'
require 'json'
region = "us"
category = "newapplications"
if !ARGV[0].nil?
region = ARGV[0]
end
if !ARGV[1].nil?
category = ARGV[1]
end
base_url = "https://itunes.apple.com/" + region + "/rss/" + category + "/limit=10/json"
json = open(URI.parse(base_url)).read
data = JSON.parse(json)
ct = 0
data['feed']['entry'].each do |entry|
ct += 1
bid = entry['id']['attributes']['im:bundleId']
if !bid.nil?
puts ct.to_s + ". " + bid
else
puts ct.to_s + ". " + "No Bundle ID"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment