MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / GetCookies

Method GetCookies

client/ticket.go:86–122  ·  view source on GitHub ↗
(domain string)

Source from the content-addressed store, hash-verified

84}
85
86func (c *QQClient) GetCookies(domain string) (*Cookies, error) {
87 skey, err := c.GetSkey()
88 if err != nil {
89 return nil, err
90 }
91 var token string
92 if tokenTime, ok := c.ticket.psKeys.Load(domain); ok {
93 if time.Now().Before(tokenTime.expireTime) {
94 token = tokenTime.key
95 } else {
96 cookies, err := c.FetchCookies([]string{domain})
97 if err != nil {
98 return nil, err
99 }
100 token = cookies[0]
101 c.ticket.psKeys.Store(domain, &keyInfo{
102 key: token,
103 expireTime: time.Now().Add(24 * time.Hour),
104 })
105 }
106 } else {
107 cookies, err := c.FetchCookies([]string{domain})
108 if err != nil {
109 return nil, err
110 }
111 token = cookies[0]
112 c.ticket.psKeys.Store(domain, &keyInfo{
113 key: token,
114 expireTime: time.Now().Add(24 * time.Hour),
115 })
116 }
117 return &Cookies{
118 uin: c.Uin,
119 SKey: skey,
120 PsKey: token,
121 }, nil
122}
123
124func GTK(s string) int {
125 hash := 5381

Callers 4

buildUploadSessionReqMethod · 0.95
UploadGroupAlbumPhotoMethod · 0.95
UploadGroupAlbumVideoMethod · 0.95
SendRequestWithCookieMethod · 0.95

Calls 2

GetSkeyMethod · 0.95
FetchCookiesMethod · 0.95

Tested by

no test coverage detected