Up-to-date simple useragent faker with real world database in Swift.
MIT License
Up-to-date simple useragent faker with real world database in Swift, inspired by fake-useragent.
To run the example project, clone the repo, and run pod install
from the Example directory first.
FakeUserAgent is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'FakeUserAgent'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.
Once you have your Swift package set up, adding FakeUserAgent as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/EyreFree/FakeUserAgent", .upToNextMinor(from: "0.2.0"))
]
import FakeUserAgent
FakeUserAgent.shared.pickALot(count: 5, browser: .chrome, filter: { userAgent in
return userAgent.contains("Macintosh; Intel Mac OS X 10_")
}, completion: { result in
print(result.joined(separator: "\n"))
})
Will show:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.803.0 Safari/535.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
"internet explorer"
to "internetExplorer"
in file;}{
to ,
in file;FakeUserAgent/Assets
EyreFree, [email protected]
FakeUserAgent is available under the MIT license. See the LICENSE file for more info.