Created
December 3, 2016 15:27
-
-
Save camateg/0645b7cbc4eeeef4cc94116fd234a71f to your computer and use it in GitHub Desktop.
iTunes top 100 list...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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