forked from Sora233/DDBOT
/
getAttentionList.go
38 lines (35 loc) · 929 Bytes
/
getAttentionList.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package bilibili
import (
"github.com/starskim/DDBOT/proxy_pool"
"github.com/starskim/DDBOT/requests"
"github.com/starskim/DDBOT/utils"
"time"
)
const (
PathGetAttentionList = "/feed/v1/feed/get_attention_list"
)
func GetAttentionList() (*GetAttentionListResponse, error) {
if !IsVerifyGiven() {
return nil, ErrVerifyRequired
}
st := time.Now()
defer func() {
ed := time.Now()
logger.WithField("FuncName", utils.FuncName()).Tracef("cost %v", ed.Sub(st))
}()
url := BPath(PathGetAttentionList)
var opts []requests.Option
opts = append(opts,
requests.ProxyOption(proxy_pool.PreferNone),
AddUAOption(),
requests.TimeoutOption(time.Second*10),
delete412ProxyOption,
)
opts = append(opts, GetVerifyOption()...)
getAttentionListResp := new(GetAttentionListResponse)
err := requests.Get(url, nil, getAttentionListResp, opts...)
if err != nil {
return nil, err
}
return getAttentionListResp, nil
}