Revisions
-
Sjors revised this gist
Aug 3, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,4 @@ xml_data = Net::HTTP.get_response(URI.parse(url)).body data = XmlSimple.xml_in(xml_data) agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")} agent_names = agents.collect {|agent| agent["String"].first} -
Sjors created this gist
Aug 3, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ require 'net/http' require 'xmlsimple' url = "http://www.user-agents.org/allagents.xml" xml_data = Net::HTTP.get_response(URI.parse(url)).body data = XmlSimple.xml_in(xml_data) agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")} agent_names = agents.collect {|agent| agent["String"]}