]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
更新api
authorqydysky <32743305+qydysky@users.noreply.github.com>
Tue, 17 Jan 2023 16:53:10 +0000 (00:53 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Tue, 17 Jan 2023 16:53:10 +0000 (00:53 +0800)
F/api.go
Json/search.go
cmd/cmd.go

index 6a57c22487ba9845dba4b8d4fdc5ae8e298ca386..3832110d8f9588b0dc4b2c6727fd1ac5245698d9 100644 (file)
--- a/F/api.go
+++ b/F/api.go
@@ -2521,7 +2521,7 @@ func SearchUP(s string) (list []searchresult) {
                })
 
                if err := req.Reqf(reqf.Rval{
-                       Url:   "https://api.bilibili.com/x/web-interface/search/type?__refresh__=true&_extra=&context=&page=1&page_size=10&order=online&duration=&from_source=&from_spmid=333.337&platform=pc&highlight=1&single_column=0&category_id=&search_type=live_user&dynamic_offset=0&preload=true&com2co=true&keyword=" + url.PathEscape(s),
+                       Url:   "https://api.bilibili.com/x/web-interface/wbi/search/type?page=1&page_size=10&order=online&platform=pc&search_type=live_user&keyword=" + url.PathEscape(s),
                        Proxy: c.C.Proxy,
                        Header: map[string]string{
                                `Cookie`: reqf.Map_2_Cookies_String(Cookie),
@@ -2546,7 +2546,7 @@ func SearchUP(s string) (list []searchresult) {
                        }
                }
 
-               if j.Data.Numresults == 0 {
+               if j.Data.NumResults == 0 {
                        apilog.L(`I: `, `没有匹配`)
                        return
                }
index 132890ed3627cb46761126627719f7c957d02409..6cbc01bdb236cbe16bc755f63ff3a57d26fe08c0 100644 (file)
@@ -8,12 +8,13 @@ type Search struct {
                Seid           string `json:"seid"`
                Page           int    `json:"page"`
                Pagesize       int    `json:"pagesize"`
-               Numresults     int    `json:"numResults"`
-               Numpages       int    `json:"numPages"`
+               NumResults     int    `json:"numResults"`
+               NumPages       int    `json:"numPages"`
                SuggestKeyword string `json:"suggest_keyword"`
                RqtType        string `json:"rqt_type"`
                CostTime       struct {
                        ParamsCheck         string `json:"params_check"`
+                       IsRiskQuery         string `json:"is_risk_query"`
                        IllegalHandler      string `json:"illegal_handler"`
                        DeserializeResponse string `json:"deserialize_response"`
                        AsResponseFormat    string `json:"as_response_format"`
@@ -24,19 +25,25 @@ type Search struct {
                        Total               string `json:"total"`
                        MainHandler         string `json:"main_handler"`
                } `json:"cost_time"`
-               ExpList interface{} `json:"exp_list"`
-               EggHit  int         `json:"egg_hit"`
-               Result  []struct {
+               ExpList struct {
+                       Num5501 bool `json:"5501"`
+                       Num6609 bool `json:"6609"`
+                       Num7708 bool `json:"7708"`
+               } `json:"exp_list"`
+               EggHit int `json:"egg_hit"`
+               Result []struct {
                        RankOffset int      `json:"rank_offset"`
                        UID        int      `json:"uid"`
                        Tags       string   `json:"tags"`
                        Type       string   `json:"type"`
                        LiveTime   string   `json:"live_time"`
                        HitColumns []string `json:"hit_columns"`
+                       CateName   string   `json:"cate_name"`
                        LiveStatus int      `json:"live_status"`
                        Area       int      `json:"area"`
                        IsLive     bool     `json:"is_live"`
                        Uname      string   `json:"uname"`
+                       AreaV2ID   int      `json:"area_v2_id"`
                        Uface      string   `json:"uface"`
                        RankIndex  int      `json:"rank_index"`
                        RankScore  int      `json:"rank_score"`
@@ -44,5 +51,7 @@ type Search struct {
                        Attentions int      `json:"attentions"`
                } `json:"result"`
                ShowColumn int `json:"show_column"`
+               InBlackKey int `json:"in_black_key"`
+               InWhiteKey int `json:"in_white_key"`
        } `json:"data"`
-}
\ No newline at end of file
+}
index d9389708cde91037a2bb0e1365c882259a8d731e..ffdf567de06e719aa039a3ff841b166f524c4f07 100644 (file)
@@ -28,24 +28,24 @@ func Cmd() {
                        fmt.Println("切换房间->输入数字回车")
                        if c.C.Roomid == 0 {
                                if _, ok := c.C.Cookie.LoadV(`bili_jct`).(string); ok {
-                                       fmt.Println("查看直播中主播->输入' live'回车")
+                                       fmt.Println("查看直播中主播->输入' liv'回车")
                                        fmt.Println("查看历史观看主播->输入' his'回车")
                                } else {
                                        fmt.Println("登陆->输入' login'回车")
                                }
-                               fmt.Println("搜索主播->输入' search关键词'回车")
+                               fmt.Println("搜索主播->输入' sea关键词'回车")
                                fmt.Println("其他输出隔断不影响")
                                fmt.Print("\n")
                                continue
                        }
                        if _, ok := c.C.Cookie.LoadV(`bili_jct`).(string); ok {
                                fmt.Println("发送弹幕->输入' 字符串'回车")
-                               fmt.Println("查看直播中主播->输入' live'回车")
+                               fmt.Println("查看直播中主播->输入' liv'回车")
                        } else {
                                fmt.Println("登陆->输入' login'回车")
                        }
                        fmt.Println("重载弹幕->输入' reload'回车")
-                       fmt.Println("搜索主播->输入' search关键词'回车")
+                       fmt.Println("搜索主播->输入' sea关键词'回车")
                        fmt.Println("房间信息->输入' room'回车")
                        fmt.Println("开始结束录制->输入' rec'回车")
                        fmt.Println("其他输出隔断不影响")
@@ -76,27 +76,35 @@ func Cmd() {
                                }
                                continue
                        }
-                       //直播间切换
-                       if strings.Contains(inputs, ` live`) {
-                               if _, ok := c.C.Cookie.LoadV(`bili_jct`).(string); !ok {
-                                       cmdlog.L(`W: `, "尚未登陆,未能获取关注主播")
+                       //进入房间
+                       if strings.Contains(inputs, ` to`) {
+                               if len(inputs) == 3 {
+                                       cmdlog.L(`W: `, "未输入进入序号")
                                        continue
                                }
+
                                fmt.Print("\n")
-                               if len(inputs) > 5 {
-                                       if room, ok := liveList[inputs]; ok {
-                                               c.C.Roomid = room
-                                               c.C.Danmu_Main_mq.Push_tag(`change_room`, nil)
-                                               continue
-                                       }
+                               if room, ok := liveList[inputs]; ok {
+                                       c.C.Roomid = room
+                                       c.C.Danmu_Main_mq.Push_tag(`change_room`, nil)
+                                       continue
+                               } else {
                                        cmdlog.L(`W: `, "输入错误", inputs)
+                               }
+                               continue
+                       }
+                       //直播间切换
+                       if strings.Contains(inputs, ` liv`) {
+                               if _, ok := c.C.Cookie.LoadV(`bili_jct`).(string); !ok {
+                                       cmdlog.L(`W: `, "尚未登陆,未能获取关注主播")
                                        continue
                                }
+                               fmt.Print("\n")
                                for k, v := range F.Feed_list() {
-                                       liveList[` live`+strconv.Itoa(k)] = v.Roomid
+                                       liveList[` to`+strconv.Itoa(k)] = v.Roomid
                                        fmt.Printf("%d\t%s(%d)\n\t\t\t%s\n", k, v.Uname, v.Roomid, v.Title)
                                }
-                               fmt.Println("回复' live(序号)'进入直播间")
+                               fmt.Println("回复' to(序号)'进入直播间")
                                fmt.Print("\n")
                                continue
                        }
@@ -107,24 +115,15 @@ func Cmd() {
                                        continue
                                }
                                fmt.Print("\n")
-                               if len(inputs) > 4 {
-                                       if room, ok := liveList[inputs]; ok {
-                                               c.C.Roomid = room
-                                               c.C.Danmu_Main_mq.Push_tag(`change_room`, nil)
-                                               continue
-                                       }
-                                       cmdlog.L(`W: `, "输入错误", inputs)
-                                       continue
-                               }
                                for k, v := range F.GetHisStream() {
-                                       liveList[` his`+strconv.Itoa(k)] = v.Roomid
+                                       liveList[` to`+strconv.Itoa(k)] = v.Roomid
                                        if v.LiveStatus == 1 {
                                                fmt.Printf("%d\t%s\t%s(%d)\n\t\t\t%s\n", k, `☁`, v.Uname, v.Roomid, v.Title)
                                        } else {
                                                fmt.Printf("%d\t%s\t%s(%d)\n\t\t\t%s\n", k, ` `, v.Uname, v.Roomid, v.Title)
                                        }
                                }
-                               fmt.Println("回复' his(序号)'进入直播间")
+                               fmt.Println("回复' to(序号)'进入直播间")
                                fmt.Print("\n")
                                continue
                        }
@@ -140,22 +139,22 @@ func Cmd() {
                                continue
                        }
                        //搜索主播
-                       if strings.Contains(inputs, ` search`) {
-                               if len(inputs) == 7 {
+                       if strings.Contains(inputs, ` sea`) {
+                               if len(inputs) == 4 {
                                        cmdlog.L(`W: `, "未输入搜索内容")
                                        continue
                                }
 
                                fmt.Print("\n")
-                               for k, v := range F.SearchUP(inputs[7:]) {
-                                       liveList[` live`+strconv.Itoa(k)] = v.Roomid
+                               for k, v := range F.SearchUP(inputs[4:]) {
+                                       liveList[` to`+strconv.Itoa(k)] = v.Roomid
                                        if v.Is_live {
-                                               fmt.Printf("%d\t%s\t%s\n", k, `☁`, v.Uname)
+                                               fmt.Printf("%d\t%s\t%s(%d)\n", k, `☁`, v.Uname, v.Roomid)
                                        } else {
-                                               fmt.Printf("%d\t%s\t%s\n", k, ` `, v.Uname)
+                                               fmt.Printf("%d\t%s\t%s(%d)\n", k, ` `, v.Uname, v.Roomid)
                                        }
                                }
-                               fmt.Println("回复' live(序号)'进入直播间")
+                               fmt.Println("回复' to(序号)'进入直播间")
                                fmt.Print("\n")
 
                                continue