@dan-uni/dan-any 1.3.8 → 1.3.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/dist/browser/index.min.js +87 -6
- package/dist/browser/plugins/bili.min.js +1 -77
- package/dist/browser/plugins/index.min.js +1 -1
- package/dist/browser/plugins/stats.min.js +1 -1
- package/dist/browser/src/index.d.ts +1 -0
- package/dist/node/{rslib-runtime.js → 0~rslib-runtime.js} +1 -15
- package/dist/node/index.js +87 -6
- package/dist/node/plugins/bili.js +1 -77
- package/dist/node/plugins/index.js +1 -1
- package/dist/node/plugins/stats.js +1 -1
- package/dist/node/src/index.d.ts +1 -0
- package/dist/umd/index.umd.min.js +16590 -11927
- package/dist/umd/plugins/bili.umd.min.js +5219 -5213
- package/dist/umd/plugins/index.umd.min.js +16 -14
- package/dist/umd/src/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- /package/dist/browser/{rslib-runtime.min.js → 1~rslib-runtime.min.js} +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/*! LICENSE: index.min.js.LICENSE.txt */
|
|
2
|
-
import { __webpack_require__ } from "./rslib-runtime.min.js";
|
|
3
2
|
import "reflect-metadata/lite";
|
|
4
3
|
import { IsDate, IsEmail, IsEnum, IsInt, IsNotEmpty, IsNumber, IsOptional, IsString, Max, Min, isEmail, isJSON, isString, validateOrReject } from "class-validator";
|
|
5
4
|
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
@@ -9,8 +8,11 @@ import { file_google_protobuf_timestamp, timestampDate, timestampFromDate, times
|
|
|
9
8
|
import { Expose, plainToInstance } from "class-transformer";
|
|
10
9
|
import hh_mm_ss from "hh-mm-ss";
|
|
11
10
|
import jssha from "jssha";
|
|
12
|
-
import { decode, encode as external_base16384_encode } from "base16384";
|
|
13
11
|
import { fileDesc, messageDesc as codegenv2_messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
12
|
+
import { DateTime } from "luxon";
|
|
13
|
+
import { __webpack_require__ } from "./1~rslib-runtime.min.js";
|
|
14
|
+
import "./plugins/stats.min.js";
|
|
15
|
+
import * as __rspack_external_base16384 from "base16384";
|
|
14
16
|
__webpack_require__.add({
|
|
15
17
|
"../../node_modules/.pnpm/assert@2.1.0/node_modules/assert/build/assert.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16
18
|
var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
@@ -11433,6 +11435,24 @@ __webpack_require__.add({
|
|
|
11433
11435
|
};
|
|
11434
11436
|
}
|
|
11435
11437
|
});
|
|
11438
|
+
var dedupe_namespaceObject = {};
|
|
11439
|
+
__webpack_require__.r(dedupe_namespaceObject);
|
|
11440
|
+
__webpack_require__.d(dedupe_namespaceObject, {
|
|
11441
|
+
bili_dedupe: ()=>bili_dedupe,
|
|
11442
|
+
to_bili_deduped: ()=>to_bili_deduped
|
|
11443
|
+
});
|
|
11444
|
+
var bili_namespaceObject = {};
|
|
11445
|
+
__webpack_require__.r(bili_namespaceObject);
|
|
11446
|
+
__webpack_require__.d(bili_namespaceObject, {
|
|
11447
|
+
bili_dedupe: ()=>dedupe_namespaceObject,
|
|
11448
|
+
bili_history_fast_forward: ()=>bili_history_fast_forward
|
|
11449
|
+
});
|
|
11450
|
+
var plugins_namespaceObject = {};
|
|
11451
|
+
__webpack_require__.r(plugins_namespaceObject);
|
|
11452
|
+
__webpack_require__.d(plugins_namespaceObject, {
|
|
11453
|
+
bili: ()=>bili_namespaceObject,
|
|
11454
|
+
stats: ()=>stats_namespaceObject
|
|
11455
|
+
});
|
|
11436
11456
|
var dm_gen_namespaceObject = {};
|
|
11437
11457
|
__webpack_require__.r(dm_gen_namespaceObject);
|
|
11438
11458
|
__webpack_require__.d(dm_gen_namespaceObject, {
|
|
@@ -11461,7 +11481,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
11461
11481
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
11462
11482
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
11463
11483
|
});
|
|
11464
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
11484
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.9","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
11465
11485
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
11466
11486
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
11467
11487
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -12585,7 +12605,7 @@ function raw_raw(list, config, context, compressType = 'brotli', baseType = 'bas
|
|
|
12585
12605
|
const rawText = JSON.stringify(raw1);
|
|
12586
12606
|
let compress;
|
|
12587
12607
|
compress = 'brotli' === compressType ? (0, lib.brotliCompressSync)(rawText) : (0, lib.gzipSync)(rawText);
|
|
12588
|
-
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(
|
|
12608
|
+
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(__rspack_external_base16384.encode(compress))}`;
|
|
12589
12609
|
}
|
|
12590
12610
|
function deRaw(ass) {
|
|
12591
12611
|
const arr = ass.split('\n');
|
|
@@ -12599,7 +12619,7 @@ function deRaw(ass) {
|
|
|
12599
12619
|
if (!compressTypes.has(compressType)) compressType = 'gzip';
|
|
12600
12620
|
if (!baseTypes.has(baseType)) baseType = 'base64';
|
|
12601
12621
|
const text = lineRaw.replace(';Raw: ', '').trim();
|
|
12602
|
-
const buffer = 'base64' === baseType ? raw_Buffer.from(text, 'base64') : raw_Buffer.from(decode(raw_Buffer.from(text, 'utf8').toString('utf8')));
|
|
12622
|
+
const buffer = 'base64' === baseType ? raw_Buffer.from(text, 'base64') : raw_Buffer.from(__rspack_external_base16384.decode(raw_Buffer.from(text, 'utf8').toString('utf8')));
|
|
12603
12623
|
let decompress;
|
|
12604
12624
|
decompress = 'brotli' === compressType ? (0, lib.brotliDecompressSync)(buffer) : (0, lib.gunzipSync)(buffer);
|
|
12605
12625
|
try {
|
|
@@ -12747,6 +12767,67 @@ function fileParser(file, mod) {
|
|
|
12747
12767
|
throw new Error(`Unsupported mod "${mod}"`);
|
|
12748
12768
|
}
|
|
12749
12769
|
}
|
|
12770
|
+
function main(that) {
|
|
12771
|
+
that.dans.forEach((d)=>{
|
|
12772
|
+
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
12773
|
+
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
12774
|
+
});
|
|
12775
|
+
const map = new Map();
|
|
12776
|
+
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
12777
|
+
return map;
|
|
12778
|
+
}
|
|
12779
|
+
function to_bili_deduped(that) {
|
|
12780
|
+
const map = main(that);
|
|
12781
|
+
return new UniPool([
|
|
12782
|
+
...map.values()
|
|
12783
|
+
], that.options, that.info);
|
|
12784
|
+
}
|
|
12785
|
+
function bili_dedupe(that) {
|
|
12786
|
+
const map = main(that);
|
|
12787
|
+
that.dans = [
|
|
12788
|
+
...map.values()
|
|
12789
|
+
];
|
|
12790
|
+
}
|
|
12791
|
+
function history_danmaku_fast_forward_main(that, query_history_date) {
|
|
12792
|
+
const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
|
|
12793
|
+
zone: 'Asia/Shanghai'
|
|
12794
|
+
}).setZone('Asia/Shanghai');
|
|
12795
|
+
if (!qhd.isValid) throw new Error('Invalid query_history_date');
|
|
12796
|
+
const s = qhd.startOf('day');
|
|
12797
|
+
const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
|
|
12798
|
+
if (0 === before.length) return {
|
|
12799
|
+
earliest: null,
|
|
12800
|
+
FastForward: [],
|
|
12801
|
+
skip: [],
|
|
12802
|
+
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
12803
|
+
};
|
|
12804
|
+
const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
|
|
12805
|
+
const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
|
|
12806
|
+
const datesWithDanmaku = new Set();
|
|
12807
|
+
for (const dan of before){
|
|
12808
|
+
const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
|
|
12809
|
+
datesWithDanmaku.add(dateStr);
|
|
12810
|
+
}
|
|
12811
|
+
let current = earliestDate;
|
|
12812
|
+
const allDates = [];
|
|
12813
|
+
while(current < s){
|
|
12814
|
+
allDates.push(current.toFormat('yyyy-MM-dd'));
|
|
12815
|
+
current = current.plus({
|
|
12816
|
+
days: 1
|
|
12817
|
+
});
|
|
12818
|
+
}
|
|
12819
|
+
const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
|
|
12820
|
+
const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
|
|
12821
|
+
return {
|
|
12822
|
+
earliest: earliestDate.toFormat('yyyy-MM-dd'),
|
|
12823
|
+
FastForward,
|
|
12824
|
+
skip,
|
|
12825
|
+
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
12826
|
+
};
|
|
12827
|
+
}
|
|
12828
|
+
function bili_history_fast_forward(query_history_date) {
|
|
12829
|
+
return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
|
|
12830
|
+
}
|
|
12750
12831
|
const src_JSON = json_bigint({
|
|
12751
12832
|
useNativeBigInt: true
|
|
12752
12833
|
});
|
|
@@ -13419,4 +13500,4 @@ class UniPool {
|
|
|
13419
13500
|
}, canvasCtx);
|
|
13420
13501
|
}
|
|
13421
13502
|
}
|
|
13422
|
-
export { UniDM, UniPool, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools,
|
|
13503
|
+
export { UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
|
@@ -1,77 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DateTime } from "luxon";
|
|
3
|
-
import { UniPool, platform_PlatformVideoSource } from "../index.min.js";
|
|
4
|
-
var dedupe_namespaceObject = {};
|
|
5
|
-
__webpack_require__.r(dedupe_namespaceObject);
|
|
6
|
-
__webpack_require__.d(dedupe_namespaceObject, {
|
|
7
|
-
bili_dedupe: ()=>bili_dedupe,
|
|
8
|
-
to_bili_deduped: ()=>to_bili_deduped
|
|
9
|
-
});
|
|
10
|
-
var bili_namespaceObject = {};
|
|
11
|
-
__webpack_require__.r(bili_namespaceObject);
|
|
12
|
-
__webpack_require__.d(bili_namespaceObject, {
|
|
13
|
-
bili_dedupe: ()=>dedupe_namespaceObject,
|
|
14
|
-
bili_history_fast_forward: ()=>bili_history_fast_forward
|
|
15
|
-
});
|
|
16
|
-
function main(that) {
|
|
17
|
-
that.dans.forEach((d)=>{
|
|
18
|
-
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
19
|
-
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
20
|
-
});
|
|
21
|
-
const map = new Map();
|
|
22
|
-
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
23
|
-
return map;
|
|
24
|
-
}
|
|
25
|
-
function to_bili_deduped(that) {
|
|
26
|
-
const map = main(that);
|
|
27
|
-
return new UniPool([
|
|
28
|
-
...map.values()
|
|
29
|
-
], that.options, that.info);
|
|
30
|
-
}
|
|
31
|
-
function bili_dedupe(that) {
|
|
32
|
-
const map = main(that);
|
|
33
|
-
that.dans = [
|
|
34
|
-
...map.values()
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
function history_danmaku_fast_forward_main(that, query_history_date) {
|
|
38
|
-
const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
|
|
39
|
-
zone: 'Asia/Shanghai'
|
|
40
|
-
}).setZone('Asia/Shanghai');
|
|
41
|
-
if (!qhd.isValid) throw new Error('Invalid query_history_date');
|
|
42
|
-
const s = qhd.startOf('day');
|
|
43
|
-
const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
|
|
44
|
-
if (0 === before.length) return {
|
|
45
|
-
earliest: null,
|
|
46
|
-
FastForward: [],
|
|
47
|
-
skip: [],
|
|
48
|
-
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
49
|
-
};
|
|
50
|
-
const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
|
|
51
|
-
const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
|
|
52
|
-
const datesWithDanmaku = new Set();
|
|
53
|
-
for (const dan of before){
|
|
54
|
-
const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
|
|
55
|
-
datesWithDanmaku.add(dateStr);
|
|
56
|
-
}
|
|
57
|
-
let current = earliestDate;
|
|
58
|
-
const allDates = [];
|
|
59
|
-
while(current < s){
|
|
60
|
-
allDates.push(current.toFormat('yyyy-MM-dd'));
|
|
61
|
-
current = current.plus({
|
|
62
|
-
days: 1
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
|
|
66
|
-
const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
|
|
67
|
-
return {
|
|
68
|
-
earliest: earliestDate.toFormat('yyyy-MM-dd'),
|
|
69
|
-
FastForward,
|
|
70
|
-
skip,
|
|
71
|
-
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function bili_history_fast_forward(query_history_date) {
|
|
75
|
-
return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
|
|
76
|
-
}
|
|
77
|
-
export { bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe };
|
|
1
|
+
export { bili_dedupe, bili_history_fast_forward } from "../index.min.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { bili } from "
|
|
1
|
+
export { bili } from "../index.min.js";
|
|
2
2
|
export { stats } from "./stats.min.js";
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
function __webpack_require__(moduleId) {
|
|
3
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
4
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
5
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
6
|
-
exports: {}
|
|
7
|
-
};
|
|
8
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
9
|
-
return module.exports;
|
|
10
|
-
}
|
|
1
|
+
var __webpack_require__ = {};
|
|
11
2
|
(()=>{
|
|
12
3
|
__webpack_require__.d = (exports, definition)=>{
|
|
13
4
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
@@ -16,11 +7,6 @@ function __webpack_require__(moduleId) {
|
|
|
16
7
|
});
|
|
17
8
|
};
|
|
18
9
|
})();
|
|
19
|
-
(()=>{
|
|
20
|
-
__webpack_require__.add = function(modules) {
|
|
21
|
-
Object.assign(__webpack_require__.m, modules);
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
10
|
(()=>{
|
|
25
11
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
12
|
})();
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
1
|
+
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
2
2
|
import "reflect-metadata/lite";
|
|
3
3
|
import { IsDate, IsEmail, IsEnum, IsInt, IsNotEmpty, IsNumber, IsOptional, IsString, Max, Min, isEmail, isJSON, isString, validateOrReject } from "class-validator";
|
|
4
4
|
import { XMLBuilder, XMLParser } from "fast-xml-parser";
|
|
@@ -9,8 +9,28 @@ import { Expose, plainToInstance } from "class-transformer";
|
|
|
9
9
|
import hh_mm_ss from "hh-mm-ss";
|
|
10
10
|
import jssha from "jssha";
|
|
11
11
|
import { brotliCompressSync, brotliDecompressSync, gunzipSync, gzipSync } from "node:zlib";
|
|
12
|
-
import { decode, encode as external_base16384_encode } from "base16384";
|
|
13
12
|
import { fileDesc, messageDesc as codegenv2_messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
13
|
+
import { DateTime } from "luxon";
|
|
14
|
+
import "./plugins/stats.js";
|
|
15
|
+
import * as __rspack_external_base16384 from "base16384";
|
|
16
|
+
var dedupe_namespaceObject = {};
|
|
17
|
+
__webpack_require__.r(dedupe_namespaceObject);
|
|
18
|
+
__webpack_require__.d(dedupe_namespaceObject, {
|
|
19
|
+
bili_dedupe: ()=>bili_dedupe,
|
|
20
|
+
to_bili_deduped: ()=>to_bili_deduped
|
|
21
|
+
});
|
|
22
|
+
var bili_namespaceObject = {};
|
|
23
|
+
__webpack_require__.r(bili_namespaceObject);
|
|
24
|
+
__webpack_require__.d(bili_namespaceObject, {
|
|
25
|
+
bili_dedupe: ()=>dedupe_namespaceObject,
|
|
26
|
+
bili_history_fast_forward: ()=>bili_history_fast_forward
|
|
27
|
+
});
|
|
28
|
+
var plugins_namespaceObject = {};
|
|
29
|
+
__webpack_require__.r(plugins_namespaceObject);
|
|
30
|
+
__webpack_require__.d(plugins_namespaceObject, {
|
|
31
|
+
bili: ()=>bili_namespaceObject,
|
|
32
|
+
stats: ()=>stats_namespaceObject
|
|
33
|
+
});
|
|
14
34
|
var dm_gen_namespaceObject = {};
|
|
15
35
|
__webpack_require__.r(dm_gen_namespaceObject);
|
|
16
36
|
__webpack_require__.d(dm_gen_namespaceObject, {
|
|
@@ -39,7 +59,7 @@ __webpack_require__.d(platform_namespaceObject, {
|
|
|
39
59
|
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
40
60
|
PlatformVideoSources: ()=>PlatformVideoSources
|
|
41
61
|
});
|
|
42
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.
|
|
62
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.3.9","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
43
63
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
44
64
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
45
65
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -1160,7 +1180,7 @@ function raw_raw(list, config, context, compressType = 'brotli', baseType = 'bas
|
|
|
1160
1180
|
const rawText = JSON.stringify(raw1);
|
|
1161
1181
|
let compress;
|
|
1162
1182
|
compress = 'brotli' === compressType ? brotliCompressSync(rawText) : gzipSync(rawText);
|
|
1163
|
-
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(
|
|
1183
|
+
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(__rspack_external_base16384.encode(compress))}`;
|
|
1164
1184
|
}
|
|
1165
1185
|
function deRaw(ass) {
|
|
1166
1186
|
const arr = ass.split('\n');
|
|
@@ -1174,7 +1194,7 @@ function deRaw(ass) {
|
|
|
1174
1194
|
if (!compressTypes.has(compressType)) compressType = 'gzip';
|
|
1175
1195
|
if (!baseTypes.has(baseType)) baseType = 'base64';
|
|
1176
1196
|
const text = lineRaw.replace(';Raw: ', '').trim();
|
|
1177
|
-
const buffer = 'base64' === baseType ? Buffer.from(text, 'base64') : Buffer.from(decode(Buffer.from(text, 'utf8').toString('utf8')));
|
|
1197
|
+
const buffer = 'base64' === baseType ? Buffer.from(text, 'base64') : Buffer.from(__rspack_external_base16384.decode(Buffer.from(text, 'utf8').toString('utf8')));
|
|
1178
1198
|
let decompress;
|
|
1179
1199
|
decompress = 'brotli' === compressType ? brotliDecompressSync(buffer) : gunzipSync(buffer);
|
|
1180
1200
|
try {
|
|
@@ -1322,6 +1342,67 @@ function fileParser(file, mod) {
|
|
|
1322
1342
|
throw new Error(`Unsupported mod "${mod}"`);
|
|
1323
1343
|
}
|
|
1324
1344
|
}
|
|
1345
|
+
function main(that) {
|
|
1346
|
+
that.dans.forEach((d)=>{
|
|
1347
|
+
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
1348
|
+
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
1349
|
+
});
|
|
1350
|
+
const map = new Map();
|
|
1351
|
+
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
1352
|
+
return map;
|
|
1353
|
+
}
|
|
1354
|
+
function to_bili_deduped(that) {
|
|
1355
|
+
const map = main(that);
|
|
1356
|
+
return new UniPool([
|
|
1357
|
+
...map.values()
|
|
1358
|
+
], that.options, that.info);
|
|
1359
|
+
}
|
|
1360
|
+
function bili_dedupe(that) {
|
|
1361
|
+
const map = main(that);
|
|
1362
|
+
that.dans = [
|
|
1363
|
+
...map.values()
|
|
1364
|
+
];
|
|
1365
|
+
}
|
|
1366
|
+
function history_danmaku_fast_forward_main(that, query_history_date) {
|
|
1367
|
+
const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
|
|
1368
|
+
zone: 'Asia/Shanghai'
|
|
1369
|
+
}).setZone('Asia/Shanghai');
|
|
1370
|
+
if (!qhd.isValid) throw new Error('Invalid query_history_date');
|
|
1371
|
+
const s = qhd.startOf('day');
|
|
1372
|
+
const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
|
|
1373
|
+
if (0 === before.length) return {
|
|
1374
|
+
earliest: null,
|
|
1375
|
+
FastForward: [],
|
|
1376
|
+
skip: [],
|
|
1377
|
+
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
1378
|
+
};
|
|
1379
|
+
const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
|
|
1380
|
+
const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
|
|
1381
|
+
const datesWithDanmaku = new Set();
|
|
1382
|
+
for (const dan of before){
|
|
1383
|
+
const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
|
|
1384
|
+
datesWithDanmaku.add(dateStr);
|
|
1385
|
+
}
|
|
1386
|
+
let current = earliestDate;
|
|
1387
|
+
const allDates = [];
|
|
1388
|
+
while(current < s){
|
|
1389
|
+
allDates.push(current.toFormat('yyyy-MM-dd'));
|
|
1390
|
+
current = current.plus({
|
|
1391
|
+
days: 1
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
|
|
1395
|
+
const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
|
|
1396
|
+
return {
|
|
1397
|
+
earliest: earliestDate.toFormat('yyyy-MM-dd'),
|
|
1398
|
+
FastForward,
|
|
1399
|
+
skip,
|
|
1400
|
+
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
function bili_history_fast_forward(query_history_date) {
|
|
1404
|
+
return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
|
|
1405
|
+
}
|
|
1325
1406
|
const src_JSON = json_bigint({
|
|
1326
1407
|
useNativeBigInt: true
|
|
1327
1408
|
});
|
|
@@ -1994,4 +2075,4 @@ class UniPool {
|
|
|
1994
2075
|
}, canvasCtx);
|
|
1995
2076
|
}
|
|
1996
2077
|
}
|
|
1997
|
-
export { UniDM, UniPool, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools,
|
|
2078
|
+
export { UniDM, UniPool, bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe, dm_gen_namespaceObject as UniDMTools, id_gen_namespaceObject as UniIDTools, platform_namespaceObject as platform, plugins_namespaceObject as plugins, src_DM_format as DM_format };
|
|
@@ -1,77 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DateTime } from "luxon";
|
|
3
|
-
import { UniPool, platform_PlatformVideoSource } from "../index.js";
|
|
4
|
-
var dedupe_namespaceObject = {};
|
|
5
|
-
__webpack_require__.r(dedupe_namespaceObject);
|
|
6
|
-
__webpack_require__.d(dedupe_namespaceObject, {
|
|
7
|
-
bili_dedupe: ()=>bili_dedupe,
|
|
8
|
-
to_bili_deduped: ()=>to_bili_deduped
|
|
9
|
-
});
|
|
10
|
-
var bili_namespaceObject = {};
|
|
11
|
-
__webpack_require__.r(bili_namespaceObject);
|
|
12
|
-
__webpack_require__.d(bili_namespaceObject, {
|
|
13
|
-
bili_dedupe: ()=>dedupe_namespaceObject,
|
|
14
|
-
bili_history_fast_forward: ()=>bili_history_fast_forward
|
|
15
|
-
});
|
|
16
|
-
function main(that) {
|
|
17
|
-
that.dans.forEach((d)=>{
|
|
18
|
-
if (d.platform !== platform_PlatformVideoSource.Bilibili) throw new Error('bili-dedupe: 仅支持B站(主站)的弹幕');
|
|
19
|
-
if (!d.extra.bili?.dmid) throw new Error('bili-dedupe: 弹幕缺少bili extra dmid字段');
|
|
20
|
-
});
|
|
21
|
-
const map = new Map();
|
|
22
|
-
that.dans.forEach((d)=>map.set(d.extra.bili.dmid, d));
|
|
23
|
-
return map;
|
|
24
|
-
}
|
|
25
|
-
function to_bili_deduped(that) {
|
|
26
|
-
const map = main(that);
|
|
27
|
-
return new UniPool([
|
|
28
|
-
...map.values()
|
|
29
|
-
], that.options, that.info);
|
|
30
|
-
}
|
|
31
|
-
function bili_dedupe(that) {
|
|
32
|
-
const map = main(that);
|
|
33
|
-
that.dans = [
|
|
34
|
-
...map.values()
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
function history_danmaku_fast_forward_main(that, query_history_date) {
|
|
38
|
-
const qhd = DateTime.fromFormat(query_history_date, 'yyyy-MM-dd', {
|
|
39
|
-
zone: 'Asia/Shanghai'
|
|
40
|
-
}).setZone('Asia/Shanghai');
|
|
41
|
-
if (!qhd.isValid) throw new Error('Invalid query_history_date');
|
|
42
|
-
const s = qhd.startOf('day');
|
|
43
|
-
const before = that.dans.filter((d)=>d.ctime < s.toJSDate());
|
|
44
|
-
if (0 === before.length) return {
|
|
45
|
-
earliest: null,
|
|
46
|
-
FastForward: [],
|
|
47
|
-
skip: [],
|
|
48
|
-
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
49
|
-
};
|
|
50
|
-
const earliestCtime = before.toSorted((a, b)=>a.ctime.getTime() - b.ctime.getTime())[0].ctime;
|
|
51
|
-
const earliestDate = DateTime.fromJSDate(earliestCtime).setZone('Asia/Shanghai').startOf('day');
|
|
52
|
-
const datesWithDanmaku = new Set();
|
|
53
|
-
for (const dan of before){
|
|
54
|
-
const dateStr = DateTime.fromJSDate(dan.ctime).setZone('Asia/Shanghai').toFormat('yyyy-MM-dd');
|
|
55
|
-
datesWithDanmaku.add(dateStr);
|
|
56
|
-
}
|
|
57
|
-
let current = earliestDate;
|
|
58
|
-
const allDates = [];
|
|
59
|
-
while(current < s){
|
|
60
|
-
allDates.push(current.toFormat('yyyy-MM-dd'));
|
|
61
|
-
current = current.plus({
|
|
62
|
-
days: 1
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
const FastForward = allDates.filter((d)=>datesWithDanmaku.has(d));
|
|
66
|
-
const skip = allDates.filter((d)=>!datesWithDanmaku.has(d));
|
|
67
|
-
return {
|
|
68
|
-
earliest: earliestDate.toFormat('yyyy-MM-dd'),
|
|
69
|
-
FastForward,
|
|
70
|
-
skip,
|
|
71
|
-
SpecificDate: qhd.toFormat('yyyy-MM-dd')
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function bili_history_fast_forward(query_history_date) {
|
|
75
|
-
return (that)=>history_danmaku_fast_forward_main(that, query_history_date);
|
|
76
|
-
}
|
|
77
|
-
export { bili_history_fast_forward, bili_namespaceObject as bili, dedupe_namespaceObject as bili_dedupe };
|
|
1
|
+
export { bili_dedupe, bili_history_fast_forward } from "../index.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { bili } from "
|
|
1
|
+
export { bili } from "../index.js";
|
|
2
2
|
export { stats } from "./stats.js";
|
package/dist/node/src/index.d.ts
CHANGED