The goal of Randomuseragent is to have a easy access to different user-agent strings by randomly sampling from a pool of real strings.
Installation
The development version can be installed from GitHub with:
# install.packages("devtools") devtools::install_github("fangzhou-xie/Randomuseragent") #> Skipping install of 'Randomuseragent' from a github remote, the SHA1 (002aee0b) has not changed since last install. #> Use `force = TRUE` to force installation
The package is currently under active development and will be submitted to CRAN soon.
Example
This is a basic example to get random user-agent strings:
library(Randomuseragent) random_useragent() #> [1] "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; MDDRJS; rv:11.0) like Gecko" filter_useragent(min_obs = 50000, software_name = "Safari", operating_system_name = "Mac OS X") #> [1] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9" #> [2] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10" #> [3] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/6.1.6 Safari/537.78.2" #> [4] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/E7FBAF" #> [5] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.5.17 (KHTML, like Gecko) Version/8.0.5 Safari/600.5.17" #> [6] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/6.2.8 Safari/537.85.17" #> [7] "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_8) AppleWebKit/534.50.2 (KHTML, like Gecko) Version/5.0.6 Safari/533.22.3"
Both function will accept the same set of arguments for filtering user-agent strings. Please refer to documentation of either function for details.