feat(utils): html request header
This commit is contained in:
parent
73892a5f40
commit
4dd3daf909
21
src/utils.ts
21
src/utils.ts
@ -4,6 +4,23 @@ import { chunk } from 'lodash';
|
|||||||
|
|
||||||
export const BASE_URL = `https://kaiqiuwang.cc`;
|
export const BASE_URL = `https://kaiqiuwang.cc`;
|
||||||
|
|
||||||
|
const htmlRequestHeaders = {
|
||||||
|
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
||||||
|
"accept-language": "zh-CN,zh;q=0.8",
|
||||||
|
"cache-control": "max-age=0",
|
||||||
|
"priority": "u=0, i",
|
||||||
|
"sec-ch-ua": "\"Not(A:Brand\";v=\"8\", \"Chromium\";v=\"144\", \"Brave\";v=\"144\"",
|
||||||
|
"sec-ch-ua-mobile": "?0",
|
||||||
|
"sec-ch-ua-platform": "\"Windows\"",
|
||||||
|
"sec-fetch-dest": "document",
|
||||||
|
"sec-fetch-mode": "navigate",
|
||||||
|
"sec-fetch-site": "none",
|
||||||
|
"sec-fetch-user": "?1",
|
||||||
|
"sec-gpc": "1",
|
||||||
|
"upgrade-insecure-requests": "1",
|
||||||
|
"cookie": "SECKEY_ABVK=oTGgqH4ypGPFVdQ3J9K7PoAOPdZ+8R7CsUzi75gelcg%3D; uchome_sendmail=1"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tagid 俱乐部 ID
|
* @param tagid 俱乐部 ID
|
||||||
*/
|
*/
|
||||||
@ -17,7 +34,7 @@ export async function listEvent(tagid: string): Promise<IEventInfo[]> {
|
|||||||
*/
|
*/
|
||||||
export async function fetchEventListHTML(tagid: string) {
|
export async function fetchEventListHTML(tagid: string) {
|
||||||
const url = `${BASE_URL}/home/space.php?do=mtag&tagid=${tagid}&view=event`;
|
const url = `${BASE_URL}/home/space.php?do=mtag&tagid=${tagid}&view=event`;
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url, { headers: htmlRequestHeaders });
|
||||||
return resp.text() ?? '';
|
return resp.text() ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +66,7 @@ export function parseEventList(html: string) {
|
|||||||
*/
|
*/
|
||||||
export async function fetchEventContentHTML(matchId: string) {
|
export async function fetchEventContentHTML(matchId: string) {
|
||||||
const url = `${BASE_URL}/home/space.php?do=event&id=${matchId}&view=member&status=2`;
|
const url = `${BASE_URL}/home/space.php?do=event&id=${matchId}&view=member&status=2`;
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url, { headers: htmlRequestHeaders });
|
||||||
return resp.text() ?? ''
|
return resp.text() ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user