Skip to content

Commit

Permalink
optimize: risk code -352
Browse files Browse the repository at this point in the history
  • Loading branch information
snowtafir committed Oct 23, 2024
1 parent c18f386 commit 89e4bbd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
19 changes: 9 additions & 10 deletions models/bilibili/bilibili.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ export class BiliApi {
/**header */
static BILIBILI_HEADERS = {
'Accept': '*/*',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding': 'gzip, deflate, br',
'Content-type': 'application/json;charset=UTF-8',
'Accept-Language': 'zh-CN,en-US;q=0.5',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Cookie': '',
'pragma': 'no-cache',
'Cache-control': 'max-age=0',
Expand All @@ -41,15 +40,15 @@ export class BiliApi {
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Sec-Fetch-User': '?0',
'Priority': 'u=4',
'TE': 'trailers',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0'
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0'
};
/**Login header */
static BIlIBILI_LOGIN_HEADERS = {
'Accept': '*/*',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,en-US;q=0.5',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'DNT': '1',
'Sec-GPC': '1',
'Upgrade-Insecure-Requests': '1',
Expand All @@ -62,8 +61,8 @@ export class BiliApi {
/**FullArticle header */
static BILIBILI_ARTICLE_HEADERS = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,en-US;q=0.5',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Content-type': 'text/html; charset=utf-8',
'Cookie': '',
'pragma': 'no-cache',
Expand All @@ -77,6 +76,6 @@ export class BiliApi {
'Sec-Fetch-User': '?1',
'TE': 'trailers',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0'
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0'
};
}
4 changes: 2 additions & 2 deletions models/bilibili/bilibili.get.web.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class BiliGetWebData {
headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
Cookie: `${cookie}`,
Host: `api.bilibili.com`,
Origin: 'https://www.bilibili.com',
Referer: `https://www.bilibili.com/`
Origin: 'https://space.bilibili.com',
Referer: `https://space.bilibili.com/${uid}/dynamic`
})
});
return res;
Expand Down
4 changes: 2 additions & 2 deletions models/bilibili/bilibili.task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ export class BiliTask {
continue;
} else if (resp.code !== 0) {
logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:${resp.code}`);
continue;
return;
}
} else {
logger.error(`获取 ${subInfoOfup.uid} 动态失败,无响应数据,请待下次任务自动重试`);
continue;
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yuki-plugin",
"version": "2.0.5-7",
"version": "2.0.5-8",
"author": "snowtafir",
"description": "优纪插件,yunzai-V4 关于 微博推送、B站推送 等功能的拓展插件",
"main": "./index",
Expand Down

0 comments on commit 89e4bbd

Please sign in to comment.