Skip to content

Instantly share code, notes, and snippets.

@Experiment5X
Created February 3, 2015 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Experiment5X/da96c4832d448adcdc86 to your computer and use it in GitHub Desktop.
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
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