yz-yuki-plugin 2.0.5-8 → 2.0.6-0

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,10 @@
1
+ # 2.0.6
2
+ * 优化文字动态图片资源的发送
3
+ * 依赖升级
4
+
1
5
  # 2.0.5
6
+ * 优化ck
7
+ * 新增 User-Agent 配置项
2
8
  * 优化获取动态数据
3
9
  * 新增获取B站up数据的随机延迟配置项
4
10
  * 新增puppeteer渲染图片测试脚本
@@ -8,6 +8,12 @@ pushStatus: 1
8
8
  # "0 5,35,51 * * * *" #每小时固定第5分0秒、第35分0秒、第51分0秒检测一次,共3次/h
9
9
  pushTime: '*/23 * * * *'
10
10
 
11
+ # 请求头 User-Agent 列表。如出现 -352 风控,可尝试更换请求头,请根据需要自行添加或修改。可设置多个请求头,每次重启后会随机选择一个。获取方法请浏览器自行搜索。
12
+ userAgentList:
13
+ - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
14
+ #- Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
15
+ #- Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0
16
+
11
17
  # 推送监测间隔,单位为秒,默认7200秒即2小时,即以当前时间为基准,监测过去2小时内的动态,并推送。取值范围:3600-36000秒,即过去的1-10h。应大于pushTime的周期。
12
18
  interval: 7200
13
19
 
@@ -1,11 +1,11 @@
1
1
  import JSON from 'json5';
2
2
  import lodash from 'lodash';
3
3
  import { Messages, Bot, Redis } from 'yunzaijs';
4
- import { BiliQuery } from '../models/bilibili/bilibili.query.js';
5
- import { BiliTask } from '../models/bilibili/bilibili.task.js';
4
+ import { BiliQuery } from '../models/bilibili/bilibili.main.query.js';
5
+ import { BiliTask } from '../models/bilibili/bilibili.main.task.js';
6
6
  import Config from '../utils/config.js';
7
- import { BiliGetWebData } from '../models/bilibili/bilibili.get.web.data.js';
8
- import { applyLoginQRCode, pollLoginQRCode, saveLoginCookie, postGateway, exitBiliLogin, checkBiliLogin, readSavedCookieItems, saveLocalBiliCk, readSyncCookie, getNewTempCk, readTempCk } from '../models/bilibili/bilibili.models.js';
7
+ import { BiliGetWebData } from '../models/bilibili/bilibili.main.get.web.data.js';
8
+ import { applyLoginQRCode, pollLoginQRCode, saveLoginCookie, postGateway, exitBiliLogin, checkBiliLogin, readSavedCookieItems, saveLocalBiliCk, readSyncCookie, getNewTempCk, saveTempCk } from '../models/bilibili/bilibili.main.models.js';
9
9
 
10
10
  const message = new Messages('message');
11
11
  let biliPushData = Config.getConfigData('config', 'bilibili', 'push');
@@ -171,9 +171,6 @@ message.use(async (e) => {
171
171
  try {
172
172
  const token = await applyLoginQRCode(e);
173
173
  let biliLoginCk = await pollLoginQRCode(e, token);
174
- //let _uuid = readSavedCookieItems(biliLoginCk, ['_uuid'])
175
- //const buvid_fp = await get_buvid_fp(_uuid);
176
- //biliLoginCk = buvid_fp + biliLoginCk;
177
174
  if (lodash.trim(biliLoginCk).length != 0) {
178
175
  await saveLoginCookie(e, biliLoginCk);
179
176
  e.reply(`get bilibili LoginCk:成功!`);
@@ -257,9 +254,7 @@ message.use(async (e) => {
257
254
  return;
258
255
  }
259
256
  //筛选ck
260
- localBiliCookie = await readSavedCookieItems(localBiliCookie, ['buvid3', 'buvid4', '_uuid', 'SESSDATA', 'DedeUserID', 'DedeUserID__ckMd5', 'bili_jct', 'b_nut', 'b_lsid'], false);
261
- //const buvid_fp = await get_buvid_fp(param._uuid)
262
- //localBiliCookie = buvid_fp + localBiliCookie; //添加buvid_fp值
257
+ localBiliCookie = await readSavedCookieItems(localBiliCookie, ['buvid3', 'buvid4', '_uuid', 'SESSDATA', 'DedeUserID', 'DedeUserID__ckMd5', 'bili_jct', 'b_nut', 'b_lsid', 'buvid_fp', 'sid'], false);
263
258
  await saveLocalBiliCk(localBiliCookie);
264
259
  logger.mark(`${e.logFnc} 保存B站cookie成功 [UID:${param.DedeUserID}]`);
265
260
  let uidMsg = [`好耶~绑定B站cookie成功:\n${param.DedeUserID}`];
@@ -322,9 +317,17 @@ message.use(async (e) => {
322
317
  /** 删除并刷新redis缓存的临时B站ck */
323
318
  message.use(async (e) => {
324
319
  try {
325
- await getNewTempCk();
326
- let newTempCk = await readTempCk();
327
- if (newTempCk !== null && newTempCk !== undefined && newTempCk.length !== 0 && newTempCk !== '') {
320
+ const newTempCk = await getNewTempCk();
321
+ if (newTempCk) {
322
+ await saveTempCk(newTempCk);
323
+ const result = await postGateway(newTempCk);
324
+ const data = await result.data; // 解析校验结果
325
+ if (data?.code !== 0) {
326
+ logger?.error(`优纪插件:tempCK,Gateway校验失败:${JSON.stringify(data)}`);
327
+ }
328
+ else if (data?.code === 0) {
329
+ logger?.mark(`优纪插件:tempCK,Gateway校验成功:${JSON.stringify(data)}`);
330
+ }
328
331
  e.reply(`~yuki-plugin:\n临时b站ck刷新成功~❤~\n接下来如果获取动态失败,请重启bot(手动或发送指令 #重启)刷新状态~\n如果重启续仍不可用,请考虑 #优纪添加b站登录 吧~`);
329
332
  }
330
333
  else {
@@ -445,7 +448,7 @@ message.use(async (e) => {
445
448
  }
446
449
  const message = [`昵称:${data?.name}`, `\n性别:${data?.sex}`, `\n等级:${data?.level}`];
447
450
  if (data.live_room) {
448
- message.push(`***********\n---直播信息---`, `\n直播标题:${data?.live_room?.title}`, `\n直播房间:${data?.live_room?.roomid}`, `\n直播状态:${data?.live_room?.liveStatus ? '直播中' : '未开播'}`, `\n观看人数:${data?.live_room?.watched_show?.num}人`);
451
+ message.push(`\n***********\n---直播信息---`, `\n直播标题:${data?.live_room?.title}`, `\n直播房间:${data?.live_room?.roomid}`, `\n直播状态:${data?.live_room?.liveStatus ? '直播中' : '未开播'}`, `\n观看人数:${data?.live_room?.watched_show?.num}人`);
449
452
  e.reply(`直播链接:${data?.live_room?.url}`);
450
453
  }
451
454
  e.reply(message);
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import Config from './utils/config.js';
4
4
  import path from 'path';
5
5
  import { _paths } from './utils/paths.js';
6
6
  import * as index$1 from './apps/index.js';
7
- import { BiliTask } from './models/bilibili/bilibili.task.js';
7
+ import { BiliTask } from './models/bilibili/bilibili.main.task.js';
8
8
  import { WeiboTask } from './models/weibo/weibo.task.js';
9
9
 
10
10
  const yukiPluginVersion = Config.getPackageJsonKey('version', path.join(_paths.pluginPath, 'package.json'));
@@ -0,0 +1,402 @@
1
+ import Config from '../../utils/config.js';
2
+
3
+ class BiliApi {
4
+ biliConfigData;
5
+ USER_AGENT;
6
+ constructor() {
7
+ this.biliConfigData = Config.getUserConfig('bilibili', 'config');
8
+ this.USER_AGENT = BiliApi.BILIBILI_USER_AGENT;
9
+ this.initialize();
10
+ }
11
+ static BILIBILI_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36';
12
+ //初始化User-Agent
13
+ async initialize() {
14
+ await this.initUserAgent();
15
+ }
16
+ async initUserAgent() {
17
+ const userAgentList = await this.biliConfigData.userAgentList;
18
+ if (userAgentList && userAgentList.length > 0) {
19
+ const randomIndex = Math.floor(Math.random() * userAgentList.length);
20
+ this.USER_AGENT = String(userAgentList[randomIndex]);
21
+ }
22
+ }
23
+ // 将静态常量赋值给实例属性
24
+ get BILIBIL_API() {
25
+ return {
26
+ //获取服务器端RTC时间戳
27
+ biliServerTimeStamp: 'https://api.live.bilibili.com/xlive/open-interface/v1/rtc/getTimestamp',
28
+ //获取动态资源列表 wbi/无wbi parama = { host_mid: uid, timezone_offset: -480, platform: 'web', features: 'itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote', web_location: "333.999", ...getDmImg(), "x-bili-device-req-json": { "platform": "web", "device": "pc" }, "x-bili-web-req-json": { "spm_id": "333.999" }, w_rid, wts }
29
+ biliDynamicInfoList: `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space`,
30
+ //获取关注数与粉丝数 parama = { vmid: uid }
31
+ biliUpFollowFans: `https://api.bilibili.com/x/relation/stat`,
32
+ //通过uid获取up详情 parama = { mid: uid, jsonp: jsonp }
33
+ biliSpaceUserInfo: `https://api.bilibili.com/x/space/acc/info`,
34
+ //parama = { mid: uid, token: '',platform: 'web', web_location: 1550101, w_webid, w_rid, wts }
35
+ biliSpaceUserInfoWbi: `https://api.bilibili.com/x/space/wbi/acc/info`,
36
+ //通过关键词${upKeyword}搜索up主 parama = { keyword: 'upKeyword', page: 1, search_type: 'bili_user', order: 'totalrank', pagesize: 5 }
37
+ biliSearchUp: `https://api.bilibili.com/x/web-interface/search/type`,
38
+ //通过关键词${upKeyword}搜索up主 parama = { keyword: 'upKeyword', page: 1, search_type: 'bili_user', order: 'totalrank' },需要wbi签名
39
+ biliSearchUpWbi: `https://api.bilibili.com/x/web-interface/wbi/search/type`,
40
+ biliLiveStatus: 'https://api.live.bilibili.com/room/v1/Room/get_status_info_by_uids',
41
+ biliCard: 'https://api.bilibili.com/x/web-interface/card',
42
+ biliStat: 'https://api.bilibili.com/x/relation/stat',
43
+ biliLiveUserInfo: 'https://api.live.bilibili.com/live_user/v1/Master/info',
44
+ biliOpusDetail: 'https://api.bilibili.com/x/polymer/web-dynamic/v1/opus/detail'
45
+ };
46
+ }
47
+ /**header */
48
+ get BILIBILI_HEADERS() {
49
+ return {
50
+ 'Accept': '*/*',
51
+ 'Accept-Language': 'zh-CN,en-US;q=0.5',
52
+ 'Connection': 'keep-alive',
53
+ 'Accept-Encoding': 'gzip, deflate, br, zstd',
54
+ 'Cookie': '',
55
+ 'pragma': 'no-cache',
56
+ 'Cache-control': 'max-age=0',
57
+ 'DNT': '1',
58
+ 'Sec-GPC': '1',
59
+ 'sec-ch-ua-platform': '',
60
+ 'sec-ch-ua-mobile': '?0',
61
+ 'Sec-Fetch-Dest': 'empty',
62
+ 'Sec-Fetch-Mode': 'cors',
63
+ 'Sec-Fetch-Site': 'same-site',
64
+ 'Sec-Fetch-User': '?0',
65
+ 'Priority': 'u=4',
66
+ 'TE': 'trailers',
67
+ 'User-Agent': this.USER_AGENT
68
+ };
69
+ }
70
+ /**Login header */
71
+ get BIlIBILI_LOGIN_HEADERS() {
72
+ return {
73
+ 'Accept': '*/*',
74
+ 'Accept-Language': 'zh-CN,en-US;q=0.5',
75
+ 'Accept-Encoding': 'gzip, deflate, br, zstd',
76
+ 'DNT': '1',
77
+ 'Sec-GPC': '1',
78
+ 'Upgrade-Insecure-Requests': '1',
79
+ 'Sec-Fetch-Dest': 'document',
80
+ 'Sec-Fetch-Mode': 'navigate',
81
+ 'Sec-Fetch-Site': 'none',
82
+ 'Sec-Fetch-User': '?1',
83
+ 'TE': 'trailers'
84
+ };
85
+ }
86
+ /**FullArticle header */
87
+ get BILIBILI_ARTICLE_HEADERS() {
88
+ return {
89
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8',
90
+ 'Accept-Language': 'zh-CN,en-US;q=0.5',
91
+ 'Accept-Encoding': 'gzip, deflate, br, zstd',
92
+ 'Content-type': 'text/html; charset=utf-8',
93
+ 'Cookie': '',
94
+ 'pragma': 'no-cache',
95
+ 'Cache-control': 'no-cache',
96
+ 'DNT': '1',
97
+ 'Sec-GPC': '1',
98
+ 'sec-ch-ua-mobile': '?0',
99
+ 'Sec-Fetch-Dest': 'document',
100
+ 'Sec-Fetch-Mode': 'navigate',
101
+ 'Sec-Fetch-Site': 'same-site',
102
+ 'Sec-Fetch-User': '?1',
103
+ 'TE': 'trailers',
104
+ 'Upgrade-Insecure-Requests': '1',
105
+ 'User-Agent': this.USER_AGENT
106
+ };
107
+ }
108
+ get BILIBILI_DYNAMIC_SPACE_HEADERS() {
109
+ return {
110
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
111
+ 'Accept-Encoding': 'gzip, deflate, br, zstd',
112
+ 'Accept-Language': 'zh-CN,en-US;q=0.5',
113
+ 'Connection': 'keep-alive',
114
+ 'Priority': 'u=0, i',
115
+ 'Sec-Fetch-Dest': 'document',
116
+ 'Sec-Fetch-Mode': 'navigate',
117
+ 'Sec-Fetch-Site': 'none',
118
+ 'Sec-Fetch-User': '?1',
119
+ 'Sec-GPC': '1',
120
+ 'Upgrade-Insecure-Requests': '1',
121
+ 'User-Agent': this.USER_AGENT
122
+ };
123
+ }
124
+ /**返回GatWay payload */
125
+ async BILIBILI_BROWSER_DATA(_uuid) {
126
+ return {
127
+ '3064': 1, // ptype, mobile => 2, others => 1
128
+ '5062': `${Date.now()}`, // timestamp
129
+ '03bf': 'https://www.bilibili.com/', // url accessed
130
+ '39c8': '333.999.fp.risk',
131
+ '34f1': '', // target_url, default empty now
132
+ 'd402': '', // screenx, default empty
133
+ '654a': '', // screeny, default empty
134
+ '6e7c': '878x1066', // browser_resolution, window.innerWidth || document.body && document.body.clientWidth + "x" + window.innerHeight || document.body && document.body.clientHeight
135
+ '3c43': {
136
+ // 3c43 => msg
137
+ '2673': 0, // hasLiedResolution, window.screen.width < window.screen.availWidth || window.screen.height < window.screen.availHeight
138
+ '5766': 24, // colorDepth, window.screen.colorDepth
139
+ '6527': 0, // addBehavior, !!window.HTMLElement.prototype.addBehavior, html5 api
140
+ '7003': 1, // indexedDb, !!window.indexedDB, html5 api
141
+ '807e': 1, // cookieEnabled, navigator.cookieEnabled
142
+ 'b8ce': this.USER_AGENT, // ua "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0",
143
+ '641c': 0, // webdriver, navigator.webdriver, like Selenium
144
+ '07a4': 'zh-CN', // language
145
+ '1c57': 'not available', // deviceMemory in GB, navigator.deviceMemory
146
+ '0bd0': 16, // hardwareConcurrency, navigator.hardwareConcurrency
147
+ '748e': [1920, 1200], // window.screen.width window.screen.height
148
+ 'd61f': [1920, 1152], // window.screen.availWidth window.screen.availHeight
149
+ 'fc9d': -480, // timezoneOffset, (new Date).getTimezoneOffset()
150
+ '6aa9': 'Asia/Shanghai', //Intl.DateTimeFormat().resolvedOptions().timeZone, // timezone, (new window.Intl.DateTimeFormat).resolvedOptions().timeZone
151
+ '75b8': 1, // sessionStorage, window.sessionStorage, html5 api
152
+ '3b21': 1, // localStorage, window.localStorage, html5 api
153
+ '8a1c': 0, // openDatabase, window.openDatabase, html5 api
154
+ 'd52f': 'not available', // cpuClass, navigator.cpuClass
155
+ 'adca': this.USER_AGENT.includes('Windows') ? 'Win32' : 'Linux', // platform, navigator.platform
156
+ '80c9': [
157
+ [
158
+ 'PDF Viewer',
159
+ 'Portable Document Format',
160
+ [
161
+ ['application/pdf', 'pdf'],
162
+ ['text/pdf', 'pdf']
163
+ ]
164
+ ],
165
+ [
166
+ 'Chrome PDF Viewer',
167
+ 'Portable Document Format',
168
+ [
169
+ ['application/pdf', 'pdf'],
170
+ ['text/pdf', 'pdf']
171
+ ]
172
+ ],
173
+ [
174
+ 'Chromium PDF Viewer',
175
+ 'Portable Document Format',
176
+ [
177
+ ['application/pdf', 'pdf'],
178
+ ['text/pdf', 'pdf']
179
+ ]
180
+ ],
181
+ [
182
+ 'Microsoft Edge PDF Viewer',
183
+ 'Portable Document Format',
184
+ [
185
+ ['application/pdf', 'pdf'],
186
+ ['text/pdf', 'pdf']
187
+ ]
188
+ ],
189
+ [
190
+ 'WebKit built-in PDF',
191
+ 'Portable Document Format',
192
+ [
193
+ ['application/pdf', 'pdf'],
194
+ ['text/pdf', 'pdf']
195
+ ]
196
+ ]
197
+ ], // plugins
198
+ '13ab': 'f3YAAAAASUVORK5CYII=', // canvas fingerprint
199
+ 'bfe9': 'kABYpRAGAVYzWJooB9Bf4P+UortSvxRY0AAAAASUVORK5CYII=', // webgl_str
200
+ 'a3c1': [
201
+ 'extensions:ANGLE_instanced_arrays;EXT_blend_minmax;EXT_color_buffer_half_float;EXT_float_blend;EXT_frag_depth;EXT_shader_texture_lod;EXT_sRGB;EXT_texture_compression_bptc;EXT_texture_compression_rgtc;EXT_texture_filter_anisotropic;OES_element_index_uint;OES_fbo_render_mipmap;OES_standard_derivatives;OES_texture_float;OES_texture_float_linear;OES_texture_half_float;OES_texture_half_float_linear;OES_vertex_array_object;WEBGL_color_buffer_float;WEBGL_compressed_texture_s3tc;WEBGL_compressed_texture_s3tc_srgb;WEBGL_debug_renderer_info;WEBGL_debug_shaders;WEBGL_depth_texture;WEBGL_draw_buffers;WEBGL_lose_context;WEBGL_provoking_vertex',
202
+ 'webgl aliased line width range:[1, 1]',
203
+ 'webgl aliased point size range:[1, 1024]',
204
+ 'webgl alpha bits:8',
205
+ 'webgl antialiasing:yes',
206
+ 'webgl blue bits:8',
207
+ 'webgl depth bits:24',
208
+ 'webgl green bits:8',
209
+ 'webgl max anisotropy:16',
210
+ 'webgl max combined texture image units:32',
211
+ 'webgl max cube map texture size:16384',
212
+ 'webgl max fragment uniform vectors:1024',
213
+ 'webgl max render buffer size:16384',
214
+ 'webgl max texture image units:16',
215
+ 'webgl max texture size:16384',
216
+ 'webgl max varying vectors:30',
217
+ 'webgl max vertex attribs:16',
218
+ 'webgl max vertex texture image units:16',
219
+ 'webgl max vertex uniform vectors:4096',
220
+ 'webgl max viewport dims:[32767, 32767]',
221
+ 'webgl red bits:8',
222
+ 'webgl renderer:ANGLE (Intel, Intel(R) HD Graphics Direct3D11 vs_5_0 ps_5_0), or similar',
223
+ 'webgl shading language version:WebGL GLSL ES 1.0',
224
+ 'webgl stencil bits:0',
225
+ 'webgl vendor:Mozilla',
226
+ 'webgl version:WebGL 1.0',
227
+ 'webgl unmasked vendor:Google Inc. (Intel)',
228
+ 'webgl unmasked renderer:ANGLE (Intel, Intel(R) HD Graphics Direct3D11 vs_5_0 ps_5_0), or similar',
229
+ 'webgl vertex shader high float precision:23',
230
+ 'webgl vertex shader high float precision rangeMin:127',
231
+ 'webgl vertex shader high float precision rangeMax:127',
232
+ 'webgl vertex shader medium float precision:23',
233
+ 'webgl vertex shader medium float precision rangeMin:127',
234
+ 'webgl vertex shader medium float precision rangeMax:127',
235
+ 'webgl vertex shader low float precision:23',
236
+ 'webgl vertex shader low float precision rangeMin:127',
237
+ 'webgl vertex shader low float precision rangeMax:127',
238
+ 'webgl fragment shader high float precision:23',
239
+ 'webgl fragment shader high float precision rangeMin:127',
240
+ 'webgl fragment shader high float precision rangeMax:127',
241
+ 'webgl fragment shader medium float precision:23',
242
+ 'webgl fragment shader medium float precision rangeMin:127',
243
+ 'webgl fragment shader medium float precision rangeMax:127',
244
+ 'webgl fragment shader low float precision:23',
245
+ 'webgl fragment shader low float precision rangeMin:127',
246
+ 'webgl fragment shader low float precision rangeMax:127',
247
+ 'webgl vertex shader high int precision:0',
248
+ 'webgl vertex shader high int precision rangeMin:31',
249
+ 'webgl vertex shader high int precision rangeMax:30',
250
+ 'webgl vertex shader medium int precision:0',
251
+ 'webgl vertex shader medium int precision rangeMin:31',
252
+ 'webgl vertex shader medium int precision rangeMax:30',
253
+ 'webgl vertex shader low int precision:0',
254
+ 'webgl vertex shader low int precision rangeMin:31',
255
+ 'webgl vertex shader low int precision rangeMax:30',
256
+ 'webgl fragment shader high int precision:0',
257
+ 'webgl fragment shader high int precision rangeMin:31',
258
+ 'webgl fragment shader high int precision rangeMax:30',
259
+ 'webgl fragment shader medium int precision:0',
260
+ 'webgl fragment shader medium int precision rangeMin:31',
261
+ 'webgl fragment shader medium int precision rangeMax:30',
262
+ 'webgl fragment shader low int precision:0',
263
+ 'webgl fragment shader low int precision rangeMin:31',
264
+ 'webgl fragment shader low int precision rangeMax:30'
265
+ ], // webgl_params, cab be set to [] if webgl is not supported
266
+ '6bc5': 'Google Inc. (Intel)~ANGLE (Intel, Intel(R) HD Graphics Direct3D11 vs_5_0 ps_5_0), or similar', // webglVendorAndRenderer
267
+ 'ed31': 0,
268
+ '72bd': 0,
269
+ '097b': 0,
270
+ '52cd': [0, 0, 0],
271
+ 'a658': [
272
+ 'Arial',
273
+ 'Arial Black',
274
+ 'Calibri',
275
+ 'Cambria',
276
+ 'Cambria Math',
277
+ 'Comic Sans MS',
278
+ 'Consolas',
279
+ 'Courier',
280
+ 'Courier New',
281
+ 'Georgia',
282
+ 'Helvetica',
283
+ 'Impact',
284
+ 'Lucida Console',
285
+ 'Lucida Sans Unicode',
286
+ 'Microsoft Sans Serif',
287
+ 'MS Gothic',
288
+ 'MS PGothic',
289
+ 'MS Sans Serif',
290
+ 'MS Serif',
291
+ 'Palatino Linotype',
292
+ 'Segoe Print',
293
+ 'Segoe Script',
294
+ 'Segoe UI',
295
+ 'Segoe UI Light',
296
+ 'Segoe UI Symbol',
297
+ 'Tahoma',
298
+ 'Times',
299
+ 'Times New Roman',
300
+ 'Trebuchet MS',
301
+ 'Verdana',
302
+ 'Wingdings'
303
+ ],
304
+ 'd02f': '35.749972093850374'
305
+ },
306
+ '54ef': {
307
+ 'in_new_ab ': true,
308
+ 'ab_version ': {
309
+ 'waterfall_article ': 'SHOW '
310
+ },
311
+ 'ab_split_num ': {
312
+ 'waterfall_article ': 0
313
+ }
314
+ },
315
+ '8b94': '',
316
+ 'df35': `${_uuid}`, // _uuid, set from cookie, generated by client side(algorithm remains unknown)
317
+ '07a4': 'zh-CN',
318
+ '5f45': null,
319
+ 'db46': 0
320
+ };
321
+ }
322
+ /**返回Bilibili Fingerprint data */
323
+ BILIBILI_FINGERPRINT_DATA(_uuid) {
324
+ return {
325
+ userAgent: this.USER_AGENT, // 用户代理
326
+ webdriver: false, // 是否是 WebDriver(例如 Selenium)
327
+ language: 'zh-CN', // 浏览器语言
328
+ colorDepth: 24, // 屏幕颜色深度
329
+ deviceMemory: 'not available', // 设备内存(GB)
330
+ pixelRatio: 2, // 设备像素比
331
+ hardwareConcurrency: 8, // 处理器核心数量
332
+ screenResolution: '1920x1200', // 屏幕分辨率
333
+ availableScreenResolution: '1920x1152', // 可用屏幕分辨率
334
+ timezoneOffset: -480, // 时区偏移,单位为分钟
335
+ timezone: 'Asia/Shanghai', // 时区
336
+ sessionStorage: true, // 是否支持 sessionStorage
337
+ localStorage: true, // 是否支持 localStorage
338
+ indexedDb: true, // 是否支持 IndexedDB
339
+ addBehavior: false, // 是否支持 addBehavior
340
+ openDatabase: false, // 是否支持 openDatabase
341
+ cpuClass: 'not available', // CPU 类型amd 或 intel 或 not available
342
+ platform: this.USER_AGENT.includes('Windows') ? 'Win32' : 'Linux', // 操作系统平台,例如 Windows,Linux,Mac
343
+ doNotTrack: null, // DNT 设置,通常是 `navigator.doNotTrack`
344
+ plugins: [
345
+ { name: 'PDF Viewer', description: 'Portable Document Format', mimeTypes: [['application/pdf', 'pdf']] },
346
+ { name: 'Chrome PDF Viewer', description: 'Portable Document Format', mimeTypes: [['application/pdf', 'pdf']] },
347
+ { name: 'Chromium PDF Viewer', description: 'Portable Document Format', mimeTypes: [['application/pdf', 'pdf']] },
348
+ { name: 'Microsoft Edge PDF Viewer', description: 'Portable Document Format', mimeTypes: [['application/pdf', 'pdf']] },
349
+ { name: 'WebKit built-in PDF', description: 'Portable Document Format', mimeTypes: [['application/pdf', 'pdf']] }
350
+ ],
351
+ canvas: 'f3YAAAAASUVORK5CYII=', // Canvas 指纹
352
+ webgl: 'kABYpRAGAVYzWJooB9Bf4P+UortSvxRY0AAAAASUVORK5CYII=', // WebGL 参数
353
+ webglVendorAndRenderer: 'Google Inc. (Intel)~ANGLE (Intel, Intel(R) HD Graphics Direct3D11 vs_5_0 ps_5_0), or similar', // WebGL 的厂商和渲染器信息
354
+ adBlock: false, // 是否检测到广告拦截器
355
+ hasLiedLanguages: false, // 是否谎称语言
356
+ hasLiedResolution: false, // 是否谎称分辨率
357
+ hasLiedOs: false, // 是否谎称操作系统
358
+ hasLiedBrowser: false, // 是否谎称浏览器
359
+ touchSupport: 0, // 支持的触摸点数
360
+ fonts: [
361
+ 'Arial',
362
+ 'Arial Black',
363
+ 'Calibri',
364
+ 'Cambria',
365
+ 'Cambria Math',
366
+ 'Comic Sans MS',
367
+ 'Consolas',
368
+ 'Courier',
369
+ 'Courier New',
370
+ 'Georgia',
371
+ 'Helvetica',
372
+ 'Impact',
373
+ 'Lucida Console',
374
+ 'Lucida Sans Unicode',
375
+ 'Microsoft Sans Serif',
376
+ 'MS Gothic',
377
+ 'MS PGothic',
378
+ 'MS Sans Serif',
379
+ 'MS Serif',
380
+ 'Palatino Linotype',
381
+ 'Segoe Print',
382
+ 'Segoe Script',
383
+ 'Segoe UI',
384
+ 'Segoe UI Light',
385
+ 'Segoe UI Symbol',
386
+ 'Tahoma',
387
+ 'Times',
388
+ 'Times New Roman',
389
+ 'Trebuchet MS',
390
+ 'Verdana',
391
+ 'Wingdings'
392
+ ],
393
+ fontsFlash: false, // Flash 插件是否安装
394
+ audio: '35.749972093850374', // 音频指纹
395
+ enumerateDevices: [`id=${_uuid};gid=groupId1;kind=videoinput;label=Camera1`, `id=${_uuid};gid=groupId2;kind=audioinput;label=Microphone1`]
396
+ // 枚举设备指纹,Unreliable on Windows, see https://github.com/fingerprintjs/fingerprintjs/issues/375
397
+ };
398
+ }
399
+ }
400
+ var BiliApi$1 = new BiliApi();
401
+
402
+ export { BiliApi$1 as default };
@@ -1,9 +1,10 @@
1
1
  import axios from 'axios';
2
2
  import lodash from 'lodash';
3
- import { BiliApi } from './bilibili.api.js';
4
- import { readSyncCookie, cookieWithBiliTicket, readSavedCookieItems, readSavedCookieOtherItems } from './bilibili.models.js';
5
- import { getWbiSign } from './bilibili.wbi.js';
6
- import { getDmImg } from './bilibili.dm.img.js';
3
+ import BiliApi from './bilibili.main.api.js';
4
+ import { readSyncCookie, cookieWithBiliTicket, readSavedCookieItems, readSavedCookieOtherItems } from './bilibili.main.models.js';
5
+ import { getWbiSign } from './bilibili.risk.wbi.js';
6
+ import { getDmImg } from './bilibili.risk.dm.img.js';
7
+ import { getWebId } from './bilibili.risk.w_webid.js';
7
8
 
8
9
  class BiliGetWebData {
9
10
  constructor(e) { }
@@ -18,7 +19,7 @@ class BiliGetWebData {
18
19
  'host_mid': uid,
19
20
  'timezone_offset': -480,
20
21
  'platform': 'web',
21
- 'features': 'itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote',
22
+ 'features': 'itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,decorationCard,forwardListHidden,ugcDelete,onlyfansQaCard',
22
23
  'web_location': '333.999',
23
24
  ...dmImg,
24
25
  'x-bili-device-req-json': { platform: 'web', device: 'pc' },
@@ -48,14 +49,21 @@ class BiliGetWebData {
48
49
  const url = BiliApi.BILIBIL_API.biliSpaceUserInfoWbi;
49
50
  let { cookie } = await readSyncCookie();
50
51
  cookie = await cookieWithBiliTicket(cookie);
52
+ const dmImg = await getDmImg();
53
+ const w_webid = await getWebId(uid);
51
54
  const data = {
52
55
  mid: uid,
53
- jsonp: 'jsonp'
56
+ token: '',
57
+ platform: 'web',
58
+ web_location: 1550101,
59
+ ...dmImg,
60
+ w_webid: w_webid
54
61
  };
55
62
  let signCookie = (await readSavedCookieItems(cookie, ['SESSDATA'], false)) || (await readSavedCookieOtherItems(cookie, ['SESSDATA']));
56
63
  const { w_rid, time_stamp } = await getWbiSign(data, BiliApi.BILIBILI_HEADERS, signCookie);
57
64
  const params = {
58
65
  ...data,
66
+ w_webid: w_webid,
59
67
  w_rid: w_rid,
60
68
  wts: time_stamp
61
69
  };
@@ -65,8 +73,8 @@ class BiliGetWebData {
65
73
  headers: lodash.merge(BiliApi.BILIBILI_HEADERS, {
66
74
  Cookie: `${cookie}`,
67
75
  Host: `api.bilibili.com`,
68
- Origin: 'https://www.bilibili.com',
69
- Referer: `https://www.bilibili.com/`
76
+ Origin: 'https://space.bilibili.com',
77
+ Referer: `https://space.bilibili.com/${uid}/dynamic`
70
78
  })
71
79
  });
72
80
  return res;