From 3b666f5da6889cebd08e53fb6e0a96c6f4107028 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Tue, 21 Mar 2023 01:03:30 +0800 Subject: [PATCH] =?utf8?q?Fix=20=E5=AE=9A=E6=97=B6=E6=9B=B4=E6=96=B0LIVE?= =?utf8?q?=5FBUVID?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CV/Var.go | 4 ++-- F/api.go | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CV/Var.go b/CV/Var.go index 01286a3..355c846 100644 --- a/CV/Var.go +++ b/CV/Var.go @@ -55,7 +55,7 @@ type Common struct { Wearing_FansMedal int //当前佩戴的粉丝牌 Token string //弹幕钥 WSURL []string //弹幕链接 - LIVE_BUVID bool //cookies含LIVE_BUVID + LiveBuvidUpdated time.Time //LIVE_BUVID更新时间 Stream_url *url.URL //直播Web服务 Proxy string //全局代理 AcceptQn map[int]string //允许的直播流质量 @@ -133,7 +133,7 @@ func (t *Common) Copy() *Common { Wearing_FansMedal: t.Wearing_FansMedal, Token: t.Token, WSURL: t.WSURL, - LIVE_BUVID: t.LIVE_BUVID, + LiveBuvidUpdated: t.LiveBuvidUpdated, Stream_url: t.Stream_url, Proxy: t.Proxy, AcceptQn: syncmap.Copy(t.AcceptQn), diff --git a/F/api.go b/F/api.go index db79ce5..dc1a30c 100644 --- a/F/api.go +++ b/F/api.go @@ -198,7 +198,7 @@ func (c *GetFunc) Get(key string) { // return c.VERSION != `2.0.11` // }, `LIVE_BUVID`: func() bool { //LIVE_BUVID - return c.LIVE_BUVID + return c.LiveBuvidUpdated.After(time.Now().Add(-time.Hour)) }, `Silver_2_coin`: func() bool { //银瓜子2硬币 return true @@ -564,7 +564,7 @@ func (t *GetFunc) getRoomPlayInfo() (missKey []string) { if t.Roomid == 0 { missKey = append(missKey, `Roomid`) } - if !t.LIVE_BUVID { + if t.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if len(missKey) > 0 { @@ -638,7 +638,7 @@ func (t *GetFunc) getRoomPlayInfoByQn() (missKey []string) { if t.Roomid == 0 { missKey = append(missKey, `Roomid`) } - if !t.LIVE_BUVID { + if t.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if len(missKey) > 0 { @@ -731,7 +731,7 @@ func (c *GetFunc) getDanmuInfo() (missKey []string) { if c.Roomid == 0 { missKey = append(missKey, `Roomid`) } - if !c.LIVE_BUVID { + if c.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if len(missKey) > 0 { @@ -992,7 +992,7 @@ func (c *GetFunc) Get_guardNum() (missKey []string) { if c.Roomid == 0 { missKey = append(missKey, `Roomid`) } - if !c.LIVE_BUVID { + if c.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if len(missKey) > 0 { @@ -1572,7 +1572,7 @@ func Get_weared_medal() (item J.GetWearedMedal_Data) { func (c *GetFunc) CheckSwitch_FansMedal() (missKey []string) { - if !c.LIVE_BUVID { + if c.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if c.UpUid == 0 { @@ -1805,11 +1805,11 @@ func Dosign() { func (c *GetFunc) Get_LIVE_BUVID() (missKey []string) { apilog := apilog.Base_add(`LIVE_BUVID`) //.L(`T: `, `获取`) - if live_buvid, ok := c.Cookie.LoadV(`LIVE_BUVID`).(string); ok && live_buvid != `` { - apilog.L(`T: `, `存在`) - c.LIVE_BUVID = true - return - } + // if live_buvid, ok := c.Cookie.LoadV(`LIVE_BUVID`).(string); ok && live_buvid != `` { + // apilog.L(`T: `, `存在`) + // c.LIVE_BUVID = true + // return + // } //当房间处于特殊活动状态时,将会获取不到,此处使用了若干著名up主房间进行尝试 roomIdList := []string{ @@ -1868,7 +1868,7 @@ func (c *GetFunc) Get_LIVE_BUVID() (missKey []string) { CookieSet([]byte(reqf.Map_2_Cookies_String(Cookie))) - c.LIVE_BUVID = true + c.LiveBuvidUpdated = time.Now() return } @@ -1963,7 +1963,7 @@ func Gift_list() (list []Gift_list_type_Data_List) { func (c *GetFunc) Silver_2_coin() (missKey []string) { apilog := apilog.Base_add(`银瓜子=>硬币`) - if !c.LIVE_BUVID { + if c.LiveBuvidUpdated.Before(time.Now().Add(-time.Hour)) { missKey = append(missKey, `LIVE_BUVID`) } if len(missKey) > 0 { -- 2.39.2