But...but...the second way is so much more programatic!
ruby -e 'require "json"; require "open-uri"; JSON.parse(open("https://api.github.com/users/<username>/keys).read).each{|x|puts x["key"]}'
Maybe there's something about the .keys URL possibly going away or moving, while the API is pretty much guaranteed to be there for as long as that version of the API works.