mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: set p_skey cookie
This commit is contained in:
parent
103bf94170
commit
7cafbdfae5
@ -25,6 +25,7 @@ export class WebApi{
|
|||||||
public async getGroupDigest(groupCode: string){
|
public async getGroupDigest(groupCode: string){
|
||||||
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?random=665&X-CROSS-ORIGIN=fetch&group_code=${groupCode}&page_start=0&page_limit=20`
|
const url = `https://qun.qq.com/cgi-bin/group_digest/digest_list?random=665&X-CROSS-ORIGIN=fetch&group_code=${groupCode}&page_start=0&page_limit=20`
|
||||||
const res = await this.request(url)
|
const res = await this.request(url)
|
||||||
|
log(res.headers)
|
||||||
return await res.json()
|
return await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +50,9 @@ export class WebApi{
|
|||||||
const match = cookie.match(pskeyRegex);
|
const match = cookie.match(pskeyRegex);
|
||||||
const pskeyValue = match ? match[1] : null;
|
const pskeyValue = match ? match[1] : null;
|
||||||
WebApi.pskey = pskeyValue;
|
WebApi.pskey = pskeyValue;
|
||||||
cookie = cookie.replace(/skey=.*?/, `skey=${WebApi.skey}`);
|
if (cookie.indexOf("skey=;") !== -1) {
|
||||||
|
cookie = cookie.replace("skey=;", `skey=${WebApi.skey};`);
|
||||||
|
}
|
||||||
WebApi.cookie = cookie;
|
WebApi.cookie = cookie;
|
||||||
// for(const kv of WebApi.cookie.split(";")){
|
// for(const kv of WebApi.cookie.split(";")){
|
||||||
// const [key, value] = kv.split("=");
|
// const [key, value] = kv.split("=");
|
||||||
@ -72,7 +75,7 @@ export class WebApi{
|
|||||||
let _headers: Record<string, string> = {
|
let _headers: Record<string, string> = {
|
||||||
...this.defaultHeaders, ...headers,
|
...this.defaultHeaders, ...headers,
|
||||||
"Cookie": WebApi.cookie,
|
"Cookie": WebApi.cookie,
|
||||||
// credentials: 'include'
|
credentials: 'include'
|
||||||
}
|
}
|
||||||
log("request", url, _headers)
|
log("request", url, _headers)
|
||||||
const options = {
|
const options = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user