yz-yuki-plugin 2.0.6-7 → 2.0.6-9

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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  # 🚩运行环境:
13
13
  1. 系统:
14
14
  * windows 10/11+,
15
- * Linux推荐:Ubuntu 24.04.1 LTS+, CentOS Stream 8 +, Debian 12+, Fedora 35+
15
+ * Linux推荐:CentOS Stream 8 +, Debian 12+, Fedora 35+
16
16
 
17
17
  2. node v22+ 下载地址:https://nodejs.org/zh-cn/download/
18
18
 
@@ -7,7 +7,8 @@ import { readSyncCookie, cookieWithBiliTicket } from './bilibili.main.models.js'
7
7
  async function getWebId(uid) {
8
8
  const w_webid_key = 'Yz:yuki:bili:w_webid';
9
9
  const w_webid = await Redis.get(w_webid_key);
10
- if (w_webid) {
10
+ const keyTTL = await Redis.ttl(w_webid_key);
11
+ if (w_webid && keyTTL < 259200) {
11
12
  return String(w_webid);
12
13
  }
13
14
  else {
@@ -28,8 +29,10 @@ async function getWebId(uid) {
28
29
  const decoded__RENDER_DATA__JsonString = decodeURIComponent(__RENDER_DATA__[1]);
29
30
  const accessIdRegex = /"access_id":"(.*?)"/;
30
31
  const access_id = decoded__RENDER_DATA__JsonString.match(accessIdRegex);
31
- if (access_id && access_id[1]) {
32
- await Redis.set(w_webid_key, access_id[1], { EX: 43197 * 1000 });
32
+ const ExpirationTimeRegex = /document.getElementById\("__RENDER_DATA__"\).*?setTimeout\(function\(\)\s*{window.location.reload\(true\);},\s*(\d+)\s*\*\s*(\d+)\);<\/script>/;
33
+ const ExpirationTime = htmlContent.match(ExpirationTimeRegex);
34
+ if (access_id && access_id[1] && ExpirationTime && ExpirationTime[1]) {
35
+ await Redis.set(w_webid_key, access_id[1], { EX: Number(ExpirationTime[1]) });
33
36
  return String(access_id[1]);
34
37
  }
35
38
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.6-7",
3
+ "version": "2.0.6-9",
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.11.1",
39
+ "puppeteer": "^24.1.0",
40
40
  "qrcode": "^1.5.4",
41
41
  "react": "^18.3.1",
42
42
  "react-dom": "^18.3.1",
@@ -70,7 +70,7 @@
70
70
  "node-fetch": "^3.3.2",
71
71
  "postcss": "^8.4.47",
72
72
  "prettier": "^3.4.2",
73
- "puppeteer": "^23.11.1",
73
+ "puppeteer": "^24.1.0",
74
74
  "qrcode": "^1.5.4",
75
75
  "react": "^18.3.1",
76
76
  "react-dom": "^18.3.1",
@@ -107,6 +107,6 @@
107
107
  "registry": "https://registry.npmjs.org"
108
108
  },
109
109
  "engines": {
110
- "node": ">=16.14.0"
110
+ "node": ">=20"
111
111
  }
112
112
  }