yz-yuki-plugin 2.0.5-9 → 2.0.6-1
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 +6 -0
- package/defaultConfig/bilibili/config.yaml +9 -0
- package/defaultConfig/weibo/config.yaml +3 -0
- package/lib/apps/bilibili.js +44 -37
- package/lib/index.js +1 -1
- package/lib/models/bilibili/bilibili.main.api.js +402 -0
- package/lib/models/bilibili/{bilibili.get.web.data.js → bilibili.main.get.web.data.js} +8 -7
- package/lib/models/bilibili/{bilibili.models.js → bilibili.main.models.js} +81 -250
- package/lib/models/bilibili/{bilibili.query.js → bilibili.main.query.js} +114 -92
- package/lib/models/bilibili/{bilibili.task.js → bilibili.main.task.js} +39 -15
- package/lib/models/bilibili/bilibili.risk.buid.fp.js +282 -0
- package/lib/models/bilibili/{bilibili.dm.img.js → bilibili.risk.dm.img.js} +2 -2
- package/lib/models/bilibili/{bilibili.ticket.js → bilibili.risk.ticket.js} +1 -1
- package/lib/models/bilibili/{bilibili.w_webid.js → bilibili.risk.w_webid.js} +4 -4
- package/lib/models/bilibili/bilibili.risk.wbi.js +102 -0
- package/lib/models/weibo/weibo.get.web.data.js +1 -2
- package/lib/models/weibo/weibo.query.js +19 -21
- package/lib/models/weibo/weibo.task.js +27 -11
- package/lib/utils/config.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/puppeteer.render.js +2 -0
- package/package.json +13 -11
- package/lib/models/bilibili/bilibili.api.js +0 -93
- package/lib/models/bilibili/bilibili.buid.fp.js +0 -77
- package/lib/models/bilibili/bilibili.wbi.js +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -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
|
|
|
@@ -38,6 +44,9 @@ banWords:
|
|
|
38
44
|
# 设置B站动态消息模式 0 文字模式 1 图片模式
|
|
39
45
|
pushMsgMode: 1
|
|
40
46
|
|
|
47
|
+
# 文字模式时,文字消息与图片附件是否合并在一起发送,默认 1 合并,0 不合并。如果合并时图片过多导致发送失败,可设置为 0 单独发送图片。
|
|
48
|
+
mergeTextPic: 1
|
|
49
|
+
|
|
41
50
|
# 是否启用九宫格样式:默认 1 启用,0 不启用。此为最高优先级,九宫格为动态模式,特定大小/长宽比的图片资源将会动态启用九宫格/四宫格/无宫格样式。
|
|
42
51
|
boxGrid: 1
|
|
43
52
|
|
package/lib/apps/bilibili.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import JSON from 'json5';
|
|
2
2
|
import lodash from 'lodash';
|
|
3
|
-
import { Messages,
|
|
4
|
-
import { BiliQuery } from '../models/bilibili/bilibili.query.js';
|
|
5
|
-
import { BiliTask } from '../models/bilibili/bilibili.task.js';
|
|
3
|
+
import { Messages, Redis } from 'yunzaijs';
|
|
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,
|
|
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');
|
|
@@ -63,7 +63,7 @@ message.use(async (e) => {
|
|
|
63
63
|
logger.mark(`yuki-plugin addDynamicSub Failed:${JSON.stringify(res.data)}`);
|
|
64
64
|
}
|
|
65
65
|
const { has_more, items } = data || {};
|
|
66
|
-
let infoName;
|
|
66
|
+
let infoName = '';
|
|
67
67
|
if (code === 0 && has_more === false) {
|
|
68
68
|
e.reply(`检测到该uid的主页空间动态内容为空,\n执行uid:${uid} 校验...`);
|
|
69
69
|
const resp = await new BiliGetWebData(e).getBilibiUserInfoByUid(uid);
|
|
@@ -87,7 +87,7 @@ message.use(async (e) => {
|
|
|
87
87
|
e.reply(`昵称:${infoName} \nuid:${uid} 校验成功!`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
let name;
|
|
90
|
+
let name = '';
|
|
91
91
|
if (Array.isArray(items)) {
|
|
92
92
|
if (items.length > 0) {
|
|
93
93
|
name = items[0].modules?.module_author?.name || uid;
|
|
@@ -170,30 +170,31 @@ message.use(async (e) => {
|
|
|
170
170
|
if (e.isMaster) {
|
|
171
171
|
try {
|
|
172
172
|
const token = await applyLoginQRCode(e);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
173
|
+
if (token) {
|
|
174
|
+
let biliLoginCk = await pollLoginQRCode(e, token);
|
|
175
|
+
if (biliLoginCk) {
|
|
176
|
+
if (lodash.trim(biliLoginCk).length != 0) {
|
|
177
|
+
await saveLoginCookie(e, biliLoginCk);
|
|
178
|
+
e.reply(`get bilibili LoginCk:成功!`);
|
|
179
|
+
const result = await postGateway(biliLoginCk); //激活ck
|
|
180
|
+
const { code, data } = await result.data; // 解析校验结果
|
|
181
|
+
switch (code) {
|
|
182
|
+
case 0:
|
|
183
|
+
global?.logger?.mark(`优纪插件:获取biliLoginCK,Gateway校验成功:${JSON.stringify(data)}`);
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
global?.logger?.mark(`优纪插件:获取biliLoginCK,Gateway校验失败:${JSON.stringify(data)}`);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
e.reply(`get bilibili LoginCk:失败X﹏X`);
|
|
192
|
+
}
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
|
-
else {
|
|
192
|
-
e.reply(`get bilibili LoginCk:失败X﹏X`);
|
|
193
|
-
}
|
|
194
195
|
}
|
|
195
196
|
catch (Error) {
|
|
196
|
-
|
|
197
|
+
global?.logger?.info(`yuki-plugin Login bilibili Failed:${Error}`);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
else {
|
|
@@ -257,9 +258,7 @@ message.use(async (e) => {
|
|
|
257
258
|
return;
|
|
258
259
|
}
|
|
259
260
|
//筛选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值
|
|
261
|
+
localBiliCookie = await readSavedCookieItems(localBiliCookie, ['buvid3', 'buvid4', '_uuid', 'SESSDATA', 'DedeUserID', 'DedeUserID__ckMd5', 'bili_jct', 'b_nut', 'b_lsid', 'buvid_fp', 'sid'], false);
|
|
263
262
|
await saveLocalBiliCk(localBiliCookie);
|
|
264
263
|
logger.mark(`${e.logFnc} 保存B站cookie成功 [UID:${param.DedeUserID}]`);
|
|
265
264
|
let uidMsg = [`好耶~绑定B站cookie成功:\n${param.DedeUserID}`];
|
|
@@ -268,10 +267,10 @@ message.use(async (e) => {
|
|
|
268
267
|
const { code, data } = await result.data; // 解析校验结果
|
|
269
268
|
switch (code) {
|
|
270
269
|
case 0:
|
|
271
|
-
|
|
270
|
+
global?.logger?.mark(`优纪插件:绑定localCK,Gateway校验成功:${JSON.stringify(data)}`);
|
|
272
271
|
break;
|
|
273
272
|
default:
|
|
274
|
-
|
|
273
|
+
global?.logger?.mark(`优纪插件:绑定localCK,Gateway校验失败:${JSON.stringify(data)}`);
|
|
275
274
|
break;
|
|
276
275
|
}
|
|
277
276
|
}
|
|
@@ -322,9 +321,17 @@ message.use(async (e) => {
|
|
|
322
321
|
/** 删除并刷新redis缓存的临时B站ck */
|
|
323
322
|
message.use(async (e) => {
|
|
324
323
|
try {
|
|
325
|
-
await getNewTempCk();
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
const newTempCk = await getNewTempCk();
|
|
325
|
+
if (newTempCk) {
|
|
326
|
+
await saveTempCk(newTempCk);
|
|
327
|
+
const result = await postGateway(newTempCk);
|
|
328
|
+
const data = await result.data; // 解析校验结果
|
|
329
|
+
if (data?.code !== 0) {
|
|
330
|
+
logger?.error(`优纪插件:tempCK,Gateway校验失败:${JSON.stringify(data)}`);
|
|
331
|
+
}
|
|
332
|
+
else if (data?.code === 0) {
|
|
333
|
+
logger?.mark(`优纪插件:tempCK,Gateway校验成功:${JSON.stringify(data)}`);
|
|
334
|
+
}
|
|
328
335
|
e.reply(`~yuki-plugin:\n临时b站ck刷新成功~❤~\n接下来如果获取动态失败,请重启bot(手动或发送指令 #重启)刷新状态~\n如果重启续仍不可用,请考虑 #优纪添加b站登录 吧~`);
|
|
329
336
|
}
|
|
330
337
|
else {
|
|
@@ -333,7 +340,7 @@ message.use(async (e) => {
|
|
|
333
340
|
}
|
|
334
341
|
catch (error) {
|
|
335
342
|
e.reply(`~yuki-plugin:\n临时b站ck刷新失败X﹏X\n请重启bot(手动或发送指令 #重启)后重试`);
|
|
336
|
-
|
|
343
|
+
global?.logger?.mark(`优纪插件:B站临时ck刷新error:${error}`);
|
|
337
344
|
}
|
|
338
345
|
}, [/^(#|\/)(yuki|优纪)?刷新(b站|B站|bili|bilibili|哔哩|哔哩哔哩)临时(ck|CK|cookie|COOKIE)$/]);
|
|
339
346
|
/** 订阅的全部b站推送列表 */
|
|
@@ -445,7 +452,7 @@ message.use(async (e) => {
|
|
|
445
452
|
}
|
|
446
453
|
const message = [`昵称:${data?.name}`, `\n性别:${data?.sex}`, `\n等级:${data?.level}`];
|
|
447
454
|
if (data.live_room) {
|
|
448
|
-
message.push(
|
|
455
|
+
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
456
|
e.reply(`直播链接:${data?.live_room?.url}`);
|
|
450
457
|
}
|
|
451
458
|
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,10 +1,10 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import lodash from 'lodash';
|
|
3
|
-
import
|
|
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';
|
|
7
|
-
import { getWebId } from './bilibili.w_webid.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';
|
|
8
8
|
|
|
9
9
|
class BiliGetWebData {
|
|
10
10
|
constructor(e) { }
|
|
@@ -50,15 +50,16 @@ class BiliGetWebData {
|
|
|
50
50
|
let { cookie } = await readSyncCookie();
|
|
51
51
|
cookie = await cookieWithBiliTicket(cookie);
|
|
52
52
|
const dmImg = await getDmImg();
|
|
53
|
+
const w_webid = await getWebId(uid);
|
|
53
54
|
const data = {
|
|
54
55
|
mid: uid,
|
|
55
56
|
token: '',
|
|
56
57
|
platform: 'web',
|
|
57
58
|
web_location: 1550101,
|
|
58
|
-
...dmImg
|
|
59
|
+
...dmImg,
|
|
60
|
+
w_webid: w_webid
|
|
59
61
|
};
|
|
60
62
|
let signCookie = (await readSavedCookieItems(cookie, ['SESSDATA'], false)) || (await readSavedCookieOtherItems(cookie, ['SESSDATA']));
|
|
61
|
-
const w_webid = await getWebId(uid);
|
|
62
63
|
const { w_rid, time_stamp } = await getWbiSign(data, BiliApi.BILIBILI_HEADERS, signCookie);
|
|
63
64
|
const params = {
|
|
64
65
|
...data,
|