koishi-plugin-bilibili-videolink-analysis 1.1.24 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +94 -3
- package/lib/index.js +717 -978
- package/package.json +3 -4
- package/src/index.ts +881 -0
- package/LICENSE.txt +0 -21
package/lib/index.js
CHANGED
|
@@ -1,978 +1,717 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
.
|
|
227
|
-
.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
const avPattern = /(?:^|\s)(av\d+)(?:\s|$)/g; // 新增 AV 号的正则表达式
|
|
719
|
-
const matches = [];
|
|
720
|
-
let match;
|
|
721
|
-
|
|
722
|
-
// 查找 BV 号
|
|
723
|
-
while ((match = bvPattern.exec(text)) !== null) {
|
|
724
|
-
matches.push(`https://www.bilibili.com/video/${match[1]}`);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
// 查找 AV 号
|
|
728
|
-
while ((match = avPattern.exec(text)) !== null) {
|
|
729
|
-
matches.push(`https://www.bilibili.com/video/${match[1]}`);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
return matches;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
// 记录上次处理链接的时间
|
|
736
|
-
const lastProcessedUrls = {};
|
|
737
|
-
|
|
738
|
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
739
|
-
|
|
740
|
-
function numeral(number, config) {
|
|
741
|
-
if (config.useNumeral) {
|
|
742
|
-
if (number >= 10000 && number < 100000000) {
|
|
743
|
-
return (number / 10000).toFixed(1) + "万";
|
|
744
|
-
}
|
|
745
|
-
else if (number >= 100000000) {
|
|
746
|
-
return (number / 100000000).toFixed(1) + "亿";
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
return number.toString();
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
else {
|
|
753
|
-
return number;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
class Bili_Video {
|
|
758
|
-
ctx;
|
|
759
|
-
config;
|
|
760
|
-
constructor(ctx, config) {
|
|
761
|
-
this.ctx = ctx;
|
|
762
|
-
this.config = config;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* 解析 ID 类型
|
|
766
|
-
* @param id 视频 ID
|
|
767
|
-
* @returns type: ID 类型, id: 视频 ID
|
|
768
|
-
*/
|
|
769
|
-
vid_type_parse(id) {
|
|
770
|
-
var idRegex = [
|
|
771
|
-
{
|
|
772
|
-
pattern: /av([0-9]+)/i,
|
|
773
|
-
type: "av",
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
pattern: /bv([0-9a-zA-Z]+)/i,
|
|
777
|
-
type: "bv",
|
|
778
|
-
},
|
|
779
|
-
];
|
|
780
|
-
for (const rule of idRegex) {
|
|
781
|
-
var match = id.match(rule.pattern);
|
|
782
|
-
if (match) {
|
|
783
|
-
return {
|
|
784
|
-
type: rule.type,
|
|
785
|
-
id: match[1],
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
return {
|
|
790
|
-
type: null,
|
|
791
|
-
id: null,
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
/**
|
|
795
|
-
* 根据视频 ID 查找视频信息
|
|
796
|
-
* @param id 视频 ID
|
|
797
|
-
* @returns 视频信息 Json
|
|
798
|
-
*/
|
|
799
|
-
async fetch_video_info(id) {
|
|
800
|
-
var ret;
|
|
801
|
-
const vid = this.vid_type_parse(id);
|
|
802
|
-
switch (vid["type"]) {
|
|
803
|
-
case "av":
|
|
804
|
-
ret = await this.ctx.http.get("https://api.bilibili.com/x/web-interface/view?aid=" + vid["id"], {
|
|
805
|
-
headers: {
|
|
806
|
-
"User-Agent": this.config.userAgent,
|
|
807
|
-
},
|
|
808
|
-
});
|
|
809
|
-
break;
|
|
810
|
-
case "bv":
|
|
811
|
-
ret = await this.ctx.http.get("https://api.bilibili.com/x/web-interface/view?bvid=" + vid["id"], {
|
|
812
|
-
headers: {
|
|
813
|
-
"User-Agent": this.config.userAgent,
|
|
814
|
-
},
|
|
815
|
-
});
|
|
816
|
-
break;
|
|
817
|
-
default:
|
|
818
|
-
ret = null;
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
821
|
-
return ret;
|
|
822
|
-
}
|
|
823
|
-
/**
|
|
824
|
-
* 生成视频信息
|
|
825
|
-
* @param id 视频 ID
|
|
826
|
-
* @returns 文字视频信息
|
|
827
|
-
*/
|
|
828
|
-
async gen_context(id) {
|
|
829
|
-
const info = await this.fetch_video_info(id);
|
|
830
|
-
if (!info || !info["data"])
|
|
831
|
-
return null;
|
|
832
|
-
|
|
833
|
-
let description = info["data"]["desc"];
|
|
834
|
-
// 根据配置处理简介
|
|
835
|
-
const maxLength = config.bVideoShowIntroductionTofixed;
|
|
836
|
-
if (description.length > maxLength) {
|
|
837
|
-
description = description.substring(0, maxLength) + '...';
|
|
838
|
-
}
|
|
839
|
-
// 定义占位符对应的数据
|
|
840
|
-
const placeholders = {
|
|
841
|
-
'${标题}': info["data"]["title"],
|
|
842
|
-
'${UP主}': info["data"]["owner"]["name"],
|
|
843
|
-
'${封面}': `<img src="${info["data"]["pic"]}"/>`,
|
|
844
|
-
'${简介}': description, // 使用处理后的简介
|
|
845
|
-
'${点赞}': `${(0, numeral)(info["data"]["stat"]["like"], this.config)}`,
|
|
846
|
-
'${投币}': `${(0, numeral)(info["data"]["stat"]["coin"], this.config)}`,
|
|
847
|
-
'${收藏}': `${(0, numeral)(info["data"]["stat"]["favorite"], this.config)}`,
|
|
848
|
-
'${转发}': `${(0, numeral)(info["data"]["stat"]["share"], this.config)}`,
|
|
849
|
-
'${观看}': `${(0, numeral)(info["data"]["stat"]["view"], this.config)}`,
|
|
850
|
-
'${弹幕}': `${(0, numeral)(info["data"]["stat"]["danmaku"], this.config)}`,
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
// 根据配置项中的格式替换占位符
|
|
854
|
-
let ret = this.config.bVideo_area;
|
|
855
|
-
for (const [placeholder, value] of Object.entries(placeholders)) {
|
|
856
|
-
ret = ret.replace(new RegExp(placeholder.replace(/\$/g, '\\$'), 'g'), value);
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// 根据 ID 偏好添加视频链接
|
|
860
|
-
switch (this.config.bVideoIDPreference) {
|
|
861
|
-
case "bv":
|
|
862
|
-
ret += `\nhttps://www.bilibili.com/video/${info["data"]["bvid"]}`;
|
|
863
|
-
break;
|
|
864
|
-
case "av":
|
|
865
|
-
ret += `\nhttps://www.bilibili.com/video/av${info["data"]["aid"]}`;
|
|
866
|
-
break;
|
|
867
|
-
default:
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
return ret;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* 链接类型解析
|
|
879
|
-
* @param content 传入消息
|
|
880
|
-
* @returns type: "链接类型", id :"内容ID"
|
|
881
|
-
*/
|
|
882
|
-
function link_type_parser(content) {
|
|
883
|
-
// 先替换转义斜杠
|
|
884
|
-
content = content.replace(/\\\//g, '/');
|
|
885
|
-
var linkRegex = [
|
|
886
|
-
{
|
|
887
|
-
pattern: /bilibili\.com\/video\/([ab]v[0-9a-zA-Z]+)/gim,
|
|
888
|
-
type: "Video",
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
pattern: /b23\.tv(?:\\)?\/([0-9a-zA-Z]+)/gim,
|
|
892
|
-
type: "Short",
|
|
893
|
-
},
|
|
894
|
-
{
|
|
895
|
-
pattern: /bili(?:22|23|33)\.cn\/([0-9a-zA-Z]+)/gim,
|
|
896
|
-
type: "Short",
|
|
897
|
-
},
|
|
898
|
-
{
|
|
899
|
-
pattern: /bili2233\.cn\/([0-9a-zA-Z]+)/gim,
|
|
900
|
-
type: "Short",
|
|
901
|
-
},
|
|
902
|
-
];
|
|
903
|
-
var ret = [];
|
|
904
|
-
for (const rule of linkRegex) {
|
|
905
|
-
var match;
|
|
906
|
-
let lastID;
|
|
907
|
-
while ((match = rule.pattern.exec(content)) !== null) {
|
|
908
|
-
if (lastID == match[1])
|
|
909
|
-
continue;
|
|
910
|
-
ret.push({
|
|
911
|
-
type: rule.type,
|
|
912
|
-
id: match[1],
|
|
913
|
-
});
|
|
914
|
-
lastID = match[1];
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
return ret;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* 类型执行器
|
|
922
|
-
* @param ctx Context
|
|
923
|
-
* @param config Config
|
|
924
|
-
* @param element 链接列表
|
|
925
|
-
* @returns 解析来的文本
|
|
926
|
-
*/
|
|
927
|
-
async function type_processer(ctx, config, element) {
|
|
928
|
-
var ret = "";
|
|
929
|
-
switch (element["type"]) {
|
|
930
|
-
case "Video":
|
|
931
|
-
const bili_video = new Bili_Video(ctx, config);
|
|
932
|
-
const video_info = await bili_video.gen_context(element["id"]);
|
|
933
|
-
if (video_info != null)
|
|
934
|
-
ret += video_info;
|
|
935
|
-
break;
|
|
936
|
-
|
|
937
|
-
case "Short":
|
|
938
|
-
const bili_short = new Bili_Short(ctx, config);
|
|
939
|
-
const typed_link = link_type_parser(await bili_short.get_redir_url(element["id"]));
|
|
940
|
-
for (const element of typed_link) {
|
|
941
|
-
const final_info = await type_processer(ctx, config, element);
|
|
942
|
-
if (final_info != null)
|
|
943
|
-
ret += final_info;
|
|
944
|
-
break;
|
|
945
|
-
}
|
|
946
|
-
break;
|
|
947
|
-
}
|
|
948
|
-
return ret;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
class Bili_Short {
|
|
952
|
-
ctx;
|
|
953
|
-
config;
|
|
954
|
-
constructor(ctx, config) {
|
|
955
|
-
this.ctx = ctx;
|
|
956
|
-
this.config = config;
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* 根据短链接重定向获取正常链接
|
|
960
|
-
* @param id 短链接 ID
|
|
961
|
-
* @returns 正常链接
|
|
962
|
-
*/
|
|
963
|
-
async get_redir_url(id) {
|
|
964
|
-
var data = await this.ctx.http.get("https://b23.tv/" + id, {
|
|
965
|
-
redirect: "manual",
|
|
966
|
-
headers: {
|
|
967
|
-
"User-Agent": this.config.userAgent,
|
|
968
|
-
},
|
|
969
|
-
});
|
|
970
|
-
const match = data.match(/<a\s+(?:[^>]*?\s+)?href="([^"]*)"/i);
|
|
971
|
-
if (match)
|
|
972
|
-
return match[1];
|
|
973
|
-
else
|
|
974
|
-
return null;
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
exports.apply = apply;
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Config: () => Config,
|
|
24
|
+
apply: () => apply,
|
|
25
|
+
inject: () => inject,
|
|
26
|
+
name: () => name,
|
|
27
|
+
usage: () => usage
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(src_exports);
|
|
30
|
+
var import_koishi = require("koishi");
|
|
31
|
+
var logger = new import_koishi.Logger("bilibili-videolink-analysis");
|
|
32
|
+
var name = "bilibili-videolink-analysis";
|
|
33
|
+
var inject = {
|
|
34
|
+
optional: ["puppeteer"]
|
|
35
|
+
// required: ['BiliBiliVideo']
|
|
36
|
+
};
|
|
37
|
+
var usage = `
|
|
38
|
+
|
|
39
|
+
<h2>→ <a href="https://www.npmjs.com/package/koishi-plugin-bilibili-videolink-analysis" target="_blank">可以点击这里查看详细的文档说明✨</a></h2>
|
|
40
|
+
|
|
41
|
+
✨ 只需开启插件,就可以解析B站视频的链接啦~ ✨
|
|
42
|
+
|
|
43
|
+
向bot发送B站视频链接吧~
|
|
44
|
+
|
|
45
|
+
会返回视频信息与视频哦
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
#### ⚠️ **如果你使用不了本项目,请优先检查:** ⚠️
|
|
50
|
+
#### 若无注册的指令,请关开一下[command插件](/market?keyword=commands+email:shigma10826@gmail.com)(没有指令也不影响解析别人的链接)
|
|
51
|
+
#### 视频内容是否为B站的大会员专属视频/付费视频/充电专属视频
|
|
52
|
+
#### 接入方法是否支持获取网址链接/小程序卡片消息
|
|
53
|
+
#### 接入方法是否支持视频元素的发送
|
|
54
|
+
#### 发送视频超时/其他网络问题
|
|
55
|
+
#### 视频内容被平台屏蔽/其他平台因素
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 注意,点播功能需要使用 puppeteer 服务
|
|
60
|
+
|
|
61
|
+
点播功能是为了方便群友一起刷B站哦~
|
|
62
|
+
|
|
63
|
+
比如:搜索 “遠い空へ” 的第二页,并且结果以语音格式返回
|
|
64
|
+
|
|
65
|
+
示例:\`点播 遠い空へ -a -p 2\`
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### 特别鸣谢 💖
|
|
71
|
+
|
|
72
|
+
特别鸣谢以下项目的支持:
|
|
73
|
+
|
|
74
|
+
- [@summonhim/koishi-plugin-bili-parser](/market?keyword=bili-parser)
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
`;
|
|
79
|
+
var Config = import_koishi.Schema.intersect([
|
|
80
|
+
import_koishi.Schema.object({
|
|
81
|
+
demand: import_koishi.Schema.boolean().default(true).description("开启点播指令功能<br>`其实点播登录不登录 都搜不准,登录只是写着玩的`")
|
|
82
|
+
}).description("点播设置(需要puppeteer服务)"),
|
|
83
|
+
import_koishi.Schema.union([
|
|
84
|
+
import_koishi.Schema.object({
|
|
85
|
+
demand: import_koishi.Schema.const(false).required()
|
|
86
|
+
}),
|
|
87
|
+
import_koishi.Schema.object({
|
|
88
|
+
demand: import_koishi.Schema.const(true),
|
|
89
|
+
timeout: import_koishi.Schema.number().role("slider").min(1).max(300).step(1).default(60).description("指定播放视频的输入时限。`单位 秒`"),
|
|
90
|
+
point: import_koishi.Schema.tuple([Number, Number]).description("序号标注位置。分别表示`距离顶部 距离左侧`的百分比").default([50, 50]),
|
|
91
|
+
enable: import_koishi.Schema.boolean().description("是否开启自动解析`选择对应视频 会自动解析视频内容`").default(true)
|
|
92
|
+
})
|
|
93
|
+
]),
|
|
94
|
+
import_koishi.Schema.object({
|
|
95
|
+
enablebilianalysis: import_koishi.Schema.boolean().default(true).description("开启解析功能<br>`关闭后,解析功能将关闭`")
|
|
96
|
+
}).description("视频解析 - 功能开关"),
|
|
97
|
+
import_koishi.Schema.union([
|
|
98
|
+
import_koishi.Schema.object({
|
|
99
|
+
enablebilianalysis: import_koishi.Schema.const(false).required()
|
|
100
|
+
}),
|
|
101
|
+
import_koishi.Schema.intersect([
|
|
102
|
+
import_koishi.Schema.object({
|
|
103
|
+
enablebilianalysis: import_koishi.Schema.const(true),
|
|
104
|
+
// @ts-ignore // 摸了摸了
|
|
105
|
+
waitTip_Switch: import_koishi.Schema.union([
|
|
106
|
+
import_koishi.Schema.const(null).description("不返回文字提示"),
|
|
107
|
+
import_koishi.Schema.string().description("返回文字提示(请在右侧填写文字内容)").default("正在解析B站链接...")
|
|
108
|
+
]).description("是否返回等待提示。开启后,会发送`等待提示语`"),
|
|
109
|
+
linktextParsing: import_koishi.Schema.boolean().default(true).description("是否返回 视频图文数据 `开启后,才发送视频数据的图文解析。`"),
|
|
110
|
+
VideoParsing_ToLink: import_koishi.Schema.union([
|
|
111
|
+
import_koishi.Schema.const("1").description("不返回视频/视频直链"),
|
|
112
|
+
import_koishi.Schema.const("2").description("仅返回视频"),
|
|
113
|
+
import_koishi.Schema.const("3").description("仅返回视频直链"),
|
|
114
|
+
import_koishi.Schema.const("4").description("返回视频和视频直链"),
|
|
115
|
+
import_koishi.Schema.const("5").description("返回视频,仅在日志记录视频直链")
|
|
116
|
+
]).role("radio").default("2").description("是否返回` 视频/视频直链 `"),
|
|
117
|
+
BVnumberParsing: import_koishi.Schema.boolean().default(true).description("是否允许根据`独立的BV、AV号`解析视频 `开启后,可以通过视频的BV、AV号解析视频。` <br> [触发说明见README](https://www.npmjs.com/package/koishi-plugin-bilibili-videolink-analysis)"),
|
|
118
|
+
MinimumTimeInterval: import_koishi.Schema.number().default(180).description("若干`秒`内 不再处理相同链接 `防止多bot互相触发 导致的刷屏/性能浪费`").min(1)
|
|
119
|
+
}),
|
|
120
|
+
import_koishi.Schema.object({
|
|
121
|
+
enablebilianalysis: import_koishi.Schema.const(true),
|
|
122
|
+
Minimumduration: import_koishi.Schema.number().default(0).description("允许解析的视频最小时长(分钟)`低于这个时长 就不会发视频内容`").min(0),
|
|
123
|
+
Minimumduration_tip: import_koishi.Schema.union([
|
|
124
|
+
import_koishi.Schema.const("return").description("不返回文字提示"),
|
|
125
|
+
import_koishi.Schema.object({
|
|
126
|
+
tipcontent: import_koishi.Schema.string().default("视频太短啦!不看不看~").description("文字提示内容"),
|
|
127
|
+
tipanalysis: import_koishi.Schema.boolean().default(true).description("是否进行图文解析(不会返回视频链接)")
|
|
128
|
+
}).description("返回文字提示"),
|
|
129
|
+
import_koishi.Schema.const(null)
|
|
130
|
+
]).description("对`过短视频`的文字提示内容").default(null),
|
|
131
|
+
Maximumduration: import_koishi.Schema.number().default(25).description("允许解析的视频最大时长(分钟)`超过这个时长 就不会发视频内容`").min(1),
|
|
132
|
+
Maximumduration_tip: import_koishi.Schema.union([
|
|
133
|
+
import_koishi.Schema.const("return").description("不返回文字提示"),
|
|
134
|
+
import_koishi.Schema.object({
|
|
135
|
+
tipcontent: import_koishi.Schema.string().default("视频太长啦!内容还是去B站看吧~").description("文字提示内容"),
|
|
136
|
+
tipanalysis: import_koishi.Schema.boolean().default(true).description("是否进行图文解析(不会返回视频链接)")
|
|
137
|
+
}).description("返回文字提示"),
|
|
138
|
+
import_koishi.Schema.const(null)
|
|
139
|
+
]).description("对`过长视频`的文字提示内容").default(null)
|
|
140
|
+
}).description("视频解析 - 内容限制"),
|
|
141
|
+
import_koishi.Schema.object({
|
|
142
|
+
parseLimit: import_koishi.Schema.number().default(3).description("单对话多链接解析上限").hidden(),
|
|
143
|
+
useNumeral: import_koishi.Schema.boolean().default(true).description("使用格式化数字").hidden(),
|
|
144
|
+
showError: import_koishi.Schema.boolean().default(false).description("当链接不正确时提醒发送者").hidden(),
|
|
145
|
+
bVideoIDPreference: import_koishi.Schema.union([
|
|
146
|
+
import_koishi.Schema.const("bv").description("BV 号"),
|
|
147
|
+
import_koishi.Schema.const("av").description("AV 号")
|
|
148
|
+
]).default("bv").description("ID 偏好").hidden(),
|
|
149
|
+
bVideo_area: import_koishi.Schema.string().role("textarea", { rows: [8, 16] }).default("${标题} --- ${UP主}\n${简介}\n点赞:${点赞} --- 投币:${投币}\n收藏:${收藏} --- 转发:${转发}\n观看:${观看} --- 弹幕:${弹幕}\n${~~~}\n${封面}").description(`图文解析的返回格式<br>
|
|
150
|
+
注意变量格式,以及变量名称。<br>比如 \`\${标题}\` 不可以变成\`\${标题123}\`,你可以直接删掉但是不能修改变量名称哦<br>
|
|
151
|
+
当然变量也不能无中生有,下面的默认值内容 就是所有变量了,你仅可以删去变量 或者修改变量之外的格式。<br>
|
|
152
|
+
· 特殊变量\`\${~~~}\`表示分割线,会把上下内容分为两个信息单独发送。\`\${tab}\`表示制表符。`),
|
|
153
|
+
bVideoShowLink: import_koishi.Schema.boolean().default(false).description("在末尾显示视频的链接地址 `开启可能会导致其他bot循环解析`"),
|
|
154
|
+
bVideoShowIntroductionTofixed: import_koishi.Schema.number().default(50).description("视频的`简介`最大的字符长度<br>超出部分会使用 `...` 代替")
|
|
155
|
+
}).description("链接的图文解析设置"),
|
|
156
|
+
import_koishi.Schema.object({
|
|
157
|
+
isfigure: import_koishi.Schema.boolean().default(false).description("是否开启合并转发 `仅支持 onebot 适配器` 其他平台开启 无效").experimental(),
|
|
158
|
+
filebuffer: import_koishi.Schema.boolean().default(true).description("是否将视频链接下载后再发送 (以解决部分onebot协议端的问题)<br>否则使用视频直链发送").experimental(),
|
|
159
|
+
middleware: import_koishi.Schema.boolean().default(false).description("前置中间件模式"),
|
|
160
|
+
userAgent: import_koishi.Schema.string().description("所有 API 请求所用的 User-Agent").default("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36")
|
|
161
|
+
}).description("调试设置")
|
|
162
|
+
])
|
|
163
|
+
]),
|
|
164
|
+
import_koishi.Schema.object({
|
|
165
|
+
pageclose: import_koishi.Schema.boolean().default(true).description("自动`page.close()`<br>非开发者请勿改动").experimental(),
|
|
166
|
+
loggerinfo: import_koishi.Schema.boolean().default(false).description("日志调试输出 `日常使用无需开启`<br>非开发者请勿改动").experimental(),
|
|
167
|
+
loggerinfofulljson: import_koishi.Schema.boolean().default(false).description("打印完整的机器人发送的json输出").experimental()
|
|
168
|
+
}).description("开发者选项")
|
|
169
|
+
]);
|
|
170
|
+
function apply(ctx, config) {
|
|
171
|
+
const lastProcessedUrls = {};
|
|
172
|
+
if (config.enablebilianalysis) {
|
|
173
|
+
ctx.middleware(async (session, next) => {
|
|
174
|
+
let sessioncontent = session.stripped.content;
|
|
175
|
+
if (config.BVnumberParsing) {
|
|
176
|
+
const bvUrls = convertBVToUrl(sessioncontent);
|
|
177
|
+
if (bvUrls.length > 0) {
|
|
178
|
+
sessioncontent += "\n" + bvUrls.join("\n");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const links = await isProcessLinks(sessioncontent);
|
|
182
|
+
if (links) {
|
|
183
|
+
const ret = await extractLinks(session, links);
|
|
184
|
+
if (ret && !isLinkProcessedRecently(ret, session.channelId)) {
|
|
185
|
+
await processVideoFromLink(session, ret);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return next();
|
|
189
|
+
}, config.middleware);
|
|
190
|
+
}
|
|
191
|
+
if (config.demand) {
|
|
192
|
+
ctx.command("B站点播 [keyword]", "点播B站视频").option("video", "-v 解析返回视频").option("audio", "-a 解析返回语音").option("link", "-l 解析返回链接").option("page", "-p <page:number> 指定页数", { fallback: "1" }).example("B站点播 遠い空へ -v").action(async ({ options, session }, keyword) => {
|
|
193
|
+
if (!keyword) {
|
|
194
|
+
await session.send(import_koishi.h.text("告诉我 你想要点播的关键词吧~"));
|
|
195
|
+
keyword = await session.prompt(30 * 1e3);
|
|
196
|
+
}
|
|
197
|
+
const url = `https://search.bilibili.com/video?keyword=${encodeURIComponent(keyword)}&page=${options.page}&o=30`;
|
|
198
|
+
const page = await ctx.puppeteer.page();
|
|
199
|
+
await page.goto(url, {
|
|
200
|
+
waitUntil: "networkidle2"
|
|
201
|
+
});
|
|
202
|
+
await page.addStyleTag({
|
|
203
|
+
content: `
|
|
204
|
+
div.bili-header,
|
|
205
|
+
div.login-tip,
|
|
206
|
+
div.v-popover,
|
|
207
|
+
div.right-entry__outside {
|
|
208
|
+
display: none !important;
|
|
209
|
+
}
|
|
210
|
+
`
|
|
211
|
+
});
|
|
212
|
+
const videos = await page.evaluate((point) => {
|
|
213
|
+
const items = Array.from(document.querySelectorAll('.video-list-item:not([style*="display: none"])'));
|
|
214
|
+
return items.map((item, index) => {
|
|
215
|
+
const link = item.querySelector("a");
|
|
216
|
+
const href = link?.getAttribute("href") || "";
|
|
217
|
+
const idMatch = href.match(/\/video\/(BV\w+)\//);
|
|
218
|
+
const id = idMatch ? idMatch[1] : "";
|
|
219
|
+
if (!id) {
|
|
220
|
+
const htmlElement = item;
|
|
221
|
+
htmlElement.style.display = "none";
|
|
222
|
+
} else {
|
|
223
|
+
const overlay = document.createElement("div");
|
|
224
|
+
overlay.style.position = "absolute";
|
|
225
|
+
overlay.style.top = `${point[0]}%`;
|
|
226
|
+
overlay.style.left = `${point[1]}%`;
|
|
227
|
+
overlay.style.transform = "translate(-50%, -50%)";
|
|
228
|
+
overlay.style.fontSize = "48px";
|
|
229
|
+
overlay.style.fontWeight = "bold";
|
|
230
|
+
overlay.style.color = "black";
|
|
231
|
+
overlay.style.zIndex = "10";
|
|
232
|
+
overlay.style.backgroundColor = "rgba(255, 255, 255, 0.7)";
|
|
233
|
+
overlay.style.padding = "10px";
|
|
234
|
+
overlay.style.borderRadius = "8px";
|
|
235
|
+
overlay.textContent = `${index + 1}`;
|
|
236
|
+
const videoElement = item;
|
|
237
|
+
videoElement.style.position = "relative";
|
|
238
|
+
videoElement.appendChild(overlay);
|
|
239
|
+
}
|
|
240
|
+
return { id };
|
|
241
|
+
}).filter((video) => video.id);
|
|
242
|
+
}, config.point);
|
|
243
|
+
logInfo(options);
|
|
244
|
+
logInfo(`共找到 ${videos.length} 个视频:`);
|
|
245
|
+
videos.forEach((video, index) => {
|
|
246
|
+
logInfo(`序号 ${index + 1}: ID - ${video.id}`);
|
|
247
|
+
});
|
|
248
|
+
if (videos.length === 0) {
|
|
249
|
+
await page.close();
|
|
250
|
+
await session.send(import_koishi.h.text("未找到相关视频。"));
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const viewportHeight = 200 + videos.length * 100;
|
|
254
|
+
await page.setViewport({
|
|
255
|
+
width: 1440,
|
|
256
|
+
height: viewportHeight
|
|
257
|
+
});
|
|
258
|
+
logInfo("窗口:宽度:");
|
|
259
|
+
logInfo(1440);
|
|
260
|
+
logInfo("窗口:高度:");
|
|
261
|
+
logInfo(viewportHeight);
|
|
262
|
+
let msg;
|
|
263
|
+
const videoListElement = await page.$(".video-list.row");
|
|
264
|
+
if (videoListElement) {
|
|
265
|
+
const imgBuf = await videoListElement.screenshot({
|
|
266
|
+
captureBeyondViewport: false
|
|
267
|
+
});
|
|
268
|
+
msg = import_koishi.h.image(imgBuf, "image/png");
|
|
269
|
+
}
|
|
270
|
+
if (page && config.pageclose) {
|
|
271
|
+
await page.close();
|
|
272
|
+
}
|
|
273
|
+
await session.send(msg + import_koishi.h.text(`请选择视频的序号:`));
|
|
274
|
+
const userChoice = await session.prompt(config.timeout * 1e3);
|
|
275
|
+
const choiceIndex = parseInt(userChoice) - 1;
|
|
276
|
+
if (isNaN(choiceIndex) || choiceIndex < 0 || choiceIndex >= videos.length) {
|
|
277
|
+
await session.send(import_koishi.h.text("输入无效,请输入正确的序号。"));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const chosenVideo = videos[choiceIndex];
|
|
281
|
+
logInfo(`渲染序号设置
|
|
282
|
+
overlay.style.top = ${config.point[0]}%
|
|
283
|
+
overlay.style.left = ${config.point[1]}%`);
|
|
284
|
+
logInfo(`用户选择了序号 ${choiceIndex + 1}: ID - ${chosenVideo.id}`);
|
|
285
|
+
if (config.enable) {
|
|
286
|
+
const ret = await extractLinks(session, [{ type: "Video", id: chosenVideo.id }]);
|
|
287
|
+
if (ret && !isLinkProcessedRecently(ret, session.channelId)) {
|
|
288
|
+
await processVideoFromLink(session, ret, options);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function logInfo(...args) {
|
|
294
|
+
if (config.loggerinfo) {
|
|
295
|
+
logger.info(...args);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
__name(logInfo, "logInfo");
|
|
299
|
+
async function isProcessLinks(sessioncontent) {
|
|
300
|
+
const links = link_type_parser(sessioncontent);
|
|
301
|
+
if (links.length === 0) {
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
return links;
|
|
305
|
+
}
|
|
306
|
+
__name(isProcessLinks, "isProcessLinks");
|
|
307
|
+
async function extractLinks(session, links) {
|
|
308
|
+
let ret = "";
|
|
309
|
+
if (!config.isfigure) {
|
|
310
|
+
ret += (0, import_koishi.h)("quote", { id: session.messageId });
|
|
311
|
+
}
|
|
312
|
+
let countLink = 0;
|
|
313
|
+
let tp_ret;
|
|
314
|
+
for (const element of links) {
|
|
315
|
+
if (countLink >= 1) ret += "\n";
|
|
316
|
+
if (countLink >= config.parseLimit) {
|
|
317
|
+
ret += "已达到解析上限…";
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
tp_ret = await type_processer(element);
|
|
321
|
+
if (tp_ret == "") {
|
|
322
|
+
if (config.showError)
|
|
323
|
+
ret = "无法解析链接信息。可能是 ID 不存在,或该类型可能暂不支持。";
|
|
324
|
+
else
|
|
325
|
+
ret = null;
|
|
326
|
+
} else {
|
|
327
|
+
ret += tp_ret;
|
|
328
|
+
}
|
|
329
|
+
countLink++;
|
|
330
|
+
}
|
|
331
|
+
return ret;
|
|
332
|
+
}
|
|
333
|
+
__name(extractLinks, "extractLinks");
|
|
334
|
+
function isLinkProcessedRecently(ret, channelId) {
|
|
335
|
+
const lastretUrl = extractLastUrl(ret);
|
|
336
|
+
const currentTime = Date.now();
|
|
337
|
+
const channelKey = `${channelId}:${lastretUrl}`;
|
|
338
|
+
if (lastretUrl && lastProcessedUrls[channelKey] && currentTime - lastProcessedUrls[channelKey] < config.MinimumTimeInterval * 1e3) {
|
|
339
|
+
ctx.logger.info(`重复出现,略过处理:
|
|
340
|
+
${lastretUrl} (频道 ${channelId})`);
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
if (lastretUrl) {
|
|
344
|
+
lastProcessedUrls[channelKey] = currentTime;
|
|
345
|
+
}
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
__name(isLinkProcessedRecently, "isLinkProcessedRecently");
|
|
349
|
+
async function processVideoFromLink(session, ret, options = { video: true }) {
|
|
350
|
+
const lastretUrl = extractLastUrl(ret);
|
|
351
|
+
let waitTipMsgId = null;
|
|
352
|
+
if (config.waitTip_Switch) {
|
|
353
|
+
const result = await session.send(`${import_koishi.h.quote(session.messageId)}${config.waitTip_Switch}`);
|
|
354
|
+
waitTipMsgId = Array.isArray(result) ? result[0] : result;
|
|
355
|
+
}
|
|
356
|
+
let videoElements = [];
|
|
357
|
+
let textElements = [];
|
|
358
|
+
let shouldPerformTextParsing = config.linktextParsing;
|
|
359
|
+
if (shouldPerformTextParsing) {
|
|
360
|
+
let fullText;
|
|
361
|
+
if (config.bVideoShowLink) {
|
|
362
|
+
fullText = ret;
|
|
363
|
+
} else {
|
|
364
|
+
fullText = ret.replace(lastretUrl, "");
|
|
365
|
+
}
|
|
366
|
+
const textParts = fullText.split("${~~~}");
|
|
367
|
+
for (const part of textParts) {
|
|
368
|
+
const trimmedPart = part.trim();
|
|
369
|
+
if (trimmedPart) {
|
|
370
|
+
const parsedElements = import_koishi.h.parse(trimmedPart);
|
|
371
|
+
const messageElement = (0, import_koishi.h)("message", {
|
|
372
|
+
userId: session.userId,
|
|
373
|
+
nickname: session.author?.nickname || session.username
|
|
374
|
+
}, parsedElements);
|
|
375
|
+
textElements.push(messageElement);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (config.VideoParsing_ToLink) {
|
|
380
|
+
const fullAPIurl = `http://api.xingzhige.cn/API/b_parse/?url=${encodeURIComponent(lastretUrl)}`;
|
|
381
|
+
try {
|
|
382
|
+
const responseData = await ctx.http.get(fullAPIurl);
|
|
383
|
+
if (responseData.code === 0 && responseData.msg === "video" && responseData.data) {
|
|
384
|
+
const { bvid, cid, video } = responseData.data;
|
|
385
|
+
const bilibiliUrl = `https://api.bilibili.com/x/player/playurl?fnval=80&cid=${cid}&bvid=${bvid}`;
|
|
386
|
+
const playData = await ctx.http.get(bilibiliUrl);
|
|
387
|
+
logInfo(bilibiliUrl);
|
|
388
|
+
if (playData.code === 0 && playData.data && playData.data.dash && playData.data.dash.duration) {
|
|
389
|
+
const videoDurationSeconds = playData.data.dash.duration;
|
|
390
|
+
const videoDurationMinutes = videoDurationSeconds / 60;
|
|
391
|
+
if (videoDurationMinutes < config.Minimumduration) {
|
|
392
|
+
if (config.Minimumduration_tip === "return") {
|
|
393
|
+
return;
|
|
394
|
+
} else if (typeof config.Minimumduration_tip === "object" && config.Minimumduration_tip !== null) {
|
|
395
|
+
if (config.Minimumduration_tip.tipcontent) {
|
|
396
|
+
if (config.Minimumduration_tip.tipanalysis) {
|
|
397
|
+
videoElements.push(import_koishi.h.text(config.Minimumduration_tip.tipcontent));
|
|
398
|
+
} else {
|
|
399
|
+
await session.send(config.Minimumduration_tip.tipcontent);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
shouldPerformTextParsing = config.Minimumduration_tip.tipanalysis === true;
|
|
403
|
+
if (!shouldPerformTextParsing) {
|
|
404
|
+
textElements = [];
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
} else if (videoDurationMinutes > config.Maximumduration) {
|
|
408
|
+
if (config.Maximumduration_tip === "return") {
|
|
409
|
+
return;
|
|
410
|
+
} else if (typeof config.Maximumduration_tip === "object" && config.Maximumduration_tip !== null) {
|
|
411
|
+
if (config.Maximumduration_tip.tipcontent) {
|
|
412
|
+
if (config.Maximumduration_tip.tipanalysis) {
|
|
413
|
+
videoElements.push(import_koishi.h.text(config.Maximumduration_tip.tipcontent));
|
|
414
|
+
} else {
|
|
415
|
+
await session.send(config.Maximumduration_tip.tipcontent);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
shouldPerformTextParsing = config.Maximumduration_tip.tipanalysis === true;
|
|
419
|
+
if (!shouldPerformTextParsing) {
|
|
420
|
+
textElements = [];
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
} else {
|
|
424
|
+
let videoData = video.url;
|
|
425
|
+
logInfo(videoData);
|
|
426
|
+
if (config.filebuffer) {
|
|
427
|
+
try {
|
|
428
|
+
const videoFileBuffer = await ctx.http.file(video.url);
|
|
429
|
+
logInfo(videoFileBuffer);
|
|
430
|
+
if (videoFileBuffer && videoFileBuffer.data) {
|
|
431
|
+
const buffer = Buffer.from(videoFileBuffer.data);
|
|
432
|
+
const mimeType = videoFileBuffer.type || videoFileBuffer.mime || "video/mp4";
|
|
433
|
+
const base64Data = buffer.toString("base64");
|
|
434
|
+
videoData = `data:${mimeType};base64,${base64Data}`;
|
|
435
|
+
logInfo("成功使用 ctx.http.file 将视频URL 转换为data URI格式");
|
|
436
|
+
} else {
|
|
437
|
+
logInfo("文件数据无效,使用原始URL");
|
|
438
|
+
}
|
|
439
|
+
} catch (error) {
|
|
440
|
+
logger.error("获取视频文件失败:", error);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (videoData) {
|
|
444
|
+
if (options.link) {
|
|
445
|
+
videoElements.push(import_koishi.h.text(video.url));
|
|
446
|
+
} else if (options.audio) {
|
|
447
|
+
videoElements.push(import_koishi.h.audio(videoData));
|
|
448
|
+
} else {
|
|
449
|
+
switch (config.VideoParsing_ToLink) {
|
|
450
|
+
case "1":
|
|
451
|
+
break;
|
|
452
|
+
case "2":
|
|
453
|
+
videoElements.push(import_koishi.h.video(videoData));
|
|
454
|
+
break;
|
|
455
|
+
case "3":
|
|
456
|
+
videoElements.push(import_koishi.h.text(video.url));
|
|
457
|
+
break;
|
|
458
|
+
case "4":
|
|
459
|
+
videoElements.push(import_koishi.h.text(video.url));
|
|
460
|
+
videoElements.push(import_koishi.h.video(videoData));
|
|
461
|
+
break;
|
|
462
|
+
case "5":
|
|
463
|
+
logger.info(video.url);
|
|
464
|
+
videoElements.push(import_koishi.h.video(videoData));
|
|
465
|
+
break;
|
|
466
|
+
default:
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
} else {
|
|
471
|
+
throw new Error("解析视频直链失败");
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} else {
|
|
475
|
+
throw new Error("获取播放数据失败");
|
|
476
|
+
}
|
|
477
|
+
} else {
|
|
478
|
+
throw new Error("解析视频信息失败或非视频类型内容");
|
|
479
|
+
}
|
|
480
|
+
} catch (error) {
|
|
481
|
+
logger.error("请求解析 API 失败或处理出错:", error);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
let allElements = [...textElements, ...videoElements];
|
|
485
|
+
if (allElements.length === 0) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (config.isfigure && (session.platform === "onebot" || session.platform === "red")) {
|
|
489
|
+
logInfo(`使用合并转发,正在合并消息。`);
|
|
490
|
+
const figureContent = (0, import_koishi.h)("figure", {
|
|
491
|
+
children: allElements
|
|
492
|
+
});
|
|
493
|
+
if (config.loggerinfofulljson) {
|
|
494
|
+
logInfo(JSON.stringify(figureContent, null, 2));
|
|
495
|
+
}
|
|
496
|
+
await session.send(figureContent);
|
|
497
|
+
} else {
|
|
498
|
+
for (const element of allElements) {
|
|
499
|
+
await session.send(element);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
logInfo(`机器人已发送完整消息。`);
|
|
503
|
+
if (waitTipMsgId) {
|
|
504
|
+
await session.bot.deleteMessage(session.channelId, waitTipMsgId);
|
|
505
|
+
}
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
__name(processVideoFromLink, "processVideoFromLink");
|
|
509
|
+
function extractLastUrl(text) {
|
|
510
|
+
const urlPattern = /https?:\/\/[^\s]+/g;
|
|
511
|
+
const urls = text.match(urlPattern);
|
|
512
|
+
return urls ? urls.pop() : null;
|
|
513
|
+
}
|
|
514
|
+
__name(extractLastUrl, "extractLastUrl");
|
|
515
|
+
function convertBVToUrl(text) {
|
|
516
|
+
const bvPattern = /(?:^|\s)(BV\w{10})(?:\s|$)/g;
|
|
517
|
+
const avPattern = /(?:^|\s)(av\d+)(?:\s|$)/g;
|
|
518
|
+
const matches = [];
|
|
519
|
+
let match;
|
|
520
|
+
while ((match = bvPattern.exec(text)) !== null) {
|
|
521
|
+
matches.push(`https://www.bilibili.com/video/${match[1]}`);
|
|
522
|
+
}
|
|
523
|
+
while ((match = avPattern.exec(text)) !== null) {
|
|
524
|
+
matches.push(`https://www.bilibili.com/video/${match[1]}`);
|
|
525
|
+
}
|
|
526
|
+
return matches;
|
|
527
|
+
}
|
|
528
|
+
__name(convertBVToUrl, "convertBVToUrl");
|
|
529
|
+
function numeral(number) {
|
|
530
|
+
if (config.useNumeral) {
|
|
531
|
+
if (number >= 1e4 && number < 1e8) {
|
|
532
|
+
return (number / 1e4).toFixed(1) + "万";
|
|
533
|
+
} else if (number >= 1e8) {
|
|
534
|
+
return (number / 1e8).toFixed(1) + "亿";
|
|
535
|
+
} else {
|
|
536
|
+
return number.toString();
|
|
537
|
+
}
|
|
538
|
+
} else {
|
|
539
|
+
return number;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
__name(numeral, "numeral");
|
|
543
|
+
function vid_type_parse(id) {
|
|
544
|
+
var idRegex = [
|
|
545
|
+
{
|
|
546
|
+
pattern: /av([0-9]+)/i,
|
|
547
|
+
type: "av"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
pattern: /bv([0-9a-zA-Z]+)/i,
|
|
551
|
+
type: "bv"
|
|
552
|
+
}
|
|
553
|
+
];
|
|
554
|
+
for (const rule of idRegex) {
|
|
555
|
+
var match = id.match(rule.pattern);
|
|
556
|
+
if (match) {
|
|
557
|
+
return {
|
|
558
|
+
type: rule.type,
|
|
559
|
+
id: match[1]
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return {
|
|
564
|
+
type: null,
|
|
565
|
+
id: null
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
__name(vid_type_parse, "vid_type_parse");
|
|
569
|
+
async function fetch_video_info(id) {
|
|
570
|
+
var ret;
|
|
571
|
+
const vid = vid_type_parse(id);
|
|
572
|
+
switch (vid["type"]) {
|
|
573
|
+
case "av":
|
|
574
|
+
ret = await ctx.http.get("https://api.bilibili.com/x/web-interface/view?aid=" + vid["id"], {
|
|
575
|
+
headers: {
|
|
576
|
+
"User-Agent": config.userAgent
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
break;
|
|
580
|
+
case "bv":
|
|
581
|
+
ret = await ctx.http.get("https://api.bilibili.com/x/web-interface/view?bvid=" + vid["id"], {
|
|
582
|
+
headers: {
|
|
583
|
+
"User-Agent": config.userAgent
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
break;
|
|
587
|
+
default:
|
|
588
|
+
ret = null;
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
return ret;
|
|
592
|
+
}
|
|
593
|
+
__name(fetch_video_info, "fetch_video_info");
|
|
594
|
+
async function gen_context(id) {
|
|
595
|
+
const info = await fetch_video_info(id);
|
|
596
|
+
if (!info || !info["data"])
|
|
597
|
+
return null;
|
|
598
|
+
let description = info["data"]["desc"];
|
|
599
|
+
const maxLength = config.bVideoShowIntroductionTofixed;
|
|
600
|
+
if (description.length > maxLength) {
|
|
601
|
+
description = description.substring(0, maxLength) + "...";
|
|
602
|
+
}
|
|
603
|
+
const placeholders = {
|
|
604
|
+
"${标题}": info["data"]["title"],
|
|
605
|
+
"${UP主}": info["data"]["owner"]["name"],
|
|
606
|
+
"${封面}": `<img src="${info["data"]["pic"]}"/>`,
|
|
607
|
+
"${简介}": description,
|
|
608
|
+
// 使用处理后的简介
|
|
609
|
+
"${点赞}": `${numeral(info["data"]["stat"]["like"])}`,
|
|
610
|
+
"${投币}": `${numeral(info["data"]["stat"]["coin"])}`,
|
|
611
|
+
"${收藏}": `${numeral(info["data"]["stat"]["favorite"])}`,
|
|
612
|
+
"${转发}": `${numeral(info["data"]["stat"]["share"])}`,
|
|
613
|
+
"${观看}": `${numeral(info["data"]["stat"]["view"])}`,
|
|
614
|
+
"${弹幕}": `${numeral(info["data"]["stat"]["danmaku"])}`,
|
|
615
|
+
"${tab}": `<pre> </pre>`
|
|
616
|
+
};
|
|
617
|
+
let ret = config.bVideo_area;
|
|
618
|
+
for (const [placeholder, value] of Object.entries(placeholders)) {
|
|
619
|
+
ret = ret.replace(new RegExp(placeholder.replace(/\$/g, "\\$"), "g"), value);
|
|
620
|
+
}
|
|
621
|
+
switch (config.bVideoIDPreference) {
|
|
622
|
+
case "bv":
|
|
623
|
+
ret += `
|
|
624
|
+
https://www.bilibili.com/video/${info["data"]["bvid"]}`;
|
|
625
|
+
break;
|
|
626
|
+
case "av":
|
|
627
|
+
ret += `
|
|
628
|
+
https://www.bilibili.com/video/av${info["data"]["aid"]}`;
|
|
629
|
+
break;
|
|
630
|
+
default:
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
return ret;
|
|
634
|
+
}
|
|
635
|
+
__name(gen_context, "gen_context");
|
|
636
|
+
function link_type_parser(content) {
|
|
637
|
+
content = content.replace(/\\\//g, "/");
|
|
638
|
+
var linkRegex = [
|
|
639
|
+
{
|
|
640
|
+
pattern: /bilibili\.com\/video\/([ab]v[0-9a-zA-Z]+)/gim,
|
|
641
|
+
type: "Video"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
pattern: /b23\.tv(?:\\)?\/([0-9a-zA-Z]+)/gim,
|
|
645
|
+
type: "Short"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
pattern: /bili(?:22|23|33)\.cn\/([0-9a-zA-Z]+)/gim,
|
|
649
|
+
type: "Short"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
pattern: /bili2233\.cn\/([0-9a-zA-Z]+)/gim,
|
|
653
|
+
type: "Short"
|
|
654
|
+
}
|
|
655
|
+
];
|
|
656
|
+
var ret = [];
|
|
657
|
+
for (const rule of linkRegex) {
|
|
658
|
+
var match;
|
|
659
|
+
let lastID;
|
|
660
|
+
while ((match = rule.pattern.exec(content)) !== null) {
|
|
661
|
+
if (lastID == match[1])
|
|
662
|
+
continue;
|
|
663
|
+
ret.push({
|
|
664
|
+
type: rule.type,
|
|
665
|
+
id: match[1]
|
|
666
|
+
});
|
|
667
|
+
lastID = match[1];
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return ret;
|
|
671
|
+
}
|
|
672
|
+
__name(link_type_parser, "link_type_parser");
|
|
673
|
+
async function type_processer(element) {
|
|
674
|
+
var ret = "";
|
|
675
|
+
switch (element["type"]) {
|
|
676
|
+
case "Video":
|
|
677
|
+
const video_info = await gen_context(element["id"]);
|
|
678
|
+
if (video_info != null)
|
|
679
|
+
ret += video_info;
|
|
680
|
+
break;
|
|
681
|
+
case "Short":
|
|
682
|
+
const typed_link = link_type_parser(await get_redir_url(element["id"]));
|
|
683
|
+
for (const element2 of typed_link) {
|
|
684
|
+
const final_info = await type_processer(element2);
|
|
685
|
+
if (final_info != null)
|
|
686
|
+
ret += final_info;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
return ret;
|
|
692
|
+
}
|
|
693
|
+
__name(type_processer, "type_processer");
|
|
694
|
+
async function get_redir_url(id) {
|
|
695
|
+
var data = await ctx.http.get("https://b23.tv/" + id, {
|
|
696
|
+
redirect: "manual",
|
|
697
|
+
headers: {
|
|
698
|
+
"User-Agent": config.userAgent
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
const match = data.match(/<a\s+(?:[^>]*?\s+)?href="([^"]*)"/i);
|
|
702
|
+
if (match)
|
|
703
|
+
return match[1];
|
|
704
|
+
else
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
__name(get_redir_url, "get_redir_url");
|
|
708
|
+
}
|
|
709
|
+
__name(apply, "apply");
|
|
710
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
711
|
+
0 && (module.exports = {
|
|
712
|
+
Config,
|
|
713
|
+
apply,
|
|
714
|
+
inject,
|
|
715
|
+
name,
|
|
716
|
+
usage
|
|
717
|
+
});
|