Skip to content

Instantly share code, notes, and snippets.

@abutcher
Created April 3, 2015 22:27
Show Gist options
  • Select an option

  • Save abutcher/4abbb82de9dd3e1dc10c to your computer and use it in GitHub Desktop.

Select an option

Save abutcher/4abbb82de9dd3e1dc10c to your computer and use it in GitHub Desktop.
destiny cards from api
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
# display_name = ARGV[0]
# membership_id = JSON.load(open("https://www.bungie.net/platform/destiny/SearchDestinyPlayer/All/#{display_name}/"))["Response"][0]["membershipId"]
# puts membership_id.to_s
themes = JSON.load(open("http://www.bungie.net/Platform/Destiny/Vanguard/Grimoire/Definition/"))["Response"]["themeCollection"]
themes.each do |theme|
page_collections = theme["pageCollection"]
page_collections.each do |page_collection|
card_collections = page_collection["cardCollection"]
card_collections.each do |card|
if /Ghost Fragment/.match(card["cardName"])
puts "card_id: #{card["cardId"]}, card_name: #{card["cardName"]}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment