https://github.com/wux1an/fake-useragent
Provide random user agent
https://github.com/wux1an/fake-useragent
crawler random spider ua user-agent useragent
Last synced: 9 months ago
JSON representation
Provide random user agent
- Host: GitHub
- URL: https://github.com/wux1an/fake-useragent
- Owner: wux1an
- License: bsd-3-clause
- Created: 2021-11-08T13:18:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-14T13:01:05.000Z (almost 4 years ago)
- Last Synced: 2025-07-08T18:42:57.978Z (12 months ago)
- Topics: crawler, random, spider, ua, user-agent, useragent
- Language: Go
- Homepage:
- Size: 33.2 KB
- Stars: 15
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# fake-useragent
Provide random user agent
# Install
```console
go get -u github.com/wux1an/fake-useragent
```
# Usage
```golang
package main
import (
"fmt"
"github.com/wux1an/fake-useragent"
)
func main() {
fmt.Println(ua.Random())
fmt.Println(ua.RandomType(ua.Desktop))
fmt.Println(ua.RandomType(ua.Mobile))
fmt.Println(ua.RandomType(ua.Chrome))
}
// Output:
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15
// Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
// Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5S)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36
// Mozilla/5.0 (Linux; Android 7.1; vivo 1716 Build/N2G47H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36
```