Store of web user agent strings used for generating fake user agents or extracting metadata from user agent strings
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
README.textile
ruseragent.gemspec

README.textile

A store of web user agent strings with automatically extracted and manually
specified metadata.


require 'ruseragent'
require 'pp'

r = Ruseragent::Ruseragent.new
puts r.random
# random Linux or Safari
puts r.random(:linux, :safari)
# manually added tag
puts r.random(:old)
pp r.identify('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; FunWebProducts; MRA 4.6 (build 01425); .NET CLR 1.1.4322; .NET CLR 2.0.50727)')

Output:


Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16
Mozilla/5.0 (X11; U; Linux i686;en-US; rv:1.2.1) Gecko/20030225
Mozilla/3.01Gold (X11; I; SunOS 5.5.1 sun4m)
[:ie, :windows]