Created
February 3, 2015 05:36
-
-
Save Experiment5X/da96c4832d448adcdc86 to your computer and use it in GitHub Desktop.
Gets a list of all the avatar items for a specified Xbox360 game. The program requires a title id for each game which is an 8-digit id that can be found in the URL of game's webpage on xbox.com
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
if ARGV.length != 1 | |
puts "Usage: xboxavatar title-id" | |
exit | |
end | |
begin | |
page = Nokogiri::HTML(open("http://marketplace.xbox.com/en-US/Product/Halo-3/66acd000-77fe-1000-9115-d802#{ ARGV[0] }?DownloadType=AvatarItem#LiveZone")) | |
avatarItems = page.css(".grid-18") | |
for item in avatarItems.drop(2) | |
puts item.css("h2").text.strip | |
end | |
rescue OpenURI::HTTPError => error | |
puts "Invalid title id" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment