library(Randomuseragent)
There are only two functions in this package: filter_useragent
and random_useragent
. They both accept same arguments to subset from all the useragent strings provided in this package.
The most simple way of generating random UA string is:
random_useragent()
#> [1] "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17"
Or we can choose the UA string used by Chrome browser on Windows machine:
random_useragent(software_name = "Chrome", operating_system_name = "Windows")
#> [1] "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4"
Or we can choose Safari from Mac OS X:
random_useragent(software_name = "Safari", operating_system_name = "Mac OS X")
#> [1] "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.21.11 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10"