@forward-widget/danmu-universe 0.0.0 → 0.0.2
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 +57 -0
- package/dist/danmu-universe.js +135 -120
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 通用弹幕插件 (Danmu Universe)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@forward-widget/danmu-universe)
|
|
4
|
+
[](https://github.com/baranwang/forward-widgets)
|
|
5
|
+
|
|
6
|
+
一个通用的弹幕聚合插件,支持从多个主流视频平台获取弹幕数据。通过统一的API接口,为Forward Widget生态系统提供跨平台的弹幕服务。
|
|
7
|
+
|
|
8
|
+
## 支持的平台
|
|
9
|
+
|
|
10
|
+
- 腾讯视频
|
|
11
|
+
- 优酷视频
|
|
12
|
+
- 爱奇艺
|
|
13
|
+
- 哔哩哔哩
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## 安装使用
|
|
17
|
+
|
|
18
|
+
### Forward Widget 模块管理
|
|
19
|
+
|
|
20
|
+
在Forward Widget的模块管理中导入以下URL:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
https://unpkg.com/@forward-widget/danmu-universe
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 开发
|
|
27
|
+
|
|
28
|
+
欢迎社区贡献,如果你想为项目做出贡献
|
|
29
|
+
|
|
30
|
+
### 环境要求
|
|
31
|
+
|
|
32
|
+
- Node.js >= 24
|
|
33
|
+
- pnpm >= 9
|
|
34
|
+
|
|
35
|
+
### 安装依赖
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm install
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 开发模式
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 构建
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 测试
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm test
|
|
57
|
+
```
|
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 || p).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 = {}, p = 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
|
+
}, d = 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(d.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 d.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 p = 0; p < u; p += s)this._doProcessBlock(i, p);
|
|
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],
|
|
452
|
-
S = l(S, O, $, I, s, 7, a[0]), I = l(I, S, O, $, u, 12, a[1]), $ = l($, I, S, O, f, 17, a[2]), O = l(O, $, I, S, h, 22, a[3]), S = l(S, O, $, I, m, 7, a[4]), I = l(I, S, O, $, g, 12, a[5]), $ = l($, I, S, O, y, 17, a[6]), O = l(O, $, I, S, v, 22, a[7]), S = l(S, O, $, I, b, 7, a[8]), I = l(I, S, O, $, _, 12, a[9]), $ = l($, I, S, O, w, 17, a[10]), O = l(O, $, I, S,
|
|
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], z = e[t + 15], S = o[0], O = o[1], $ = o[2], I = o[3];
|
|
452
|
+
S = l(S, O, $, I, s, 7, a[0]), I = l(I, S, O, $, u, 12, a[1]), $ = l($, I, S, O, f, 17, a[2]), O = l(O, $, I, S, h, 22, a[3]), S = l(S, O, $, I, m, 7, a[4]), I = l(I, S, O, $, g, 12, a[5]), $ = l($, I, S, O, y, 17, a[6]), O = l(O, $, I, S, v, 22, a[7]), S = l(S, O, $, I, b, 7, a[8]), I = l(I, S, O, $, _, 12, a[9]), $ = l($, I, S, O, w, 17, a[10]), O = l(O, $, I, S, k, 22, a[11]), S = l(S, O, $, I, x, 7, a[12]), I = l(I, S, O, $, j, 12, a[13]), $ = l($, I, S, O, E, 17, a[14]), O = l(O, $, I, S, z, 22, a[15]), S = c(S, O, $, I, u, 5, a[16]), I = c(I, S, O, $, y, 9, a[17]), $ = c($, I, S, O, k, 14, a[18]), O = c(O, $, I, S, s, 20, a[19]), S = c(S, O, $, I, g, 5, a[20]), I = c(I, S, O, $, w, 9, a[21]), $ = c($, I, S, O, z, 14, a[22]), O = c(O, $, I, S, m, 20, a[23]), S = c(S, O, $, I, _, 5, a[24]), I = c(I, S, O, $, E, 9, a[25]), $ = c($, I, S, O, h, 14, a[26]), O = c(O, $, I, S, b, 20, a[27]), S = c(S, O, $, I, j, 5, a[28]), I = c(I, S, O, $, f, 9, a[29]), $ = c($, I, S, O, v, 14, a[30]), O = c(O, $, I, S, x, 20, a[31]), S = p(S, O, $, I, g, 4, a[32]), I = p(I, S, O, $, b, 11, a[33]), $ = p($, I, S, O, k, 16, a[34]), O = p(O, $, I, S, E, 23, a[35]), S = p(S, O, $, I, u, 4, a[36]), I = p(I, S, O, $, m, 11, a[37]), $ = p($, I, S, O, v, 16, a[38]), O = p(O, $, I, S, w, 23, a[39]), S = p(S, O, $, I, j, 4, a[40]), I = p(I, S, O, $, s, 11, a[41]), $ = p($, I, S, O, h, 16, a[42]), O = p(O, $, I, S, y, 23, a[43]), S = p(S, O, $, I, _, 4, a[44]), I = p(I, S, O, $, x, 11, a[45]), $ = p($, I, S, O, z, 16, a[46]), O = p(O, $, I, S, f, 23, a[47]), S = d(S, O, $, I, s, 6, a[48]), I = d(I, S, O, $, v, 10, a[49]), $ = d($, I, S, O, E, 15, a[50]), O = d(O, $, I, S, g, 21, a[51]), S = d(S, O, $, I, x, 6, a[52]), I = d(I, S, O, $, h, 10, a[53]), $ = d($, I, S, O, w, 15, a[54]), O = d(O, $, I, S, u, 21, a[55]), S = d(S, O, $, I, b, 6, a[56]), I = d(I, S, O, $, z, 10, a[57]), $ = d($, I, S, O, y, 15, a[58]), O = d(O, $, I, S, j, 21, a[59]), S = d(S, O, $, I, m, 6, a[60]), I = d(I, S, O, $, k, 10, a[61]), $ = d($, I, S, O, f, 15, a[62]), O = d(O, $, I, S, _, 21, a[63]), o[0] = o[0] + S | 0, o[1] = o[1] + O | 0, o[2] = o[2] + $ | 0, o[3] = o[3] + I | 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 p(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 d(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 p() {
|
|
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 d(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(d(this.buf, this.pos += 4), d(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 d(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 | d(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 p.call(this)[t](!1);
|
|
624
624
|
},
|
|
625
625
|
uint64: function() {
|
|
626
|
-
return
|
|
626
|
+
return p.call(this)[t](!0);
|
|
627
627
|
},
|
|
628
628
|
sint64: function() {
|
|
629
|
-
return
|
|
629
|
+
return p.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 = p;
|
|
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 p() {
|
|
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 d = function() {
|
|
859
859
|
return i.Buffer ? function() {
|
|
860
|
-
return (
|
|
860
|
+
return (p.create = function() {
|
|
861
861
|
return new r();
|
|
862
862
|
})();
|
|
863
863
|
} : function() {
|
|
864
|
-
return new
|
|
864
|
+
return new p();
|
|
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
|
+
p.create = d(), p.alloc = function(e) {
|
|
886
886
|
return new i.Array(e);
|
|
887
|
-
}, i.Array !== Array && (
|
|
887
|
+
}, i.Array !== Array && (p.alloc = i.pool(p.alloc, i.Array.prototype.subarray)), p.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, p.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
|
+
}, p.prototype.int32 = function(e) {
|
|
892
892
|
return e < 0 ? this._push(g, 10, o.fromNumber(e)) : this.uint32(e);
|
|
893
|
-
},
|
|
893
|
+
}, p.prototype.sint32 = function(e) {
|
|
894
894
|
return this.uint32((e << 1 ^ e >> 31) >>> 0);
|
|
895
|
-
},
|
|
895
|
+
}, p.prototype.uint64 = function(e) {
|
|
896
896
|
var t = o.from(e);
|
|
897
897
|
return this._push(g, t.length(), t);
|
|
898
|
-
},
|
|
898
|
+
}, p.prototype.int64 = p.prototype.uint64, p.prototype.sint64 = function(e) {
|
|
899
899
|
var t = o.from(e).zzEncode();
|
|
900
900
|
return this._push(g, t.length(), t);
|
|
901
|
-
},
|
|
901
|
+
}, p.prototype.bool = function(e) {
|
|
902
902
|
return this._push(f, 1, +!!e);
|
|
903
|
-
},
|
|
903
|
+
}, p.prototype.fixed32 = function(e) {
|
|
904
904
|
return this._push(y, 4, e >>> 0);
|
|
905
|
-
},
|
|
905
|
+
}, p.prototype.sfixed32 = p.prototype.fixed32, p.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
|
+
}, p.prototype.sfixed64 = p.prototype.fixed64, p.prototype.float = function(e) {
|
|
909
909
|
return this._push(i.float.writeFloatLE, 4, e);
|
|
910
|
-
},
|
|
910
|
+
}, p.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
|
+
p.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 = p.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
|
+
}, p.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
|
+
}, p.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
|
+
}, p.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
|
+
}, p.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
|
+
}, p.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
|
+
}, p._configure = function(e) {
|
|
940
|
+
r = e, p.create = d(), 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 p(e) {
|
|
1025
1025
|
return (e || '').toString().replace(o, '');
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1027
|
+
var d = [
|
|
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 = p(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,19 +1098,19 @@ 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, _ =
|
|
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,
|
|
1101
|
+
if (e = (e = p(e)).replace(s, ''), !(this instanceof v)) return new v(e, t, n);
|
|
1102
|
+
var o, a, u, l, f, b, _ = d.slice(), w = typeof t, k = this, x = 0;
|
|
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'
|
|
1106
|
-
]);
|
|
1107
|
-
if ('function' == typeof (l = _[
|
|
1108
|
-
e = l(e,
|
|
1106
|
+
]); x < _.length; x++){
|
|
1107
|
+
if ('function' == typeof (l = _[x])) {
|
|
1108
|
+
e = l(e, k);
|
|
1109
1109
|
continue;
|
|
1110
1110
|
}
|
|
1111
|
-
u = l[0], b = l[1], u != u ?
|
|
1111
|
+
u = l[0], b = l[1], u != u ? k[b] = e : 'string' == typeof u ? ~(f = '@' === u ? e.lastIndexOf(u) : e.indexOf(u)) && ('number' == typeof l[2] ? (k[b] = e.slice(0, f), e = e.slice(f + l[2])) : (k[b] = e.slice(f), e = e.slice(0, f))) : (f = u.exec(e)) && (k[b] = f[1], e = e.slice(0, f.index)), k[b] = k[b] || o && l[3] && t[b] || '', l[4] && (k[b] = k[b].toLowerCase());
|
|
1112
1112
|
}
|
|
1113
|
-
n && (
|
|
1113
|
+
n && (k.query = n(k.query)), o && t.slashes && '/' !== k.pathname.charAt(0) && ('' !== k.pathname || '' !== t.pathname) && (k.pathname = y(k.pathname, t.pathname)), '/' !== k.pathname.charAt(0) && m(k.protocol) && (k.pathname = '/' + k.pathname), r(k.port, k.protocol) || (k.host = k.hostname, k.port = ''), k.username = k.password = '', k.auth && (~(f = k.auth.indexOf(':')) ? (k.username = k.auth.slice(0, f), k.username = encodeURIComponent(decodeURIComponent(k.username)), k.password = k.auth.slice(f + 1), k.password = encodeURIComponent(decodeURIComponent(k.password))) : k.username = encodeURIComponent(decodeURIComponent(k.auth)), k.auth = k.password ? k.username + ':' + k.password : k.username), k.origin = 'file:' !== k.protocol && m(k.protocol) && k.host ? k.protocol + '//' + k.host : 'null', k.href = k.toString();
|
|
1114
1114
|
}
|
|
1115
1115
|
v.prototype = {
|
|
1116
1116
|
set: function(e, t, n) {
|
|
@@ -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 < d.length; l++){
|
|
1150
|
+
var c = d[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 = p, 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, p)=>{
|
|
2372
2372
|
r ?? (r = i.value);
|
|
2373
|
-
let
|
|
2374
|
-
if (!s(
|
|
2373
|
+
let d = u.value;
|
|
2374
|
+
if (!s(d)) return u.issues.push({
|
|
2375
2375
|
expected: "object",
|
|
2376
2376
|
code: "invalid_type",
|
|
2377
|
-
input:
|
|
2377
|
+
input: d,
|
|
2378
2378
|
inst: e
|
|
2379
2379
|
}), u;
|
|
2380
2380
|
let f = [];
|
|
2381
|
-
if (a && l &&
|
|
2381
|
+
if (a && l && p?.async === !1 && !0 !== p.jitless) n || (n = o(t.shape)), u = n(u, p);
|
|
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: d[t],
|
|
2388
2388
|
issues: []
|
|
2389
|
-
},
|
|
2390
|
-
n instanceof Promise ? f.push(n.then((e)=>handlePropertyResult(e, u, t,
|
|
2389
|
+
}, p);
|
|
2390
|
+
n instanceof Promise ? f.push(n.then((e)=>handlePropertyResult(e, u, t, d))) : handlePropertyResult(n, u, t, d);
|
|
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(d)){
|
|
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: d[e],
|
|
2403
2403
|
issues: []
|
|
2404
|
-
},
|
|
2405
|
-
t instanceof Promise ? f.push(t.then((t)=>handlePropertyResult(t, u, e,
|
|
2404
|
+
}, p);
|
|
2405
|
+
t instanceof Promise ? f.push(t.then((t)=>handlePropertyResult(t, u, e, d))) : handlePropertyResult(t, u, e, d);
|
|
2406
2406
|
}
|
|
2407
2407
|
return (h.length && u.issues.push({
|
|
2408
2408
|
code: "unrecognized_keys",
|
|
2409
2409
|
keys: h,
|
|
2410
|
-
input:
|
|
2410
|
+
input: d,
|
|
2411
2411
|
inst: e
|
|
2412
2412
|
}), f.length) ? Promise.all(f).then(()=>u) : u;
|
|
2413
2413
|
};
|
|
@@ -3670,7 +3670,7 @@ function _define_property(e, t, n) {
|
|
|
3670
3670
|
const TTL_7_DAYS = 604800000, TTL_1_DAY = 86400000, TTL_2_HOURS = 7200000, TTL_5_MINUTES = 300000, StorageValue = schemas_object({
|
|
3671
3671
|
value: schemas_string(),
|
|
3672
3672
|
expiresAt: schemas_number()
|
|
3673
|
-
})
|
|
3673
|
+
});
|
|
3674
3674
|
class Storage {
|
|
3675
3675
|
get(e) {
|
|
3676
3676
|
let t = Widget.storage.get(e);
|
|
@@ -3699,12 +3699,20 @@ class Storage {
|
|
|
3699
3699
|
setJson(e, t, n) {
|
|
3700
3700
|
return this.set(e, JSON.stringify(t), n);
|
|
3701
3701
|
}
|
|
3702
|
+
cleanup() {
|
|
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
|
+
}
|
|
3713
|
+
}
|
|
3702
3714
|
constructor(){
|
|
3703
|
-
_define_property(this, "defaultTTL", TTL_5_MINUTES)
|
|
3704
|
-
this.get(e);
|
|
3705
|
-
}), this.set(META_LAST_CLEANUP_KEY, "1", {
|
|
3706
|
-
ttl: TTL_1_DAY
|
|
3707
|
-
}));
|
|
3715
|
+
_define_property(this, "defaultTTL", TTL_5_MINUTES);
|
|
3708
3716
|
}
|
|
3709
3717
|
}
|
|
3710
3718
|
const storage = new Storage();
|
|
@@ -3790,11 +3798,11 @@ class Fetch {
|
|
|
3790
3798
|
}
|
|
3791
3799
|
let a = o ? void 0 : n, { timeout: u, schema: l, ...c } = s;
|
|
3792
3800
|
console.debug("fetch", t, a, c);
|
|
3793
|
-
let
|
|
3801
|
+
let p = o ? Widget.http.get(t, c) : Widget.http.post(t, a, c);
|
|
3794
3802
|
return u && u > 0 ? Promise.race([
|
|
3795
|
-
|
|
3803
|
+
p,
|
|
3796
3804
|
this.createTimeoutPromise(u)
|
|
3797
|
-
]) :
|
|
3805
|
+
]) : p;
|
|
3798
3806
|
}
|
|
3799
3807
|
getCacheKey(e, t) {
|
|
3800
3808
|
var n;
|
|
@@ -3885,8 +3893,8 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3885
3893
|
uri: schemas_string()
|
|
3886
3894
|
}))
|
|
3887
3895
|
}), getVideoPlatformInfoByDoubanId = async (e)=>{
|
|
3888
|
-
var t, n, r
|
|
3889
|
-
let
|
|
3896
|
+
var t, n, r;
|
|
3897
|
+
let i = await fetch.get(`https://m.douban.com/rexxar/api/v2/movie/${e}?for_mobile=1`, {
|
|
3890
3898
|
headers: {
|
|
3891
3899
|
Referer: `https://m.douban.com/movie/subject/${e}/?dt_dapp=1`,
|
|
3892
3900
|
"Content-Type": "application/json"
|
|
@@ -3897,19 +3905,19 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3897
3905
|
ttl: TTL_7_DAYS
|
|
3898
3906
|
}
|
|
3899
3907
|
});
|
|
3900
|
-
if (200 !==
|
|
3901
|
-
let
|
|
3902
|
-
mediaType: (null == (t =
|
|
3908
|
+
if (200 !== i.statusCode) throw Error(`Failed to get video platform info: ${i.statusCode}, ${JSON.stringify(i.data)}`);
|
|
3909
|
+
let o = {
|
|
3910
|
+
mediaType: (null == (t = i.data) ? void 0 : t.is_tv) ? "tv" : "movie",
|
|
3903
3911
|
providers: {}
|
|
3904
3912
|
};
|
|
3905
|
-
for (let e of
|
|
3913
|
+
for (let e of null != (r = null == (n = i.data) ? void 0 : n.vendors) ? r : []){
|
|
3906
3914
|
if (e.is_ad) continue;
|
|
3907
3915
|
let t = url_parse_default()(e.uri, !0);
|
|
3908
3916
|
switch(e.id){
|
|
3909
3917
|
case "qq":
|
|
3910
3918
|
{
|
|
3911
3919
|
let { cid: e } = t.query;
|
|
3912
|
-
e && (
|
|
3920
|
+
e && (o.providers.tencent = {
|
|
3913
3921
|
id: e
|
|
3914
3922
|
});
|
|
3915
3923
|
break;
|
|
@@ -3917,7 +3925,7 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3917
3925
|
case "iqiyi":
|
|
3918
3926
|
{
|
|
3919
3927
|
let { tvid: e } = t.query;
|
|
3920
|
-
e && (
|
|
3928
|
+
e && (o.providers.iqiyi = {
|
|
3921
3929
|
id: e
|
|
3922
3930
|
});
|
|
3923
3931
|
break;
|
|
@@ -3925,7 +3933,7 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3925
3933
|
case "youku":
|
|
3926
3934
|
{
|
|
3927
3935
|
let { showid: e } = t.query;
|
|
3928
|
-
e && (
|
|
3936
|
+
e && (o.providers.youku = {
|
|
3929
3937
|
id: e
|
|
3930
3938
|
});
|
|
3931
3939
|
break;
|
|
@@ -3933,13 +3941,13 @@ const getExternalIdsByTmdbId = async (e, t)=>{
|
|
|
3933
3941
|
case "bilibili":
|
|
3934
3942
|
{
|
|
3935
3943
|
let e = t.pathname.split("/").pop();
|
|
3936
|
-
e && /\d+/.test(e) && (
|
|
3944
|
+
e && /\d+/.test(e) && (o.providers.bilibili = {
|
|
3937
3945
|
id: e
|
|
3938
3946
|
});
|
|
3939
3947
|
}
|
|
3940
3948
|
}
|
|
3941
3949
|
}
|
|
3942
|
-
return
|
|
3950
|
+
return o;
|
|
3943
3951
|
};
|
|
3944
3952
|
function keyBy(e, t) {
|
|
3945
3953
|
let n = {};
|
|
@@ -4298,18 +4306,18 @@ const pgcEpisodeSchema = schemas_object({
|
|
|
4298
4306
|
});
|
|
4299
4307
|
class BilibiliScraper extends BaseScraper {
|
|
4300
4308
|
async getEpisodes(e, t) {
|
|
4301
|
-
let n = [],
|
|
4302
|
-
for (let
|
|
4309
|
+
let [n] = e.split("#"), r = [], i = await this.getPgcEpisodes(n), o = this.getEpisodeBlacklistPattern(), s = 1;
|
|
4310
|
+
for (let e of null != i ? i : [])"\u9884\u544A" !== e.badge && (null != o && o.test(e.title) || (r.push({
|
|
4303
4311
|
provider: this.providerName,
|
|
4304
4312
|
episodeId: [
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4313
|
+
n,
|
|
4314
|
+
e.aid,
|
|
4315
|
+
e.cid
|
|
4308
4316
|
].join("#"),
|
|
4309
|
-
episodeTitle:
|
|
4310
|
-
episodeNumber:
|
|
4311
|
-
}),
|
|
4312
|
-
return t ?
|
|
4317
|
+
episodeTitle: e.show_title || e.title,
|
|
4318
|
+
episodeNumber: s
|
|
4319
|
+
}), s += 1));
|
|
4320
|
+
return t ? r.filter((e)=>e.episodeNumber === t) : r;
|
|
4313
4321
|
}
|
|
4314
4322
|
async getSegments(e) {
|
|
4315
4323
|
let [t, n, r] = e.split("#"), i = await this.getPgcEpisodes(t), o = null == i ? void 0 : i.find((e)=>e.aid === parseInt(n) && e.cid === parseInt(r));
|
|
@@ -4777,17 +4785,17 @@ const parseXml = function(e) {
|
|
|
4777
4785
|
}
|
|
4778
4786
|
]) : n.add(this.options.textNodeName, a), o = t + 2;
|
|
4779
4787
|
} else {
|
|
4780
|
-
let s = readTagExp(e, o, this.options.removeNSPrefix), a = s.tagName, u = s.rawTagName, l = s.tagExp, c = s.attrExpPresent,
|
|
4788
|
+
let s = readTagExp(e, o, this.options.removeNSPrefix), a = s.tagName, u = s.rawTagName, l = s.tagExp, c = s.attrExpPresent, p = s.closeIndex;
|
|
4781
4789
|
this.options.transformTagName && (a = this.options.transformTagName(a)), n && r && '!xml' !== n.tagname && (r = this.saveTextToParentTag(r, n, i, !1));
|
|
4782
|
-
let
|
|
4783
|
-
|
|
4790
|
+
let d = n;
|
|
4791
|
+
d && -1 !== this.options.unpairedTags.indexOf(d.tagname) && (n = this.tagsNodeStack.pop(), i = i.substring(0, i.lastIndexOf("."))), a !== t.tagname && (i += i ? "." + a : a);
|
|
4784
4792
|
let f = o;
|
|
4785
4793
|
if (this.isItStopNode(this.options.stopNodes, i, a)) {
|
|
4786
4794
|
let t = "";
|
|
4787
4795
|
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;
|
|
4788
4796
|
else if (-1 !== this.options.unpairedTags.indexOf(a)) o = s.closeIndex;
|
|
4789
4797
|
else {
|
|
4790
|
-
let n = this.readStopNodeData(e, u,
|
|
4798
|
+
let n = this.readStopNodeData(e, u, p + 1);
|
|
4791
4799
|
if (!n) throw Error(`Unexpected end of ${u}`);
|
|
4792
4800
|
o = n.i, t = n.tagContent;
|
|
4793
4801
|
}
|
|
@@ -4802,7 +4810,7 @@ const parseXml = function(e) {
|
|
|
4802
4810
|
let e = new XmlNode(a);
|
|
4803
4811
|
this.tagsNodeStack.push(n), a !== l && c && (e[":@"] = this.buildAttributesMap(l, i, a)), this.addChild(n, e, i, f), n = e;
|
|
4804
4812
|
}
|
|
4805
|
-
r = "", o =
|
|
4813
|
+
r = "", o = p;
|
|
4806
4814
|
}
|
|
4807
4815
|
}
|
|
4808
4816
|
else r += e[o];
|
|
@@ -5272,7 +5280,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5272
5280
|
console.debug(`URL\u{6784}\u{5EFA}: s1=${i}, s2=${o}, \u{5B8C}\u{6574}URL=${s}`);
|
|
5273
5281
|
let a = await this.fetch.get(s, {
|
|
5274
5282
|
zlibMode: !0
|
|
5275
|
-
}), u = this.xmlParser.parse(a.data), { success: l, data: c, error:
|
|
5283
|
+
}), u = this.xmlParser.parse(a.data), { success: l, data: c, error: p } = iqiyiCommentsResponseSchema.safeParse(u);
|
|
5276
5284
|
return l ? this.formatComments(c, (e)=>{
|
|
5277
5285
|
let t = 16777215;
|
|
5278
5286
|
try {
|
|
@@ -5285,7 +5293,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5285
5293
|
color: t,
|
|
5286
5294
|
content: e.content
|
|
5287
5295
|
};
|
|
5288
|
-
}) : (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(
|
|
5296
|
+
}) : (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(p)), []);
|
|
5289
5297
|
}
|
|
5290
5298
|
async getEpisodesV3(e) {
|
|
5291
5299
|
let t = {
|
|
@@ -5308,7 +5316,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5308
5316
|
};
|
|
5309
5317
|
t.sign = this.createSign(t);
|
|
5310
5318
|
try {
|
|
5311
|
-
var n, r, i, o, s, a, u, l, c,
|
|
5319
|
+
var n, r, i, o, s, a, u, l, c, p, d;
|
|
5312
5320
|
let e = (await this.fetch.get("https://www.iqiyi.com/prelw/tvg/v2/lw/base_info", {
|
|
5313
5321
|
params: t,
|
|
5314
5322
|
schema: iqiyiV3ApiResponseSchema
|
|
@@ -5320,7 +5328,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5320
5328
|
url: e.play_url
|
|
5321
5329
|
}))) ? o : [];
|
|
5322
5330
|
if (!f.length) {
|
|
5323
|
-
let t = null == e || null == (
|
|
5331
|
+
let t = null == e || null == (p = e.data) || null == (c = p.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);
|
|
5324
5332
|
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), [];
|
|
5325
5333
|
let o = this.getEpisodeBlacklistPattern(), h = 1;
|
|
5326
5334
|
for (let e of r.data){
|
|
@@ -5330,7 +5338,7 @@ class IqiyiScraper extends BaseScraper {
|
|
|
5330
5338
|
provider: this.providerName,
|
|
5331
5339
|
episodeId: t,
|
|
5332
5340
|
episodeTitle: e.title,
|
|
5333
|
-
episodeNumber: null != (
|
|
5341
|
+
episodeNumber: null != (d = this.getEpisodeIndexFromTitle(e.short_display_name)) ? d : h,
|
|
5334
5342
|
url: e.page_url
|
|
5335
5343
|
}), h += 1));
|
|
5336
5344
|
}
|
|
@@ -5508,8 +5516,8 @@ class TencentScraper extends BaseScraper {
|
|
|
5508
5516
|
for(this.fetch.setHeaders({
|
|
5509
5517
|
Referer: `https://v.qq.com/x/cover/${e}.html`
|
|
5510
5518
|
});;){
|
|
5511
|
-
var i, o, s, a, u, l, c,
|
|
5512
|
-
let
|
|
5519
|
+
var i, o, s, a, u, l, c, p;
|
|
5520
|
+
let d = null != (p = null == (c = (await this.fetch.post("https://pbaccess.video.qq.com/trpc.universal_backend_service.page_server_rpc.PageServer/GetPageData?video_appid=3000010&vplatform=2", {
|
|
5513
5521
|
page_params: {
|
|
5514
5522
|
cid: e,
|
|
5515
5523
|
page_type: "detail_operation",
|
|
@@ -5529,12 +5537,12 @@ class TencentScraper extends BaseScraper {
|
|
|
5529
5537
|
cache: {
|
|
5530
5538
|
cacheKey: `tencent:episodes:${e}:${n}`
|
|
5531
5539
|
}
|
|
5532
|
-
})).data) || null == (l = c.data) || null == (u = l.module_list_datas) || null == (a = u[0]) || null == (s = a.module_datas) || null == (o = s[0]) || null == (i = o.item_data_lists) ? void 0 : i.item_datas) ?
|
|
5533
|
-
for (let e of (
|
|
5540
|
+
})).data) || null == (l = c.data) || null == (u = l.module_list_datas) || null == (a = u[0]) || null == (s = a.module_datas) || null == (o = s[0]) || null == (i = o.item_data_lists) ? void 0 : i.item_datas) ? p : [];
|
|
5541
|
+
for (let e of (d.length >= tencent_pageSize ? (n += 1, r = url_parse.qs.stringify({
|
|
5534
5542
|
episode_begin: n * tencent_pageSize,
|
|
5535
5543
|
episode_end: (n + 1) * tencent_pageSize,
|
|
5536
5544
|
episode_step: tencent_pageSize
|
|
5537
|
-
})) : r = "",
|
|
5545
|
+
})) : r = "", d)){
|
|
5538
5546
|
let { success: n, data: r } = tencentEpisodeSchema.safeParse(e.item_params);
|
|
5539
5547
|
n && t.push(r);
|
|
5540
5548
|
}
|
|
@@ -5803,7 +5811,7 @@ function scrapers_define_property(e, t, n) {
|
|
|
5803
5811
|
writable: !0
|
|
5804
5812
|
}) : e[t] = n, e;
|
|
5805
5813
|
}
|
|
5806
|
-
class
|
|
5814
|
+
class scrapers_Scraper {
|
|
5807
5815
|
get scraperMap() {
|
|
5808
5816
|
return keyBy(this.scrapers, (e)=>e.providerName);
|
|
5809
5817
|
}
|
|
@@ -5882,15 +5890,21 @@ class Scraper {
|
|
|
5882
5890
|
return this.formatEpisodeResult(o, t, n);
|
|
5883
5891
|
}
|
|
5884
5892
|
constructor(){
|
|
5885
|
-
scrapers_define_property(this, "scrapers", []), this.scrapers.push(
|
|
5893
|
+
scrapers_define_property(this, "scrapers", []), this.scrapers.push(...[
|
|
5894
|
+
TencentScraper,
|
|
5895
|
+
YoukuScraper,
|
|
5896
|
+
IqiyiScraper,
|
|
5897
|
+
BilibiliScraper
|
|
5898
|
+
].map((e)=>new e()));
|
|
5886
5899
|
}
|
|
5887
5900
|
}
|
|
5888
5901
|
WidgetMetadata = {
|
|
5889
5902
|
id: "baranwang.danmu.universe",
|
|
5890
5903
|
title: "\u901A\u7528\u5F39\u5E55",
|
|
5891
|
-
description: "\u901A\u7528\u5F39\u5E55\
|
|
5904
|
+
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",
|
|
5892
5905
|
author: "Baran",
|
|
5893
|
-
version: "0.0.
|
|
5906
|
+
version: "0.0.2",
|
|
5907
|
+
site: "https://github.com/baranwang/forward-widgets/tree/main/packages/danmu-universe",
|
|
5894
5908
|
requiredVersion: "0.0.2",
|
|
5895
5909
|
modules: [
|
|
5896
5910
|
{
|
|
@@ -5923,9 +5937,10 @@ WidgetMetadata = {
|
|
|
5923
5937
|
}
|
|
5924
5938
|
]
|
|
5925
5939
|
};
|
|
5926
|
-
const src_scraper = new
|
|
5940
|
+
const src_scraper = new scrapers_Scraper();
|
|
5927
5941
|
searchDanmu = async (e)=>{
|
|
5928
5942
|
var t;
|
|
5943
|
+
storage.cleanup();
|
|
5929
5944
|
let { tmdbId: n, type: r, episode: i } = e;
|
|
5930
5945
|
if (!n) return null;
|
|
5931
5946
|
let o = await getDoubanInfoByTmdbId(r, n);
|
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.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/danmu-universe.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
"protobufjs-cli": "^1.1.3",
|
|
30
30
|
"typescript": "^5.8.3"
|
|
31
31
|
},
|
|
32
|
+
"license": "MIT",
|
|
32
33
|
"scripts": {
|
|
33
|
-
"build": "rslib build",
|
|
34
|
-
"dev": "rslib build --watch",
|
|
34
|
+
"build": "NODE_ENV=production rslib build",
|
|
35
|
+
"dev": "NODE_ENV=development rslib build --watch",
|
|
35
36
|
"test": "rstest",
|
|
36
37
|
"pb": "pnpm pbjs && pnpm pbts",
|
|
37
38
|
"pbjs": "pbjs -t static-module -w es6 -o src/scrapers/bilibili/dm.proto.js src/scrapers/bilibili/dm.proto",
|