eddycjy / fake-useragent Goto Github PK
View Code? Open in Web Editor NEWA wide variety of random useragents
License: Apache License 2.0
A wide variety of random useragents
License: Apache License 2.0
A simple function, 10 sentences can be written, you see you have a lot of kakaka, too much is also a remote address download cache, Chinese mainland can not visit, what do you think, the idea is good, can update the version, but a few years you have not updated, so do not be so old fellow, old iron! Finally, thank you for sorting out the JSON data Province in this project
`package main
import (
browser "github.com/eddycjy/fake-useragent"
"log"
)
func main() {
random := browser.Random()
log.Printf("Random: %s", random)
chrome := browser.Chrome()
log.Printf("Chrome: %s", chrome)
}
out put
GOROOT=/usr/local/go #gosetup
GOPATH=/Users/xiaxichen/go #gosetup
/usr/local/go/bin/go build -o /private/var/folders/qk/tgc9vq6j6lbgwlsxgb4lyyd40000gn/T/___go_build_main_go /Users/xiaxichen/goDistributedSpider/crawl/main.go #gosetup
/private/var/folders/qk/tgc9vq6j6lbgwlsxgb4lyyd40000gn/T/___go_build_main_go
2020/10/10 15:19:19 Random: Mozilla/5.0 (Linux; Android 6.0; MotoG3 Build/MPIS24.65-33.1-2-16) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36
2020/10/10 15:19:19 Chrome:
`
Hi,
Any way to get specific version of android user-agent?
panic: runtime error: index out of range [-1]
goroutine 102 [running]:
math/rand.(*rngSource).Uint64(...)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rng.go:249
math/rand.(*rngSource).Int63(0xffffffffffffffff?)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rng.go:234 +0x90
math/rand.(*Rand).Int63(...)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rand.go:84
math/rand.(*Rand).Int31(...)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rand.go:98
math/rand.(*Rand).Int31n(0x140003b0060, 0xbb8)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rand.go:133 +0x50
math/rand.(*Rand).Intn(0x140016a7a18?, 0x14002236be0?)
/opt/homebrew/Cellar/go/1.18.3/libexec/src/math/rand/rand.go:171 +0x34
github.com/EDDYCJY/fake-useragent/useragent.(*useragent).GetAllRandom(0x140016a7ab8?)
/Users/ashishb/go/pkg/mod/github.com/!e!d!d!y!c!j!y/[email protected]/useragent/warehouse.go:50 +0x12c
github.com/EDDYCJY/fake-useragent.(*browser).Random(...)
/Users/ashishb/go/pkg/mod/github.com/!e!d!d!y!c!j!y/[email protected]/browser.go:61
github.com/EDDYCJY/fake-useragent.Random(...)
...
Hello.
In code func (s *Spider) StartBrowser(..) mistake.
was:
body, err := downloader.Get(url)
defer body.Close()
if err != nil {
return
}
need:
body, err := downloader.Get(url)
if err != nil {
return
}
defer body.Close()
求更新一下,的确如楼下一样,返回值全是空!请求作者更新
When run it with large threads, it panic this error.
ath/rand.(*rngSource).Uint64(...) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rng.go:249 math/rand.(*rngSource).Int63(0xc000097500, 0x1) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rng.go:234 +0x89 math/rand.(*Rand).Int63(0xc000082f90, 0x412c70) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rand.go:85 +0x33 math/rand.(*Rand).Int31(0xc000082f90, 0x1) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rand.go:99 +0x2b math/rand.(*Rand).Int31n(0xc000082f90, 0xbb8, 0xc00052e580) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rand.go:134 +0x4f math/rand.(*Rand).Intn(0xc000082f90, 0xbb8, 0xfa) /usr/local/Cellar/go/1.11.1/libexec/src/math/rand/rand.go:172 +0x45
After google something, I see math/rand is not threads safe. I think we should add mutex for it.
GOROOT=C:\Go #gosetup
GOPATH=C:\Users\Administrator\go #gosetup
C:\Go\bin\go.exe build -o C:\Users\Administrator\AppData\Local\Temp___go_build_demo_02_demo1.exe demo_02/demo1 #gosetup
C:\Users\Administrator\AppData\Local\Temp___go_build_demo_02_demo1.exe #gosetup
2020/12/02 15:02:20 Random:
2020/12/02 15:02:20 Chrome:
2020/12/02 15:02:20 IE:
2020/12/02 15:02:20 Firefox:
2020/12/02 15:02:20 Safari:
2020/12/02 15:02:20 Android:
2020/12/02 15:02:20 MacOSX:
2020/12/02 15:02:20 IOS:
2020/12/02 15:02:20 Linux:
2020/12/02 15:02:20 IPhone:
2020/12/02 15:02:20 IPad:
2020/12/02 15:02:20 Computer:
2020/12/02 15:02:20 Mobile:
Process finished with exit code 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.