yz-yuki-plugin 2.0.5-4 → 2.0.5-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # 2.0.5
2
+ * 优化获取动态数据
2
3
  * 新增获取B站up数据的随机延迟配置项
3
4
  * 新增puppeteer渲染图片测试脚本
4
5
 
@@ -72,29 +72,31 @@ class BiliTask {
72
72
  // 检查是否已经请求过该 uid
73
73
  if (requestedDataOfUids.has(subInfoOfup.uid)) {
74
74
  resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
75
+ const dynamicData = resp.data?.items || [];
76
+ dynamicList[subInfoOfup.uid] = dynamicData;
75
77
  }
76
78
  else {
77
79
  resp = await this.hendleEventDynamicData(subInfoOfup.uid);
78
- requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
79
- }
80
- if (resp) {
81
- if (resp.code === 0) {
82
- const dynamicData = resp.data?.items || [];
83
- dynamicList[subInfoOfup.uid] = dynamicData;
84
- }
85
- else if (resp.code === -352) {
86
- logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:-352`);
87
- continue;
80
+ if (resp) {
81
+ if (resp.code === 0) {
82
+ requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
83
+ const dynamicData = resp.data?.items || [];
84
+ dynamicList[subInfoOfup.uid] = dynamicData;
85
+ }
86
+ else if (resp.code === -352) {
87
+ logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:-352`);
88
+ continue;
89
+ }
90
+ else if (resp.code !== 0) {
91
+ logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:${resp.code}`);
92
+ return;
93
+ }
88
94
  }
89
- else if (resp.code !== 0) {
90
- logger.error(`获取 ${subInfoOfup.uid} 动态失败,resCode:${resp.code}`);
95
+ else {
96
+ logger.error(`获取 ${subInfoOfup.uid} 动态失败,无响应数据,本次任务终止,待下次任务自动重试`);
91
97
  return;
92
98
  }
93
99
  }
94
- else {
95
- logger.error(`获取 ${subInfoOfup.uid} 动态失败,resp 为空`);
96
- return;
97
- }
98
100
  const chatIds = Array.from(new Set([...Object((chatTypeMap.get(subInfoOfup.uid) && chatTypeMap.get(subInfoOfup.uid).chatIds) || []), chatId]));
99
101
  const bot_id = subInfoOfup.bot_id || [];
100
102
  const { name, type } = subInfoOfup;
@@ -46,14 +46,16 @@ class WeiboTask {
46
46
  // 检查是否已经请求过该 uid
47
47
  if (requestedDataOfUids.has(subInfoOfup.uid)) {
48
48
  resp = requestedDataOfUids.get(subInfoOfup.uid); // 从已请求的映射中获取响应数据
49
+ const dynamicData = resp || [];
50
+ dynamicList[subInfoOfup.uid] = dynamicData;
49
51
  }
50
52
  else {
51
53
  resp = await await new WeiboGetWebData().getBloggerDynamicList(subInfoOfup.uid); // 获取指定 uid 的动态列表
52
- requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
53
- }
54
- if (resp) {
55
- const dynamicData = resp || [];
56
- dynamicList[subInfoOfup.uid] = dynamicData;
54
+ if (resp) {
55
+ requestedDataOfUids.set(subInfoOfup.uid, resp); // 将响应数据存储到映射中
56
+ const dynamicData = resp || [];
57
+ dynamicList[subInfoOfup.uid] = dynamicData;
58
+ }
57
59
  }
58
60
  const chatIds = Array.from(new Set([...Object((chatTypeMap.get(subInfoOfup.uid) && chatTypeMap.get(subInfoOfup.uid).chatIds) || []), chatId]));
59
61
  const bot_id = subInfoOfup.bot_id || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.5-4",
3
+ "version": "2.0.5-5",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  "md5": "^2.3.0",
37
37
  "moment": "^2.30.1",
38
38
  "node-fetch": "^3.3.2",
39
- "puppeteer": "^23.5.3",
39
+ "puppeteer": "^23.6.0",
40
40
  "qrcode": "^1.5.4",
41
41
  "react": "^18.3.1",
42
42
  "react-dom": "^18.3.1",
@@ -68,7 +68,7 @@
68
68
  "node-fetch": "^3.3.2",
69
69
  "postcss": "^8.4.47",
70
70
  "prettier": "^3.3.3",
71
- "puppeteer": "^23.5.3",
71
+ "puppeteer": "^23.6.0",
72
72
  "qrcode": "^1.5.4",
73
73
  "react": "^18.3.1",
74
74
  "react-dom": "^18.3.1",
@@ -77,7 +77,7 @@
77
77
  "ts-node": "^10.9.2",
78
78
  "tsx": "^4.19.0",
79
79
  "typescript": "^5.5.4",
80
- "yunzaijs": "^1.0.0-rc.4"
80
+ "yunzaijs": "^1.0.0-rc.5"
81
81
  },
82
82
  "files": [
83
83
  "public",