MCPcopy Create free account
hub / github.com/FloatTech/AnimeAPI / SearchUser

Function SearchUser

bilibili/api.go:22–52  ·  view source on GitHub ↗

SearchUser 查找b站用户

(cookiecfg *CookieConfig, keyword string)

Source from the content-addressed store, hash-verified

20
21// SearchUser 查找b站用户
22func SearchUser(cookiecfg *CookieConfig, keyword string) (r []SearchResult, err error) {
23 client := &http.Client{}
24 req, err := http.NewRequest("GET", fmt.Sprintf(SearchUserURL, keyword), nil)
25 if err != nil {
26 return
27 }
28 if cookiecfg != nil {
29 cookie := ""
30 cookie, err = cookiecfg.Load()
31 if err != nil {
32 return
33 }
34 req.Header.Add("cookie", cookie)
35 }
36 res, err := client.Do(req)
37 if err != nil {
38 return
39 }
40 defer res.Body.Close()
41 if res.StatusCode != http.StatusOK {
42 err = errors.New("status code: " + strconv.Itoa(res.StatusCode))
43 return
44 }
45 var sd SearchData
46 err = json.NewDecoder(res.Body).Decode(&sd)
47 if err != nil {
48 return
49 }
50 r = sd.Data.Result
51 return
52}
53
54// GetVtbDetail 查找vtb信息
55func GetVtbDetail(uid string) (result VtbDetail, err error) {

Callers

nothing calls this directly

Calls 1

LoadMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…