mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 18:20:27 +00:00
♻️ 🔥 优化青云客结构
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/FloatTech/zbputils/web"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/logoove/sqlite" // import sql
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -192,7 +193,7 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
|
||||
return
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", randua())
|
||||
req.Header.Set("User-Agent", web.RandUA())
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
@@ -255,7 +256,7 @@ func (vdb *VtbDB) StoreVtb(uid string) {
|
||||
return
|
||||
}
|
||||
// 自定义Header
|
||||
req.Header.Set("User-Agent", randua())
|
||||
req.Header.Set("User-Agent", web.RandUA())
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
@@ -335,19 +336,3 @@ func (vdb *VtbDB) StoreVtb(uid string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var agent = [...]string{
|
||||
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0",
|
||||
"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Opera/9.80 (Windows NT 6.1; U; en) Presto/2.8.131 Version/11.11",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; 360SE)",
|
||||
"Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
|
||||
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; The World)",
|
||||
"User-Agent,Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
"User-Agent, Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Maxthon 2.0)",
|
||||
"User-Agent,Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
|
||||
}
|
||||
|
||||
func randua() string {
|
||||
return agent[rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(agent))]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user