@forward-widget/danmu-universe 0.0.1 → 0.0.3
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 +6 -12
- package/dist/danmu-universe.js +217 -163
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -7,19 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
## 支持的平台
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
10
|
+
- 腾讯视频
|
|
11
|
+
- 优酷视频
|
|
12
|
+
- 爱奇艺
|
|
13
|
+
- 哔哩哔哩
|
|
14
14
|
|
|
15
|
-
## 功能特性
|
|
16
|
-
|
|
17
|
-
- ✨ **多平台支持**: 统一接口访问多个视频平台的弹幕数据
|
|
18
|
-
- 🔍 **智能搜索**: 基于TMDB ID和豆瓣ID进行内容匹配
|
|
19
|
-
- ⚡ **高性能**: 支持分段加载和时间切片的弹幕获取
|
|
20
|
-
- 🛡️ **类型安全**: 完整的TypeScript类型定义
|
|
21
|
-
- 🎯 **精确定位**: 支持按时间点获取特定时段的弹幕
|
|
22
|
-
- 📦 **轻量级**: 优化的构建输出,最小化依赖
|
|
23
15
|
|
|
24
16
|
## 安装使用
|
|
25
17
|
|
|
@@ -33,6 +25,8 @@ https://unpkg.com/@forward-widget/danmu-universe
|
|
|
33
25
|
|
|
34
26
|
## 开发
|
|
35
27
|
|
|
28
|
+
欢迎社区贡献,如果你想为项目做出贡献
|
|
29
|
+
|
|
36
30
|
### 环境要求
|
|
37
31
|
|
|
38
32
|
- Node.js >= 24
|
package/dist/danmu-universe.js
CHANGED
|
@@ -267,7 +267,7 @@ var __webpack_modules__ = {
|
|
|
267
267
|
e = this.words = e || [], t != n ? this.sigBytes = n : this.sigBytes = 4 * e.length;
|
|
268
268
|
},
|
|
269
269
|
toString: function(e) {
|
|
270
|
-
return (e ||
|
|
270
|
+
return (e || d).stringify(this);
|
|
271
271
|
},
|
|
272
272
|
concat: function(e) {
|
|
273
273
|
var t = this.words, n = e.words, r = this.sigBytes, i = e.sigBytes;
|
|
@@ -290,7 +290,7 @@ var __webpack_modules__ = {
|
|
|
290
290
|
for(var t = [], n = 0; n < e; n += 4)t.push(i());
|
|
291
291
|
return new l.init(t, e);
|
|
292
292
|
}
|
|
293
|
-
}), c = s.enc = {},
|
|
293
|
+
}), c = s.enc = {}, d = c.Hex = {
|
|
294
294
|
stringify: function(e) {
|
|
295
295
|
for(var t = e.words, n = e.sigBytes, r = [], i = 0; i < n; i++){
|
|
296
296
|
var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
|
|
@@ -302,7 +302,7 @@ var __webpack_modules__ = {
|
|
|
302
302
|
for(var t = e.length, n = [], r = 0; r < t; r += 2)n[r >>> 3] |= parseInt(e.substr(r, 2), 16) << 24 - r % 8 * 4;
|
|
303
303
|
return new l.init(n, t / 2);
|
|
304
304
|
}
|
|
305
|
-
},
|
|
305
|
+
}, p = c.Latin1 = {
|
|
306
306
|
stringify: function(e) {
|
|
307
307
|
for(var t = e.words, n = e.sigBytes, r = [], i = 0; i < n; i++){
|
|
308
308
|
var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 0xff;
|
|
@@ -317,13 +317,13 @@ var __webpack_modules__ = {
|
|
|
317
317
|
}, f = c.Utf8 = {
|
|
318
318
|
stringify: function(e) {
|
|
319
319
|
try {
|
|
320
|
-
return decodeURIComponent(escape(
|
|
320
|
+
return decodeURIComponent(escape(p.stringify(e)));
|
|
321
321
|
} catch (e) {
|
|
322
322
|
throw Error('Malformed UTF-8 data');
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
325
|
parse: function(e) {
|
|
326
|
-
return
|
|
326
|
+
return p.parse(unescape(encodeURIComponent(e)));
|
|
327
327
|
}
|
|
328
328
|
}, h = a.BufferedBlockAlgorithm = u.extend({
|
|
329
329
|
reset: function() {
|
|
@@ -335,7 +335,7 @@ var __webpack_modules__ = {
|
|
|
335
335
|
_process: function(t) {
|
|
336
336
|
var n, r = this._data, i = r.words, o = r.sigBytes, s = this.blockSize, a = o / (4 * s), u = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * s, c = e.min(4 * u, o);
|
|
337
337
|
if (u) {
|
|
338
|
-
for(var
|
|
338
|
+
for(var d = 0; d < u; d += s)this._doProcessBlock(i, d);
|
|
339
339
|
n = i.splice(0, u), r.sigBytes -= c;
|
|
340
340
|
}
|
|
341
341
|
return new l.init(n, c);
|
|
@@ -448,8 +448,8 @@ var __webpack_modules__ = {
|
|
|
448
448
|
var r = t + n, i = e[r];
|
|
449
449
|
e[r] = (i << 8 | i >>> 24) & 0x00ff00ff | (i << 24 | i >>> 8) & 0xff00ff00;
|
|
450
450
|
}
|
|
451
|
-
var o = this._hash.words, s = e[t + 0], u = e[t + 1], f = e[t + 2], h = e[t + 3], m = e[t + 4], g = e[t + 5], y = e[t + 6], v = e[t + 7], b = e[t + 8], _ = e[t + 9], w = e[t + 10], k = e[t + 11], x = e[t + 12], j = e[t + 13], E = e[t + 14],
|
|
452
|
-
|
|
451
|
+
var o = this._hash.words, s = e[t + 0], u = e[t + 1], f = e[t + 2], h = e[t + 3], m = e[t + 4], g = e[t + 5], y = e[t + 6], v = e[t + 7], b = e[t + 8], _ = e[t + 9], w = e[t + 10], k = e[t + 11], x = e[t + 12], j = e[t + 13], E = e[t + 14], S = e[t + 15], z = o[0], O = o[1], I = o[2], $ = o[3];
|
|
452
|
+
z = l(z, O, I, $, s, 7, a[0]), $ = l($, z, O, I, u, 12, a[1]), I = l(I, $, z, O, f, 17, a[2]), O = l(O, I, $, z, h, 22, a[3]), z = l(z, O, I, $, m, 7, a[4]), $ = l($, z, O, I, g, 12, a[5]), I = l(I, $, z, O, y, 17, a[6]), O = l(O, I, $, z, v, 22, a[7]), z = l(z, O, I, $, b, 7, a[8]), $ = l($, z, O, I, _, 12, a[9]), I = l(I, $, z, O, w, 17, a[10]), O = l(O, I, $, z, k, 22, a[11]), z = l(z, O, I, $, x, 7, a[12]), $ = l($, z, O, I, j, 12, a[13]), I = l(I, $, z, O, E, 17, a[14]), O = l(O, I, $, z, S, 22, a[15]), z = c(z, O, I, $, u, 5, a[16]), $ = c($, z, O, I, y, 9, a[17]), I = c(I, $, z, O, k, 14, a[18]), O = c(O, I, $, z, s, 20, a[19]), z = c(z, O, I, $, g, 5, a[20]), $ = c($, z, O, I, w, 9, a[21]), I = c(I, $, z, O, S, 14, a[22]), O = c(O, I, $, z, m, 20, a[23]), z = c(z, O, I, $, _, 5, a[24]), $ = c($, z, O, I, E, 9, a[25]), I = c(I, $, z, O, h, 14, a[26]), O = c(O, I, $, z, b, 20, a[27]), z = c(z, O, I, $, j, 5, a[28]), $ = c($, z, O, I, f, 9, a[29]), I = c(I, $, z, O, v, 14, a[30]), O = c(O, I, $, z, x, 20, a[31]), z = d(z, O, I, $, g, 4, a[32]), $ = d($, z, O, I, b, 11, a[33]), I = d(I, $, z, O, k, 16, a[34]), O = d(O, I, $, z, E, 23, a[35]), z = d(z, O, I, $, u, 4, a[36]), $ = d($, z, O, I, m, 11, a[37]), I = d(I, $, z, O, v, 16, a[38]), O = d(O, I, $, z, w, 23, a[39]), z = d(z, O, I, $, j, 4, a[40]), $ = d($, z, O, I, s, 11, a[41]), I = d(I, $, z, O, h, 16, a[42]), O = d(O, I, $, z, y, 23, a[43]), z = d(z, O, I, $, _, 4, a[44]), $ = d($, z, O, I, x, 11, a[45]), I = d(I, $, z, O, S, 16, a[46]), O = d(O, I, $, z, f, 23, a[47]), z = p(z, O, I, $, s, 6, a[48]), $ = p($, z, O, I, v, 10, a[49]), I = p(I, $, z, O, E, 15, a[50]), O = p(O, I, $, z, g, 21, a[51]), z = p(z, O, I, $, x, 6, a[52]), $ = p($, z, O, I, h, 10, a[53]), I = p(I, $, z, O, w, 15, a[54]), O = p(O, I, $, z, u, 21, a[55]), z = p(z, O, I, $, b, 6, a[56]), $ = p($, z, O, I, S, 10, a[57]), I = p(I, $, z, O, y, 15, a[58]), O = p(O, I, $, z, j, 21, a[59]), z = p(z, O, I, $, m, 6, a[60]), $ = p($, z, O, I, k, 10, a[61]), I = p(I, $, z, O, f, 15, a[62]), O = p(O, I, $, z, _, 21, a[63]), o[0] = o[0] + z | 0, o[1] = o[1] + O | 0, o[2] = o[2] + I | 0, o[3] = o[3] + $ | 0;
|
|
453
453
|
},
|
|
454
454
|
_doFinalize: function() {
|
|
455
455
|
var e = this._data, n = e.words, r = 8 * this._nDataBytes, i = 8 * e.sigBytes;
|
|
@@ -475,11 +475,11 @@ var __webpack_modules__ = {
|
|
|
475
475
|
var a = e + (t & r | n & ~r) + i + s;
|
|
476
476
|
return (a << o | a >>> 32 - o) + t;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function d(e, t, n, r, i, o, s) {
|
|
479
479
|
var a = e + (t ^ n ^ r) + i + s;
|
|
480
480
|
return (a << o | a >>> 32 - o) + t;
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function p(e, t, n, r, i, o, s) {
|
|
483
483
|
var a = e + (n ^ (t | ~r)) + i + s;
|
|
484
484
|
return (a << o | a >>> 32 - o) + t;
|
|
485
485
|
}
|
|
@@ -519,7 +519,7 @@ var __webpack_modules__ = {
|
|
|
519
519
|
})(e);
|
|
520
520
|
} : l;
|
|
521
521
|
};
|
|
522
|
-
function
|
|
522
|
+
function d() {
|
|
523
523
|
var e = new o(0, 0), t = 0;
|
|
524
524
|
if (this.len - this.pos > 4) {
|
|
525
525
|
for(; t < 4; ++t)if (e.lo = (e.lo | (127 & this.buf[this.pos]) << 7 * t) >>> 0, this.buf[this.pos++] < 128) return e;
|
|
@@ -540,12 +540,12 @@ var __webpack_modules__ = {
|
|
|
540
540
|
}
|
|
541
541
|
throw Error("invalid varint encoding");
|
|
542
542
|
}
|
|
543
|
-
function
|
|
543
|
+
function p(e, t) {
|
|
544
544
|
return (e[t - 4] | e[t - 3] << 8 | e[t - 2] << 16 | e[t - 1] << 24) >>> 0;
|
|
545
545
|
}
|
|
546
546
|
function f() {
|
|
547
547
|
if (this.pos + 8 > this.len) throw a(this, 8);
|
|
548
|
-
return new o(
|
|
548
|
+
return new o(p(this.buf, this.pos += 4), p(this.buf, this.pos += 4));
|
|
549
549
|
}
|
|
550
550
|
u.create = c(), u.prototype._slice = i.Array.prototype.subarray || i.Array.prototype.slice, u.prototype.uint32 = function() {
|
|
551
551
|
var e = 4294967295;
|
|
@@ -563,10 +563,10 @@ var __webpack_modules__ = {
|
|
|
563
563
|
return 0 !== this.uint32();
|
|
564
564
|
}, u.prototype.fixed32 = function() {
|
|
565
565
|
if (this.pos + 4 > this.len) throw a(this, 4);
|
|
566
|
-
return
|
|
566
|
+
return p(this.buf, this.pos += 4);
|
|
567
567
|
}, u.prototype.sfixed32 = function() {
|
|
568
568
|
if (this.pos + 4 > this.len) throw a(this, 4);
|
|
569
|
-
return 0 |
|
|
569
|
+
return 0 | p(this.buf, this.pos += 4);
|
|
570
570
|
}, u.prototype.float = function() {
|
|
571
571
|
if (this.pos + 4 > this.len) throw a(this, 4);
|
|
572
572
|
var e = i.float.readFloatLE(this.buf, this.pos);
|
|
@@ -620,13 +620,13 @@ var __webpack_modules__ = {
|
|
|
620
620
|
var t = i.Long ? "toLong" : "toNumber";
|
|
621
621
|
i.merge(u.prototype, {
|
|
622
622
|
int64: function() {
|
|
623
|
-
return
|
|
623
|
+
return d.call(this)[t](!1);
|
|
624
624
|
},
|
|
625
625
|
uint64: function() {
|
|
626
|
-
return
|
|
626
|
+
return d.call(this)[t](!0);
|
|
627
627
|
},
|
|
628
628
|
sint64: function() {
|
|
629
|
-
return
|
|
629
|
+
return d.call(this).zzDecode()[t](!1);
|
|
630
630
|
},
|
|
631
631
|
fixed64: function() {
|
|
632
632
|
return f.call(this)[t](!0);
|
|
@@ -843,7 +843,7 @@ var __webpack_modules__ = {
|
|
|
843
843
|
};
|
|
844
844
|
},
|
|
845
845
|
"../../node_modules/.pnpm/protobufjs@7.5.4/node_modules/protobufjs/src/writer.js": function(e, t, n) {
|
|
846
|
-
e.exports =
|
|
846
|
+
e.exports = d;
|
|
847
847
|
var r, i = n("../../node_modules/.pnpm/protobufjs@7.5.4/node_modules/protobufjs/src/util/minimal.js"), o = i.LongBits, s = i.base64, a = i.utf8;
|
|
848
848
|
function u(e, t, n) {
|
|
849
849
|
this.fn = e, this.len = t, this.next = void 0, this.val = n;
|
|
@@ -852,16 +852,16 @@ var __webpack_modules__ = {
|
|
|
852
852
|
function c(e) {
|
|
853
853
|
this.head = e.head, this.tail = e.tail, this.len = e.len, this.next = e.states;
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function d() {
|
|
856
856
|
this.len = 0, this.head = new u(l, 0, 0), this.tail = this.head, this.states = null;
|
|
857
857
|
}
|
|
858
|
-
var
|
|
858
|
+
var p = function() {
|
|
859
859
|
return i.Buffer ? function() {
|
|
860
|
-
return (
|
|
860
|
+
return (d.create = function() {
|
|
861
861
|
return new r();
|
|
862
862
|
})();
|
|
863
863
|
} : function() {
|
|
864
|
-
return new
|
|
864
|
+
return new d();
|
|
865
865
|
};
|
|
866
866
|
};
|
|
867
867
|
function f(e, t, n) {
|
|
@@ -882,32 +882,32 @@ var __webpack_modules__ = {
|
|
|
882
882
|
function y(e, t, n) {
|
|
883
883
|
t[n] = 255 & e, t[n + 1] = e >>> 8 & 255, t[n + 2] = e >>> 16 & 255, t[n + 3] = e >>> 24;
|
|
884
884
|
}
|
|
885
|
-
|
|
885
|
+
d.create = p(), d.alloc = function(e) {
|
|
886
886
|
return new i.Array(e);
|
|
887
|
-
}, i.Array !== Array && (
|
|
887
|
+
}, i.Array !== Array && (d.alloc = i.pool(d.alloc, i.Array.prototype.subarray)), d.prototype._push = function(e, t, n) {
|
|
888
888
|
return this.tail = this.tail.next = new u(e, t, n), this.len += t, this;
|
|
889
|
-
}, m.prototype = Object.create(u.prototype), m.prototype.fn = h,
|
|
889
|
+
}, m.prototype = Object.create(u.prototype), m.prototype.fn = h, d.prototype.uint32 = function(e) {
|
|
890
890
|
return this.len += (this.tail = this.tail.next = new m((e >>>= 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5, e)).len, this;
|
|
891
|
-
},
|
|
891
|
+
}, d.prototype.int32 = function(e) {
|
|
892
892
|
return e < 0 ? this._push(g, 10, o.fromNumber(e)) : this.uint32(e);
|
|
893
|
-
},
|
|
893
|
+
}, d.prototype.sint32 = function(e) {
|
|
894
894
|
return this.uint32((e << 1 ^ e >> 31) >>> 0);
|
|
895
|
-
},
|
|
895
|
+
}, d.prototype.uint64 = function(e) {
|
|
896
896
|
var t = o.from(e);
|
|
897
897
|
return this._push(g, t.length(), t);
|
|
898
|
-
},
|
|
898
|
+
}, d.prototype.int64 = d.prototype.uint64, d.prototype.sint64 = function(e) {
|
|
899
899
|
var t = o.from(e).zzEncode();
|
|
900
900
|
return this._push(g, t.length(), t);
|
|
901
|
-
},
|
|
901
|
+
}, d.prototype.bool = function(e) {
|
|
902
902
|
return this._push(f, 1, +!!e);
|
|
903
|
-
},
|
|
903
|
+
}, d.prototype.fixed32 = function(e) {
|
|
904
904
|
return this._push(y, 4, e >>> 0);
|
|
905
|
-
},
|
|
905
|
+
}, d.prototype.sfixed32 = d.prototype.fixed32, d.prototype.fixed64 = function(e) {
|
|
906
906
|
var t = o.from(e);
|
|
907
907
|
return this._push(y, 4, t.lo)._push(y, 4, t.hi);
|
|
908
|
-
},
|
|
908
|
+
}, d.prototype.sfixed64 = d.prototype.fixed64, d.prototype.float = function(e) {
|
|
909
909
|
return this._push(i.float.writeFloatLE, 4, e);
|
|
910
|
-
},
|
|
910
|
+
}, d.prototype.double = function(e) {
|
|
911
911
|
return this._push(i.float.writeDoubleLE, 8, e);
|
|
912
912
|
};
|
|
913
913
|
var v = i.Array.prototype.set ? function(e, t, n) {
|
|
@@ -915,29 +915,29 @@ var __webpack_modules__ = {
|
|
|
915
915
|
} : function(e, t, n) {
|
|
916
916
|
for(var r = 0; r < e.length; ++r)t[n + r] = e[r];
|
|
917
917
|
};
|
|
918
|
-
|
|
918
|
+
d.prototype.bytes = function(e) {
|
|
919
919
|
var t = e.length >>> 0;
|
|
920
920
|
if (!t) return this._push(f, 1, 0);
|
|
921
921
|
if (i.isString(e)) {
|
|
922
|
-
var n =
|
|
922
|
+
var n = d.alloc(t = s.length(e));
|
|
923
923
|
s.decode(e, n, 0), e = n;
|
|
924
924
|
}
|
|
925
925
|
return this.uint32(t)._push(v, t, e);
|
|
926
|
-
},
|
|
926
|
+
}, d.prototype.string = function(e) {
|
|
927
927
|
var t = a.length(e);
|
|
928
928
|
return t ? this.uint32(t)._push(a.write, t, e) : this._push(f, 1, 0);
|
|
929
|
-
},
|
|
929
|
+
}, d.prototype.fork = function() {
|
|
930
930
|
return this.states = new c(this), this.head = this.tail = new u(l, 0, 0), this.len = 0, this;
|
|
931
|
-
},
|
|
931
|
+
}, d.prototype.reset = function() {
|
|
932
932
|
return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new u(l, 0, 0), this.len = 0), this;
|
|
933
|
-
},
|
|
933
|
+
}, d.prototype.ldelim = function() {
|
|
934
934
|
var e = this.head, t = this.tail, n = this.len;
|
|
935
935
|
return this.reset().uint32(n), n && (this.tail.next = e.next, this.tail = t, this.len += n), this;
|
|
936
|
-
},
|
|
936
|
+
}, d.prototype.finish = function() {
|
|
937
937
|
for(var e = this.head.next, t = this.constructor.alloc(this.len), n = 0; e;)e.fn(e.val, t, n), n += e.len, e = e.next;
|
|
938
938
|
return t;
|
|
939
|
-
},
|
|
940
|
-
r = e,
|
|
939
|
+
}, d._configure = function(e) {
|
|
940
|
+
r = e, d.create = p(), r._configure();
|
|
941
941
|
};
|
|
942
942
|
},
|
|
943
943
|
"../../node_modules/.pnpm/protobufjs@7.5.4/node_modules/protobufjs/src/writer_buffer.js": function(e, t, n) {
|
|
@@ -1021,10 +1021,10 @@ var __webpack_modules__ = {
|
|
|
1021
1021
|
},
|
|
1022
1022
|
"../../node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js": function(e, t, n) {
|
|
1023
1023
|
var r = n("../../node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js"), i = n("../../node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js"), o = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, s = /[\n\r\t]/g, a = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, u = /:\d+$/, l = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, c = /^[a-zA-Z]:/;
|
|
1024
|
-
function
|
|
1024
|
+
function d(e) {
|
|
1025
1025
|
return (e || '').toString().replace(o, '');
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1027
|
+
var p = [
|
|
1028
1028
|
[
|
|
1029
1029
|
'#',
|
|
1030
1030
|
'hash'
|
|
@@ -1083,7 +1083,7 @@ var __webpack_modules__ = {
|
|
|
1083
1083
|
return 'file:' === e || 'ftp:' === e || 'http:' === e || 'https:' === e || 'ws:' === e || 'wss:' === e;
|
|
1084
1084
|
}
|
|
1085
1085
|
function g(e, t) {
|
|
1086
|
-
e = (e =
|
|
1086
|
+
e = (e = d(e)).replace(s, ''), t = t || {};
|
|
1087
1087
|
var n, r = l.exec(e), i = r[1] ? r[1].toLowerCase() : '', o = !!r[2], a = !!r[3], u = 0;
|
|
1088
1088
|
return o ? a ? (n = r[2] + r[3] + r[4], u = r[2].length + r[3].length) : (n = r[2] + r[4], u = r[2].length) : a ? (n = r[3] + r[4], u = r[3].length) : n = r[4], 'file:' === i ? u >= 2 && (n = n.slice(2)) : m(i) ? n = r[4] : i ? o && (n = n.slice(2)) : u >= 2 && m(t.protocol) && (n = r[4]), {
|
|
1089
1089
|
protocol: i,
|
|
@@ -1098,8 +1098,8 @@ var __webpack_modules__ = {
|
|
|
1098
1098
|
return o && n.unshift(''), ('.' === i || '..' === i) && n.push(''), n.join('/');
|
|
1099
1099
|
}
|
|
1100
1100
|
function v(e, t, n) {
|
|
1101
|
-
if (e = (e =
|
|
1102
|
-
var o, a, u, l, f, b, _ =
|
|
1101
|
+
if (e = (e = d(e)).replace(s, ''), !(this instanceof v)) return new v(e, t, n);
|
|
1102
|
+
var o, a, u, l, f, b, _ = p.slice(), w = typeof t, k = this, x = 0;
|
|
1103
1103
|
for('object' !== w && 'string' !== w && (n = t, t = null), n && 'function' != typeof n && (n = i.parse), o = !(a = g(e || '', t = h(t))).protocol && !a.slashes, k.slashes = a.slashes || o && t.slashes, k.protocol = a.protocol || t.protocol || '', e = a.rest, ('file:' === a.protocol && (2 !== a.slashesCount || c.test(e)) || !a.slashes && (a.protocol || a.slashesCount < 2 || !m(k.protocol))) && (_[3] = [
|
|
1104
1104
|
/(.*)/,
|
|
1105
1105
|
'pathname'
|
|
@@ -1146,8 +1146,8 @@ var __webpack_modules__ = {
|
|
|
1146
1146
|
var a = t.indexOf(':');
|
|
1147
1147
|
~a ? (o.username = t.slice(0, a), o.username = encodeURIComponent(decodeURIComponent(o.username)), o.password = t.slice(a + 1), o.password = encodeURIComponent(decodeURIComponent(o.password))) : o.username = encodeURIComponent(decodeURIComponent(t));
|
|
1148
1148
|
}
|
|
1149
|
-
for(var l = 0; l <
|
|
1150
|
-
var c =
|
|
1149
|
+
for(var l = 0; l < p.length; l++){
|
|
1150
|
+
var c = p[l];
|
|
1151
1151
|
c[4] && (o[c[1]] = o[c[1]].toLowerCase());
|
|
1152
1152
|
}
|
|
1153
1153
|
return o.auth = o.password ? o.username + ':' + o.password : o.username, o.origin = 'file:' !== o.protocol && m(o.protocol) && o.host ? o.protocol + '//' + o.host : 'null', o.href = o.toString(), o;
|
|
@@ -1159,7 +1159,7 @@ var __webpack_modules__ = {
|
|
|
1159
1159
|
var s = o + (n.protocol && n.slashes || m(n.protocol) ? '//' : '');
|
|
1160
1160
|
return n.username ? (s += n.username, n.password && (s += ':' + n.password), s += '@') : n.password ? (s += ':' + n.password, s += '@') : 'file:' !== n.protocol && m(n.protocol) && !r && '/' !== n.pathname && (s += '@'), (':' === r[r.length - 1] || u.test(n.hostname) && !n.port) && (r += ':'), s += r + n.pathname, (t = 'object' == typeof n.query ? e(n.query) : n.query) && (s += '?' !== t.charAt(0) ? '?' + t : t), n.hash && (s += n.hash), s;
|
|
1161
1161
|
}
|
|
1162
|
-
}, v.extractProtocol = g, v.location = h, v.trimLeft =
|
|
1162
|
+
}, v.extractProtocol = g, v.location = h, v.trimLeft = d, v.qs = i, e.exports = v;
|
|
1163
1163
|
},
|
|
1164
1164
|
"?370f": function() {}
|
|
1165
1165
|
}, __webpack_module_cache__ = {};
|
|
@@ -2368,46 +2368,46 @@ const $ZodObject = $constructor("$ZodObject", (e, t)=>{
|
|
|
2368
2368
|
let a = t.compile();
|
|
2369
2369
|
return (t, n)=>a(e, t, n);
|
|
2370
2370
|
}, s = util_isObject, a = !globalConfig.jitless, u = util_allowsEval, l = a && u.value, c = t.catchall;
|
|
2371
|
-
e._zod.parse = (u,
|
|
2371
|
+
e._zod.parse = (u, d)=>{
|
|
2372
2372
|
r ?? (r = i.value);
|
|
2373
|
-
let
|
|
2374
|
-
if (!s(
|
|
2373
|
+
let p = u.value;
|
|
2374
|
+
if (!s(p)) return u.issues.push({
|
|
2375
2375
|
expected: "object",
|
|
2376
2376
|
code: "invalid_type",
|
|
2377
|
-
input:
|
|
2377
|
+
input: p,
|
|
2378
2378
|
inst: e
|
|
2379
2379
|
}), u;
|
|
2380
2380
|
let f = [];
|
|
2381
|
-
if (a && l &&
|
|
2381
|
+
if (a && l && d?.async === !1 && !0 !== d.jitless) n || (n = o(t.shape)), u = n(u, d);
|
|
2382
2382
|
else {
|
|
2383
2383
|
u.value = {};
|
|
2384
2384
|
let e = r.shape;
|
|
2385
2385
|
for (let t of r.keys){
|
|
2386
2386
|
let n = e[t]._zod.run({
|
|
2387
|
-
value:
|
|
2387
|
+
value: p[t],
|
|
2388
2388
|
issues: []
|
|
2389
|
-
},
|
|
2390
|
-
n instanceof Promise ? f.push(n.then((e)=>handlePropertyResult(e, u, t,
|
|
2389
|
+
}, d);
|
|
2390
|
+
n instanceof Promise ? f.push(n.then((e)=>handlePropertyResult(e, u, t, p))) : handlePropertyResult(n, u, t, p);
|
|
2391
2391
|
}
|
|
2392
2392
|
}
|
|
2393
2393
|
if (!c) return f.length ? Promise.all(f).then(()=>u) : u;
|
|
2394
2394
|
let h = [], m = r.keySet, g = c._zod, y = g.def.type;
|
|
2395
|
-
for (let e of Object.keys(
|
|
2395
|
+
for (let e of Object.keys(p)){
|
|
2396
2396
|
if (m.has(e)) continue;
|
|
2397
2397
|
if ("never" === y) {
|
|
2398
2398
|
h.push(e);
|
|
2399
2399
|
continue;
|
|
2400
2400
|
}
|
|
2401
2401
|
let t = g.run({
|
|
2402
|
-
value:
|
|
2402
|
+
value: p[e],
|
|
2403
2403
|
issues: []
|
|
2404
|
-
},
|
|
2405
|
-
t instanceof Promise ? f.push(t.then((t)=>handlePropertyResult(t, u, e,
|
|
2404
|
+
}, d);
|
|
2405
|
+
t instanceof Promise ? f.push(t.then((t)=>handlePropertyResult(t, u, e, p))) : handlePropertyResult(t, u, e, p);
|
|
2406
2406
|
}
|
|
2407
2407
|
return (h.length && u.issues.push({
|
|
2408
2408
|
code: "unrecognized_keys",
|
|
2409
2409
|
keys: h,
|
|
2410
|
-
input:
|
|
2410
|
+
input: p,
|
|
2411
2411
|
inst: e
|
|
2412
2412
|
}), f.length) ? Promise.all(f).then(()=>u) : u;
|
|
2413
2413
|
};
|
|
@@ -3676,7 +3676,7 @@ class Storage {
|
|
|
3676
3676
|
let t = Widget.storage.get(e);
|
|
3677
3677
|
if (!t) return null;
|
|
3678
3678
|
let n = safeJsonParseWithZod(t, StorageValue);
|
|
3679
|
-
return n ? (null == n ? void 0 : n.expiresAt) < Date.now() ? (console.warn(`Storage value for key: ${e} has expired
|
|
3679
|
+
return n ? (null == n ? void 0 : n.expiresAt) < Date.now() ? (console.warn(`Storage value for key: ${e} has expired`), this.remove(e), null) : n.value : (console.warn(`Failed to parse storage value for key: ${e}`), this.remove(e), null);
|
|
3680
3680
|
}
|
|
3681
3681
|
set(e, t, n) {
|
|
3682
3682
|
var r;
|
|
@@ -3700,12 +3700,16 @@ class Storage {
|
|
|
3700
3700
|
return this.set(e, JSON.stringify(t), n);
|
|
3701
3701
|
}
|
|
3702
3702
|
cleanup() {
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
this.get(e)
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3703
|
+
try {
|
|
3704
|
+
let e = "__storage_last_cleanup__";
|
|
3705
|
+
this.get(e) || Widget.storage.keys().forEach((e)=>{
|
|
3706
|
+
this.get(e);
|
|
3707
|
+
}), this.set(e, "1", {
|
|
3708
|
+
ttl: TTL_1_DAY
|
|
3709
|
+
});
|
|
3710
|
+
} catch (e) {
|
|
3711
|
+
console.error("Failed to cleanup storage", e);
|
|
3712
|
+
}
|
|
3709
3713
|
}
|
|
3710
3714
|
constructor(){
|
|
3711
3715
|
_define_property(this, "defaultTTL", TTL_5_MINUTES);
|
|
@@ -3794,11 +3798,11 @@ class Fetch {
|
|
|
3794
3798
|
}
|
|
3795
3799
|
let a = o ? void 0 : n, { timeout: u, schema: l, ...c } = s;
|
|
3796
3800
|
console.debug("fetch", t, a, c);
|
|
3797
|
-
let
|
|
3801
|
+
let d = o ? Widget.http.get(t, c) : Widget.http.post(t, a, c);
|
|
3798
3802
|
return u && u > 0 ? Promise.race([
|
|
3799
|
-
|
|
3803
|
+
d,
|
|
3800
3804
|
this.createTimeoutPromise(u)
|
|
3801
|
-
]) :
|
|
3805
|
+
]) : d;
|
|
3802
3806
|
}
|
|
3803
3807
|
getCacheKey(e, t) {
|
|
3804
3808
|
var n;
|
|
@@ -3912,10 +3916,15 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3912
3916
|
switch(e.id){
|
|
3913
3917
|
case "qq":
|
|
3914
3918
|
{
|
|
3915
|
-
let { cid: e } = t.query;
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
+
let { cid: e, vid: n } = t.query;
|
|
3920
|
+
if (e) {
|
|
3921
|
+
let t = {
|
|
3922
|
+
cid: e
|
|
3923
|
+
};
|
|
3924
|
+
"movie" === o.mediaType && (t.vid = n), o.providers.tencent = {
|
|
3925
|
+
id: encodeURIComponent(JSON.stringify(t))
|
|
3926
|
+
};
|
|
3927
|
+
}
|
|
3919
3928
|
break;
|
|
3920
3929
|
}
|
|
3921
3930
|
case "iqiyi":
|
|
@@ -3938,7 +3947,9 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3938
3947
|
{
|
|
3939
3948
|
let e = t.pathname.split("/").pop();
|
|
3940
3949
|
e && /\d+/.test(e) && (o.providers.bilibili = {
|
|
3941
|
-
id:
|
|
3950
|
+
id: encodeURIComponent(JSON.stringify({
|
|
3951
|
+
seasonId: e
|
|
3952
|
+
}))
|
|
3942
3953
|
});
|
|
3943
3954
|
}
|
|
3944
3955
|
}
|
|
@@ -3988,31 +3999,39 @@ function base_define_property(e, t, n) {
|
|
|
3988
3999
|
}) : e[t] = n, e;
|
|
3989
4000
|
}
|
|
3990
4001
|
class BaseScraper {
|
|
4002
|
+
parseIdString(e) {
|
|
4003
|
+
var t, n;
|
|
4004
|
+
let r = safeJsonParse(decodeURIComponent(e)), i = null == (t = this.idSchema) ? void 0 : t.safeParse(r);
|
|
4005
|
+
return i ? i.success ? null != (n = i.data) ? n : null : (console.log(this.providerName, "parseIdString", e, prettifyError(i.error)), null) : (console.log(this.providerName, "parseIdString", e, "idSchema is not defined"), null);
|
|
4006
|
+
}
|
|
4007
|
+
generateIdString(e) {
|
|
4008
|
+
return encodeURIComponent(JSON.stringify(e));
|
|
4009
|
+
}
|
|
3991
4010
|
sleep(e) {
|
|
3992
4011
|
return new Promise((t)=>setTimeout(t, e));
|
|
3993
4012
|
}
|
|
3994
4013
|
formatComments(e, t) {
|
|
3995
|
-
let n = new Set(), r = new Map()
|
|
3996
|
-
for (let
|
|
3997
|
-
if (!
|
|
3998
|
-
let
|
|
3999
|
-
if (!
|
|
4000
|
-
n.add(
|
|
4001
|
-
let
|
|
4002
|
-
|
|
4003
|
-
item:
|
|
4014
|
+
let n = new Set(), r = new Map();
|
|
4015
|
+
for (let i of e){
|
|
4016
|
+
if (!i) continue;
|
|
4017
|
+
let e = t(i);
|
|
4018
|
+
if (!e || n.has(e.id)) continue;
|
|
4019
|
+
n.add(e.id);
|
|
4020
|
+
let o = e.content, s = r.get(o);
|
|
4021
|
+
s ? (e.timestamp < s.item.timestamp && (s.item = e), s.count += 1) : r.set(o, {
|
|
4022
|
+
item: e,
|
|
4004
4023
|
count: 1
|
|
4005
4024
|
});
|
|
4006
4025
|
}
|
|
4007
|
-
let
|
|
4026
|
+
let i = [];
|
|
4008
4027
|
return r.forEach((e)=>{
|
|
4009
4028
|
let { item: t, count: n } = e, r = n > 1 ? `${t.content} \xd7 ${n}` : t.content;
|
|
4010
|
-
|
|
4029
|
+
i.push({
|
|
4011
4030
|
cid: t.id,
|
|
4012
4031
|
p: `${t.timestamp.toFixed(2)},${t.mode},${t.color},[${this.providerName}]`,
|
|
4013
4032
|
m: r
|
|
4014
4033
|
});
|
|
4015
|
-
}),
|
|
4034
|
+
}), i;
|
|
4016
4035
|
}
|
|
4017
4036
|
getEpisodeIndexFromTitle(e) {
|
|
4018
4037
|
if (!e) return null;
|
|
@@ -4034,7 +4053,7 @@ class BaseScraper {
|
|
|
4034
4053
|
return null;
|
|
4035
4054
|
}
|
|
4036
4055
|
constructor(){
|
|
4037
|
-
base_define_property(this, "fetch", new Fetch()), base_define_property(this, "GLOBAL_EPISODE_BLACKLIST_DEFAULT", "^(.*?)((.+?\u7248)|(\u7279(\u522B|\u5178))|((\u5BFC|\u6F14)\u5458|\u5609\u5BBE|\u89D2\u8272)\u8BBF\u8C08|\u798F\u5229|\u5148\u5BFC|\u5F69\u86CB|\u82B1\u7D6E|\u9884\u544A|\u7279\u8F91|\u4E13\u8BBF|\u8BBF\u8C08|\u5E55\u540E|\u5468\u8FB9|\u8D44\u8BAF|\u770B\u70B9|\u901F\u770B|\u56DE\u987E|\u76D8\u70B9|\u5408\u96C6|PV|MV|CM|OST|ED|OP|BD|\u7279\u5178|SP|NCOP|NCED|MENU|Web-DL|rip|x264|x265|aac|flac)(.*?)$"), base_define_property(this, "PROVIDER_SPECIFIC_BLACKLIST_DEFAULT", "");
|
|
4056
|
+
base_define_property(this, "idSchema", void 0), base_define_property(this, "fetch", new Fetch()), base_define_property(this, "GLOBAL_EPISODE_BLACKLIST_DEFAULT", "^(.*?)((.+?\u7248)|(\u7279(\u522B|\u5178))|((\u5BFC|\u6F14)\u5458|\u5609\u5BBE|\u89D2\u8272)\u8BBF\u8C08|\u798F\u5229|\u5148\u5BFC|\u5F69\u86CB|\u82B1\u7D6E|\u9884\u544A|\u7279\u8F91|\u4E13\u8BBF|\u8BBF\u8C08|\u5E55\u540E|\u5468\u8FB9|\u8D44\u8BAF|\u770B\u70B9|\u901F\u770B|\u56DE\u987E|\u76D8\u70B9|\u5408\u96C6|PV|MV|CM|OST|ED|OP|BD|\u7279\u5178|SP|NCOP|NCED|MENU|Web-DL|rip|x264|x265|aac|flac)(.*?)$"), base_define_property(this, "PROVIDER_SPECIFIC_BLACKLIST_DEFAULT", "");
|
|
4038
4057
|
}
|
|
4039
4058
|
}
|
|
4040
4059
|
var minimal = __webpack_require__("../../node_modules/.pnpm/protobufjs@7.5.4/node_modules/protobufjs/minimal.js");
|
|
@@ -4286,7 +4305,11 @@ function bilibili_define_property(e, t, n) {
|
|
|
4286
4305
|
writable: !0
|
|
4287
4306
|
}) : e[t] = n, e;
|
|
4288
4307
|
}
|
|
4289
|
-
const
|
|
4308
|
+
const bilibiliIdSchema = schemas_object({
|
|
4309
|
+
seasonId: schemas_string(),
|
|
4310
|
+
aid: schemas_string().optional(),
|
|
4311
|
+
cid: schemas_string().optional()
|
|
4312
|
+
}), pgcEpisodeSchema = schemas_object({
|
|
4290
4313
|
aid: schemas_int(),
|
|
4291
4314
|
cid: schemas_int(),
|
|
4292
4315
|
badge: schemas_string(),
|
|
@@ -4302,23 +4325,28 @@ const pgcEpisodeSchema = schemas_object({
|
|
|
4302
4325
|
});
|
|
4303
4326
|
class BilibiliScraper extends BaseScraper {
|
|
4304
4327
|
async getEpisodes(e, t) {
|
|
4305
|
-
let
|
|
4328
|
+
let n = this.parseIdString(e);
|
|
4329
|
+
if (!n) return [];
|
|
4330
|
+
let r = [], i = await this.getPgcEpisodes(n.seasonId), o = this.getEpisodeBlacklistPattern(), s = 1;
|
|
4306
4331
|
for (let e of null != i ? i : [])"\u9884\u544A" !== e.badge && (null != o && o.test(e.title) || (r.push({
|
|
4307
4332
|
provider: this.providerName,
|
|
4308
|
-
episodeId:
|
|
4309
|
-
n,
|
|
4310
|
-
e.aid,
|
|
4311
|
-
e.cid
|
|
4312
|
-
|
|
4333
|
+
episodeId: this.generateIdString({
|
|
4334
|
+
seasonId: n.seasonId,
|
|
4335
|
+
aid: e.aid.toString(),
|
|
4336
|
+
cid: e.cid.toString()
|
|
4337
|
+
}),
|
|
4313
4338
|
episodeTitle: e.show_title || e.title,
|
|
4314
4339
|
episodeNumber: s
|
|
4315
4340
|
}), s += 1));
|
|
4316
4341
|
return t ? r.filter((e)=>e.episodeNumber === t) : r;
|
|
4317
4342
|
}
|
|
4318
4343
|
async getSegments(e) {
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4344
|
+
var t;
|
|
4345
|
+
let { aid: n, cid: r, seasonId: i } = null != (t = this.parseIdString(e)) ? t : {};
|
|
4346
|
+
if (!n || !r || !i) return [];
|
|
4347
|
+
let o = await this.getPgcEpisodes(i), s = null == o ? void 0 : o.find((e)=>e.aid === parseInt(n) && e.cid === parseInt(r));
|
|
4348
|
+
return s ? Array.from({
|
|
4349
|
+
length: Math.floor(s.duration / 1000 / 360) + 1
|
|
4322
4350
|
}, (e, t)=>({
|
|
4323
4351
|
provider: this.providerName,
|
|
4324
4352
|
startTime: 360 * t,
|
|
@@ -4326,10 +4354,13 @@ class BilibiliScraper extends BaseScraper {
|
|
|
4326
4354
|
})) : [];
|
|
4327
4355
|
}
|
|
4328
4356
|
async getComments(e, t) {
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4357
|
+
var n;
|
|
4358
|
+
let { aid: r, cid: i, seasonId: o } = null != (n = this.parseIdString(e)) ? n : {};
|
|
4359
|
+
if (!r || !i || !o) return [];
|
|
4360
|
+
let s = await this.getPgcEpisodes(o);
|
|
4361
|
+
if (!(null == s ? void 0 : s.find((e)=>e.aid === parseInt(r) && e.cid === parseInt(i)))) return [];
|
|
4362
|
+
let a = await this.fetchCommentsForCid(r, i, t);
|
|
4363
|
+
return this.formatComments(a, (e)=>{
|
|
4333
4364
|
var t, n, r;
|
|
4334
4365
|
if (!e.progress) return null;
|
|
4335
4366
|
let i = (null == (t = e.content) ? void 0 : t.replace(/\0/g, "")) || "";
|
|
@@ -4369,7 +4400,7 @@ class BilibiliScraper extends BaseScraper {
|
|
|
4369
4400
|
return r;
|
|
4370
4401
|
}
|
|
4371
4402
|
constructor(){
|
|
4372
|
-
super(), bilibili_define_property(this, "providerName", "bilibili"), bilibili_define_property(this, "DmSegMobileReply", dm_proto_biliproto.community.service.dm.v1.DmSegMobileReply), this.fetch.setHeaders({
|
|
4403
|
+
super(), bilibili_define_property(this, "providerName", "bilibili"), bilibili_define_property(this, "idSchema", bilibiliIdSchema), bilibili_define_property(this, "DmSegMobileReply", dm_proto_biliproto.community.service.dm.v1.DmSegMobileReply), this.fetch.setHeaders({
|
|
4373
4404
|
Referer: "https://www.bilibili.com/"
|
|
4374
4405
|
});
|
|
4375
4406
|
}
|
|
@@ -4781,17 +4812,17 @@ const parseXml = function(e) {
|
|
|
4781
4812
|
}
|
|
4782
4813
|
]) : n.add(this.options.textNodeName, a), o = t + 2;
|
|
4783
4814
|
} else {
|
|
4784
|
-
let s = readTagExp(e, o, this.options.removeNSPrefix), a = s.tagName, u = s.rawTagName, l = s.tagExp, c = s.attrExpPresent,
|
|
4815
|
+
let s = readTagExp(e, o, this.options.removeNSPrefix), a = s.tagName, u = s.rawTagName, l = s.tagExp, c = s.attrExpPresent, d = s.closeIndex;
|
|
4785
4816
|
this.options.transformTagName && (a = this.options.transformTagName(a)), n && r && '!xml' !== n.tagname && (r = this.saveTextToParentTag(r, n, i, !1));
|
|
4786
|
-
let
|
|
4787
|
-
|
|
4817
|
+
let p = n;
|
|
4818
|
+
p && -1 !== this.options.unpairedTags.indexOf(p.tagname) && (n = this.tagsNodeStack.pop(), i = i.substring(0, i.lastIndexOf("."))), a !== t.tagname && (i += i ? "." + a : a);
|
|
4788
4819
|
let f = o;
|
|
4789
4820
|
if (this.isItStopNode(this.options.stopNodes, i, a)) {
|
|
4790
4821
|
let t = "";
|
|
4791
4822
|
if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) "/" === a[a.length - 1] ? (a = a.substr(0, a.length - 1), i = i.substr(0, i.length - 1), l = a) : l = l.substr(0, l.length - 1), o = s.closeIndex;
|
|
4792
4823
|
else if (-1 !== this.options.unpairedTags.indexOf(a)) o = s.closeIndex;
|
|
4793
4824
|
else {
|
|
4794
|
-
let n = this.readStopNodeData(e, u,
|
|
4825
|
+
let n = this.readStopNodeData(e, u, d + 1);
|
|
4795
4826
|
if (!n) throw Error(`Unexpected end of ${u}`);
|
|
4796
4827
|
o = n.i, t = n.tagContent;
|
|
4797
4828
|
}
|
|
@@ -4806,7 +4837,7 @@ const parseXml = function(e) {
|
|
|
4806
4837
|
let e = new XmlNode(a);
|
|
4807
4838
|
this.tagsNodeStack.push(n), a !== l && c && (e[":@"] = this.buildAttributesMap(l, i, a)), this.addChild(n, e, i, f), n = e;
|
|
4808
4839
|
}
|
|
4809
|
-
r = "", o =
|
|
4840
|
+
r = "", o = d;
|
|
4810
4841
|
}
|
|
4811
4842
|
}
|
|
4812
4843
|
else r += e[o];
|
|
@@ -5276,7 +5307,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5276
5307
|
console.debug(`URL\u{6784}\u{5EFA}: s1=${i}, s2=${o}, \u{5B8C}\u{6574}URL=${s}`);
|
|
5277
5308
|
let a = await this.fetch.get(s, {
|
|
5278
5309
|
zlibMode: !0
|
|
5279
|
-
}), u = this.xmlParser.parse(a.data), { success: l, data: c, error:
|
|
5310
|
+
}), u = this.xmlParser.parse(a.data), { success: l, data: c, error: d } = iqiyiCommentsResponseSchema.safeParse(u);
|
|
5280
5311
|
return l ? this.formatComments(c, (e)=>{
|
|
5281
5312
|
let t = 16777215;
|
|
5282
5313
|
try {
|
|
@@ -5289,7 +5320,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5289
5320
|
color: t,
|
|
5290
5321
|
content: e.content
|
|
5291
5322
|
};
|
|
5292
|
-
}) : (console.warn(`\u{7231}\u{5947}\u{827A}: \u{89E3}\u{6790}\u{5F39}\u{5E55}\u{6570}\u{636E}\u{65F6}\u{53D1}\u{751F}\u{9519}\u{8BEF}:`, prettifyError(
|
|
5323
|
+
}) : (console.warn(`\u{7231}\u{5947}\u{827A}: \u{89E3}\u{6790}\u{5F39}\u{5E55}\u{6570}\u{636E}\u{65F6}\u{53D1}\u{751F}\u{9519}\u{8BEF}:`, prettifyError(d)), []);
|
|
5293
5324
|
}
|
|
5294
5325
|
async getEpisodesV3(e) {
|
|
5295
5326
|
let t = {
|
|
@@ -5312,7 +5343,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5312
5343
|
};
|
|
5313
5344
|
t.sign = this.createSign(t);
|
|
5314
5345
|
try {
|
|
5315
|
-
var n, r, i, o, s, a, u, l, c,
|
|
5346
|
+
var n, r, i, o, s, a, u, l, c, d, p;
|
|
5316
5347
|
let e = (await this.fetch.get("https://www.iqiyi.com/prelw/tvg/v2/lw/base_info", {
|
|
5317
5348
|
params: t,
|
|
5318
5349
|
schema: iqiyiV3ApiResponseSchema
|
|
@@ -5324,7 +5355,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5324
5355
|
url: e.play_url
|
|
5325
5356
|
}))) ? o : [];
|
|
5326
5357
|
if (!f.length) {
|
|
5327
|
-
let t = null == e || null == (
|
|
5358
|
+
let t = null == e || null == (d = e.data) || null == (c = d.template) || null == (l = c.tabs) || null == (u = l.find((e)=>e.blocks.some((e)=>"selector_bk" === e.bk_id && "album_episodes" === e.bk_type))) || null == (a = u.blocks) || null == (s = a.find((e)=>"selector_bk" === e.bk_id && "album_episodes" === e.bk_type)) ? void 0 : s.data, { success: n, data: r, error: i } = iqiyiEpisodeTabDataSchema.safeParse(t);
|
|
5328
5359
|
if (!n) return console.warn(`\u{7231}\u{5947}\u{827A}: \u{89E3}\u{6790}\u{5206}\u{96C6}\u{6570}\u{636E}\u{65F6}\u{53D1}\u{751F}\u{9519}\u{8BEF}:`, prettifyError(i), t), [];
|
|
5329
5360
|
let o = this.getEpisodeBlacklistPattern(), h = 1;
|
|
5330
5361
|
for (let e of r.data){
|
|
@@ -5334,7 +5365,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5334
5365
|
provider: this.providerName,
|
|
5335
5366
|
episodeId: t,
|
|
5336
5367
|
episodeTitle: e.title,
|
|
5337
|
-
episodeNumber: null != (
|
|
5368
|
+
episodeNumber: null != (p = this.getEpisodeIndexFromTitle(e.short_display_name)) ? p : h,
|
|
5338
5369
|
url: e.page_url
|
|
5339
5370
|
}), h += 1));
|
|
5340
5371
|
}
|
|
@@ -5396,7 +5427,10 @@ function tencent_define_property(e, t, n) {
|
|
|
5396
5427
|
writable: !0
|
|
5397
5428
|
}) : e[t] = n, e;
|
|
5398
5429
|
}
|
|
5399
|
-
const
|
|
5430
|
+
const tencentIdSchema = schemas_object({
|
|
5431
|
+
cid: schemas_string(),
|
|
5432
|
+
vid: schemas_string().optional()
|
|
5433
|
+
}), tencentEpisodeSchema = schemas_object({
|
|
5400
5434
|
vid: schemas_string().refine((e)=>!!e),
|
|
5401
5435
|
is_trailer: schemas_string().refine((e)=>"1" !== e),
|
|
5402
5436
|
title: schemas_string().refine((e)=>{
|
|
@@ -5426,6 +5460,9 @@ const tencentEpisodeSchema = schemas_object({
|
|
|
5426
5460
|
}))
|
|
5427
5461
|
}))
|
|
5428
5462
|
})
|
|
5463
|
+
}).transform((e)=>{
|
|
5464
|
+
var t, n, r, i, o, s;
|
|
5465
|
+
return null != (s = null == (o = e.data.module_list_datas) || null == (i = o[0]) || null == (r = i.module_datas) || null == (n = r[0]) || null == (t = n.item_data_lists) ? void 0 : t.item_datas) ? s : [];
|
|
5429
5466
|
}), tencentSegmentIndexSchema = schemas_object({
|
|
5430
5467
|
segment_index: record(schemas_string(), schemas_object({
|
|
5431
5468
|
segment_name: schemas_string()
|
|
@@ -5440,60 +5477,69 @@ const tencentEpisodeSchema = schemas_object({
|
|
|
5440
5477
|
content_style: schemas_string().optional().transform((e)=>safeJsonParseWithZod(null != e ? e : "", tencentContentStyleSchema))
|
|
5441
5478
|
}), tencentSegmentSchema = schemas_object({
|
|
5442
5479
|
barrage_list: schemas_array(unknown().transform((e)=>{
|
|
5443
|
-
|
|
5444
|
-
return t ?
|
|
5480
|
+
var t;
|
|
5481
|
+
return null != (t = tencentCommentItemSchema.safeParse(e).data) ? t : null;
|
|
5445
5482
|
})).transform((e)=>e.filter((e)=>null !== e))
|
|
5446
5483
|
}), tencent_pageSize = 100;
|
|
5447
5484
|
class TencentScraper extends BaseScraper {
|
|
5448
5485
|
async getEpisodes(e, t) {
|
|
5449
|
-
let n =
|
|
5450
|
-
|
|
5451
|
-
|
|
5486
|
+
let n = this.parseIdString(e);
|
|
5487
|
+
if (!n) return [];
|
|
5488
|
+
let r = (await this.internalGetEpisodes(n.cid)).map((e, t)=>{
|
|
5489
|
+
let r = this.getEpisodeIndexFromTitle(e.title);
|
|
5490
|
+
return r || (r = t + 1), {
|
|
5452
5491
|
provider: this.providerName,
|
|
5453
|
-
episodeId:
|
|
5454
|
-
|
|
5492
|
+
episodeId: this.generateIdString({
|
|
5493
|
+
cid: n.cid,
|
|
5494
|
+
vid: e.vid
|
|
5495
|
+
}),
|
|
5496
|
+
episodeTitle: e.union_title && e.union_title !== e.title ? e.union_title : e.title,
|
|
5455
5497
|
episodeNumber: r,
|
|
5456
|
-
url: `https://v.qq.com/x/cover/${
|
|
5498
|
+
url: `https://v.qq.com/x/cover/${n.cid}/${e.vid}.html`
|
|
5457
5499
|
};
|
|
5458
5500
|
});
|
|
5459
5501
|
if (void 0 !== t) {
|
|
5460
|
-
let e =
|
|
5502
|
+
let e = r.find((e)=>e.episodeNumber === t);
|
|
5461
5503
|
return e ? [
|
|
5462
5504
|
e
|
|
5463
5505
|
] : [];
|
|
5464
5506
|
}
|
|
5465
|
-
return
|
|
5507
|
+
return r;
|
|
5466
5508
|
}
|
|
5467
5509
|
async getSegments(e) {
|
|
5468
|
-
let t =
|
|
5510
|
+
let t = this.parseIdString(e);
|
|
5511
|
+
if (!t) return [];
|
|
5512
|
+
let n = {};
|
|
5469
5513
|
try {
|
|
5470
|
-
var
|
|
5471
|
-
let
|
|
5514
|
+
var r;
|
|
5515
|
+
let e = await this.fetch.get(`https://dm.video.qq.com/barrage/base/${t.vid}`, {
|
|
5472
5516
|
schema: tencentSegmentIndexSchema,
|
|
5473
5517
|
cache: {
|
|
5474
|
-
cacheKey: `tencent:segment:${
|
|
5518
|
+
cacheKey: `tencent:segment:${t.vid}`,
|
|
5475
5519
|
ttl: TTL_2_HOURS
|
|
5476
5520
|
}
|
|
5477
5521
|
});
|
|
5478
|
-
if (!
|
|
5479
|
-
if (!(null == (
|
|
5480
|
-
|
|
5481
|
-
} catch (
|
|
5482
|
-
return console.error(`\u{83B7}\u{53D6}\u{5F39}\u{5E55}\u{7D22}\u{5F15}\u{5931}\u{8D25} (vid=${
|
|
5522
|
+
if (!e.data) return [];
|
|
5523
|
+
if (!(null == (r = e.data) ? void 0 : r.segment_index)) return console.info(`vid='${t.vid}' \u{6CA1}\u{6709}\u{627E}\u{5230}\u{5F39}\u{5E55}\u{5206}\u{6BB5}\u{7D22}\u{5F15}\u{3002}`), [];
|
|
5524
|
+
n = e.data.segment_index;
|
|
5525
|
+
} catch (e) {
|
|
5526
|
+
return console.error(`\u{83B7}\u{53D6}\u{5F39}\u{5E55}\u{7D22}\u{5F15}\u{5931}\u{8D25} (vid=${t.vid})`, e), [];
|
|
5483
5527
|
}
|
|
5484
|
-
let
|
|
5485
|
-
return console.debug(`\u{4E3A} vid='${
|
|
5486
|
-
var
|
|
5528
|
+
let i = Object.keys(n).sort((e, t)=>parseInt(e, 10) - parseInt(t, 10));
|
|
5529
|
+
return console.debug(`\u{4E3A} vid='${t.vid}' \u{627E}\u{5230} ${i.length} \u{4E2A}\u{5F39}\u{5E55}\u{5206}\u{6BB5}`), i.map((e)=>{
|
|
5530
|
+
var t;
|
|
5487
5531
|
return {
|
|
5488
5532
|
provider: this.providerName,
|
|
5489
5533
|
startTime: parseInt(e, 10) / 1000.0,
|
|
5490
|
-
segmentId: null == (
|
|
5534
|
+
segmentId: null == (t = n[e]) ? void 0 : t.segment_name
|
|
5491
5535
|
};
|
|
5492
5536
|
});
|
|
5493
5537
|
}
|
|
5494
5538
|
async getComments(e, t) {
|
|
5495
|
-
let n =
|
|
5496
|
-
|
|
5539
|
+
let n = this.parseIdString(e);
|
|
5540
|
+
if (!(null == n ? void 0 : n.vid)) return [];
|
|
5541
|
+
let r = await this.internalGetComments(n.vid, t);
|
|
5542
|
+
return r && 0 !== r.length ? this.formatComments(r, (e)=>{
|
|
5497
5543
|
let t = 1, n = 16777215;
|
|
5498
5544
|
if (e.content_style && (2 === e.content_style.position ? t = 5 : 3 === e.content_style.position && (t = 4), e.content_style.color)) try {
|
|
5499
5545
|
n = parseInt(e.content_style.color, 10);
|
|
@@ -5511,9 +5557,9 @@ class TencentScraper extends BaseScraper {
|
|
|
5511
5557
|
let t = [], n = 0, r = "";
|
|
5512
5558
|
for(this.fetch.setHeaders({
|
|
5513
5559
|
Referer: `https://v.qq.com/x/cover/${e}.html`
|
|
5514
|
-
});;){
|
|
5515
|
-
var i
|
|
5516
|
-
let
|
|
5560
|
+
});;)try {
|
|
5561
|
+
var i;
|
|
5562
|
+
let o = null != (i = (await this.fetch.post("https://pbaccess.video.qq.com/trpc.universal_backend_service.page_server_rpc.PageServer/GetPageData?video_appid=3000010&vplatform=2", {
|
|
5517
5563
|
page_params: {
|
|
5518
5564
|
cid: e,
|
|
5519
5565
|
page_type: "detail_operation",
|
|
@@ -5533,16 +5579,19 @@ class TencentScraper extends BaseScraper {
|
|
|
5533
5579
|
cache: {
|
|
5534
5580
|
cacheKey: `tencent:episodes:${e}:${n}`
|
|
5535
5581
|
}
|
|
5536
|
-
})).data)
|
|
5537
|
-
for (let e of (
|
|
5582
|
+
})).data) ? i : [];
|
|
5583
|
+
for (let e of (o.length >= tencent_pageSize ? (n += 1, r = url_parse.qs.stringify({
|
|
5538
5584
|
episode_begin: n * tencent_pageSize,
|
|
5539
5585
|
episode_end: (n + 1) * tencent_pageSize,
|
|
5540
5586
|
episode_step: tencent_pageSize
|
|
5541
|
-
})) : r = "",
|
|
5587
|
+
})) : r = "", o)){
|
|
5542
5588
|
let { success: n, data: r } = tencentEpisodeSchema.safeParse(e.item_params);
|
|
5543
5589
|
n && t.push(r);
|
|
5544
5590
|
}
|
|
5545
5591
|
if (!r) break;
|
|
5592
|
+
} catch (t) {
|
|
5593
|
+
console.error(`\u{83B7}\u{53D6}\u{5206}\u{96C6}\u{5217}\u{8868}\u{5931}\u{8D25} (cid=${e})`, t);
|
|
5594
|
+
break;
|
|
5546
5595
|
}
|
|
5547
5596
|
return t;
|
|
5548
5597
|
}
|
|
@@ -5557,7 +5606,7 @@ class TencentScraper extends BaseScraper {
|
|
|
5557
5606
|
}
|
|
5558
5607
|
}
|
|
5559
5608
|
constructor(){
|
|
5560
|
-
super(), tencent_define_property(this, "providerName", "tencent"), this.fetch.setCookie({
|
|
5609
|
+
super(), tencent_define_property(this, "providerName", "tencent"), tencent_define_property(this, "idSchema", tencentIdSchema), this.fetch.setCookie({
|
|
5561
5610
|
pgv_pvid: "40b67e3b06027f3d",
|
|
5562
5611
|
video_platform: "2",
|
|
5563
5612
|
vversion_name: "8.2.95",
|
|
@@ -5807,6 +5856,12 @@ function scrapers_define_property(e, t, n) {
|
|
|
5807
5856
|
writable: !0
|
|
5808
5857
|
}) : e[t] = n, e;
|
|
5809
5858
|
}
|
|
5859
|
+
const scrapers = [
|
|
5860
|
+
TencentScraper,
|
|
5861
|
+
YoukuScraper,
|
|
5862
|
+
IqiyiScraper,
|
|
5863
|
+
BilibiliScraper
|
|
5864
|
+
];
|
|
5810
5865
|
class scrapers_Scraper {
|
|
5811
5866
|
get scraperMap() {
|
|
5812
5867
|
return keyBy(this.scrapers, (e)=>e.providerName);
|
|
@@ -5854,10 +5909,13 @@ class scrapers_Scraper {
|
|
|
5854
5909
|
return this.getSegmentWithTime(t, ...n);
|
|
5855
5910
|
}
|
|
5856
5911
|
async getEpisodes() {
|
|
5857
|
-
for(var e
|
|
5858
|
-
let
|
|
5859
|
-
for (let { provider:
|
|
5860
|
-
|
|
5912
|
+
for(var e = arguments.length, t = Array(e), n = 0; n < e; n++)t[n] = arguments[n];
|
|
5913
|
+
let r = [];
|
|
5914
|
+
for (let { provider: e, mediaId: n } of t){
|
|
5915
|
+
let t = this.scraperMap[e];
|
|
5916
|
+
t && r.push(t.getEpisodes(n).catch((e)=>(console.error(e), [])));
|
|
5917
|
+
}
|
|
5918
|
+
return (await Promise.all(r).catch((e)=>(console.error(e), []))).flat().map((e)=>({
|
|
5861
5919
|
...e,
|
|
5862
5920
|
episodeId: `${e.provider}:${e.episodeId}`
|
|
5863
5921
|
}));
|
|
@@ -5886,12 +5944,9 @@ class scrapers_Scraper {
|
|
|
5886
5944
|
return this.formatEpisodeResult(o, t, n);
|
|
5887
5945
|
}
|
|
5888
5946
|
constructor(){
|
|
5889
|
-
scrapers_define_property(this, "scrapers", []),
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
IqiyiScraper,
|
|
5893
|
-
BilibiliScraper
|
|
5894
|
-
].map((e)=>new e()));
|
|
5947
|
+
scrapers_define_property(this, "scrapers", []), scrapers.forEach((e)=>{
|
|
5948
|
+
this.scrapers.push(new e());
|
|
5949
|
+
});
|
|
5895
5950
|
}
|
|
5896
5951
|
}
|
|
5897
5952
|
WidgetMetadata = {
|
|
@@ -5899,7 +5954,7 @@ WidgetMetadata = {
|
|
|
5899
5954
|
title: "\u901A\u7528\u5F39\u5E55",
|
|
5900
5955
|
description: "\u901A\u7528\u5F39\u5E55\u63D2\u4EF6\uFF0C\u652F\u6301\u817E\u8BAF\u3001\u4F18\u9177\u3001\u7231\u5947\u827A\u3001\u54D4\u54E9\u54D4\u54E9\u7B49\u5E73\u53F0",
|
|
5901
5956
|
author: "Baran",
|
|
5902
|
-
version: "0.0.
|
|
5957
|
+
version: "0.0.3",
|
|
5903
5958
|
site: "https://github.com/baranwang/forward-widgets/tree/main/packages/danmu-universe",
|
|
5904
5959
|
requiredVersion: "0.0.2",
|
|
5905
5960
|
modules: [
|
|
@@ -5945,7 +6000,6 @@ searchDanmu = async (e)=>{
|
|
|
5945
6000
|
let t = `[${PROVIDER_NAMES[e.provider]}] `;
|
|
5946
6001
|
return e.episodeTitle && (t += e.episodeTitle), {
|
|
5947
6002
|
animeId: e.episodeId,
|
|
5948
|
-
bangumiId: e.episodeId,
|
|
5949
6003
|
animeTitle: t
|
|
5950
6004
|
};
|
|
5951
6005
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forward-widget/danmu-universe",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/danmu-universe.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,10 +29,18 @@
|
|
|
29
29
|
"protobufjs-cli": "^1.1.3",
|
|
30
30
|
"typescript": "^5.8.3"
|
|
31
31
|
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/baranwang/forward-widgets.git",
|
|
35
|
+
"directory": "packages/danmu-universe"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"provenance": true
|
|
39
|
+
},
|
|
32
40
|
"license": "MIT",
|
|
33
41
|
"scripts": {
|
|
34
|
-
"build": "rslib build",
|
|
35
|
-
"dev": "rslib build --watch",
|
|
42
|
+
"build": "NODE_ENV=production rslib build",
|
|
43
|
+
"dev": "NODE_ENV=development rslib build --watch",
|
|
36
44
|
"test": "rstest",
|
|
37
45
|
"pb": "pnpm pbjs && pnpm pbts",
|
|
38
46
|
"pbjs": "pbjs -t static-module -w es6 -o src/scrapers/bilibili/dm.proto.js src/scrapers/bilibili/dm.proto",
|