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

Method buildUploadSessionReq

client/album.go:129–228  ·  view source on GitHub ↗
(param *uploadSessionParam)

Source from the content-addressed store, hash-verified

127}
128
129func (c *QQClient) buildUploadSessionReq(param *uploadSessionParam) (*groupAlbumUploadReq, int64, error) {
130 timeStamp := time.Now().Unix()
131 cookies, err := c.GetCookies("qzone.qq.com")
132 if err != nil {
133 return nil, timeStamp, err
134 }
135 reqBody := &groupAlbumUploadReq{
136 ControlReq: []controlReq{
137 {
138 Uin: strconv.Itoa(int(c.Uin)),
139 Token: token{
140 Type: 4,
141 Data: cookies.PsKey,
142 Appid: 5,
143 },
144 Appid: param.UploadType.ReqSessionAppID,
145 Checksum: fmt.Sprintf("%x", param.CheckSum),
146 CheckType: param.UploadType.ReqCheckType,
147 FileLen: param.Size,
148 Env: env{
149 Refer: param.UploadType.ReqRefer,
150 DeviceInfo: "h5",
151 },
152 Model: 0,
153 Cmd: param.UploadType.ReqSessionCmd,
154 },
155 },
156 }
157 //nolint
158 switch param.UploadType.ResourceType {
159 case ResourceTypePhoto:
160 reqBody.ControlReq[0].BizReq = imgBizReq{
161 commonBizReq: commonBizReq{
162 SPicTitle: param.FileName,
163 SAlbumName: param.AlbumName,
164 SAlbumID: param.AlbumID,
165 IBatchID: int(timeStamp),
166 },
167 INeedFeeds: 1,
168 IUploadTime: int(timeStamp),
169 MapExt: mapExt{
170 Appid: "qun",
171 Userid: strconv.Itoa(int(param.GroupUin)),
172 },
173 }
174 case ResourceTypeVideo:
175 reqBody.ControlReq[0].BizReq = videoBizReq{
176 commonBizReq: commonBizReq{
177 SPicTitle: param.FileName,
178 IUploadType: 3,
179 },
180 STitle: param.FileName,
181 IUploadTime: int(timeStamp),
182 IPlayTime: 6077.000, // TODO: do we really need a real video length?
183 IIsNew: 111,
184 VideoExtInfo: videoExtInfo{
185 VideoType: "3",
186 DomainID: "5",

Callers 1

Calls 1

GetCookiesMethod · 0.95

Tested by

no test coverage detected