主页前端留言功能实现

网站留言功能实现

前些天给网站升级了留言功能,但是又不想做数据库,于是想到了拿b站动态的评论区做留言的想法
这样一来不用给服务器加php,二来又不用建数据库等等,全程在后面跑python脚本,安全性感觉是无懈可击☺

评论数据爬取和处理

先是要拿到指定评论区的数据,上网上查了一下,发现有b站的api可以获取数据,但是在服务器试了一下竟然是被拒绝链接的,看了一下别人先成的b站爬取脚本,感觉又是要定时改cookie又是要防止b站检测你运营商的玩不动

但是还好是直接用bp来找,直接找到了数据的链接,而且不用登录能获取完整的评论,获取的原始数据是这样的:

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
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
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"cursor": {
"is_begin": true,
"prev": 0,
"next": 2,
"is_end": false,
"pagination_reply": {
"next_offset": "CAEiAggC"
},
"session_id": "",
"mode": 3,
"mode_text": "",
"all_count": 7,
"support_mode": [
2,
3
],
"name": "热门评论"
},
"replies": [
{
"rpid": 272139796528,
"oid": 362747247,
"type": 11,
"mid": 62831523,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 1,
"rcount": 1,
"state": 0,
"fansgrade": 0,
"attr": 768,
"ctime": 1754875749,
"mid_str": "62831523",
"oid_str": "362747247",
"rpid_str": "272139796528",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 1,
"action": 0,
"member": {
"mid": "62831523",
"uname": "Coronacosmo",
"sex": "男",
"sign": "",
"avatar": "https://i0.hdslb.com/bfs/face/e49b2e87e33d846938fa33feac6566f439a0c1a8.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 57,
"name": "收集萌新",
"image": "https://i0.hdslb.com/bfs/face/7767275600ea63d351b22fa87ec15a79aa24e5e5.png",
"image_small": "https://i0.hdslb.com/bfs/face/6589d992655595bf51543f268040eaeaed372fae.png",
"level": "普通勋章",
"condition": "同时拥有粉丝勋章>=5个"
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 1,
"vipDueDate": 1683129600000,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i0.hdslb.com/bfs/face/e49b2e87e33d846938fa33feac6566f439a0c1a8.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "62831523"
}
},
"content": {
"message": "[热词系列_大师球]",
"members": [],
"emote": {
"[热词系列_大师球]": {
"id": 1868,
"package_id": 53,
"state": 0,
"type": 1,
"attr": 2,
"text": "[热词系列_大师球]",
"url": "https://i0.hdslb.com/bfs/emote/f30089248dd137c568edabcb07cf67e0f6e98cf3.png",
"meta": {
"size": 2,
"suggest": [
""
]
},
"mtime": 1671778768,
"jump_title": "大师球"
}
},
"jump_url": {},
"max_line": 6
},
"replies": [
{
"rpid": 270904965281,
"oid": 362747247,
"type": 11,
"mid": 455215669,
"root": 272139796528,
"parent": 272139796528,
"dialog": 270904965281,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1754888850,
"mid_str": "455215669",
"oid_str": "362747247",
"rpid_str": "270904965281",
"root_str": "272139796528",
"parent_str": "272139796528",
"dialog_str": "270904965281",
"like": 0,
"action": 0,
"member": {
"mid": "455215669",
"uname": "Aidemofashi_",
"sex": "男",
"sign": "aidemofashi_爱的魔法尸\nemail:zhonghuaiyu2019@163.com",
"avatar": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 0,
"vipDueDate": 0,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "455215669"
}
},
"content": {
"message": "666,[星星眼]",
"members": [],
"emote": {
"[星星眼]": {
"id": 1956,
"package_id": 1,
"state": 0,
"type": 1,
"attr": 0,
"text": "[星星眼]",
"url": "https://i0.hdslb.com/bfs/emote/63c9d1a31c0da745b61cdb35e0ecb28635675db2.png",
"meta": {
"size": 1,
"suggest": [
""
]
},
"mtime": 1668688325,
"jump_title": "星星眼"
}
},
"jump_url": {},
"max_line": 2
},
"replies": null,
"assist": 0,
"up_action": {
"like": false,
"reply": false
},
"invisible": false,
"reply_control": {
"max_line": 2,
"time_desc": "4天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
}
],
"assist": 0,
"up_action": {
"like": true,
"reply": true
},
"invisible": false,
"card_label": [
{
"rpid": 272139796528,
"text_content": "UP主觉得很赞",
"text_color_day": "#757575",
"text_color_night": "#939393",
"label_color_day": "#F4F4F4",
"label_color_night": "#1E1E1E",
"image": "",
"type": 0,
"background": "",
"background_width": 0,
"background_height": 0,
"jump_url": "",
"effect": 0,
"effect_start_time": 0
}
],
"reply_control": {
"up_like": true,
"up_reply": true,
"max_line": 6,
"sub_reply_entry_text": "共1条回复",
"sub_reply_title_text": "相关回复共1条",
"time_desc": "4天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
},
{
"rpid": 270933519921,
"oid": 362747247,
"type": 11,
"mid": 122589358,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 256,
"ctime": 1754905554,
"mid_str": "122589358",
"oid_str": "362747247",
"rpid_str": "270933519921",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 1,
"action": 0,
"member": {
"mid": "122589358",
"uname": "PRTShark",
"sex": "保密",
"sign": "唱着自己的歌,就不会忘记初衷",
"avatar": "https://i1.hdslb.com/bfs/face/d361e576cfb2250c697dcef03c978df3189a5a8a.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 6,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 10,
"name": "见习偶像",
"image": "https://i2.hdslb.com/bfs/face/e93dd9edfa7b9e18bf46fd8d71862327a2350923.png",
"image_small": "https://i1.hdslb.com/bfs/face/275b468b043ec246737ab8580a2075bee0b1263b.png",
"level": "普通勋章",
"condition": "所有自制视频总播放数>=10万"
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 1,
"vipDueDate": 1673539200000,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": {
"pendant": null,
"cardbg": null,
"cardbg_with_focus": null
},
"user_sailing_v2": {},
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/d361e576cfb2250c697dcef03c978df3189a5a8a.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "122589358"
}
},
"content": {
"message": "没事了,我把”@“给关了",
"members": [],
"jump_url": {},
"max_line": 6
},
"replies": [],
"assist": 0,
"up_action": {
"like": true,
"reply": false
},
"invisible": false,
"card_label": [
{
"rpid": 270933519921,
"text_content": "UP主觉得很赞",
"text_color_day": "#757575",
"text_color_night": "#939393",
"label_color_day": "#F4F4F4",
"label_color_night": "#1E1E1E",
"image": "",
"type": 0,
"background": "",
"background_width": 0,
"background_height": 0,
"jump_url": "",
"effect": 0,
"effect_start_time": 0
}
],
"reply_control": {
"up_like": true,
"max_line": 6,
"time_desc": "3天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
},
{
"rpid": 270926105521,
"oid": 362747247,
"type": 11,
"mid": 455215669,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1754901502,
"mid_str": "455215669",
"oid_str": "362747247",
"rpid_str": "270926105521",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 0,
"action": 0,
"member": {
"mid": "455215669",
"uname": "Aidemofashi_",
"sex": "男",
"sign": "aidemofashi_爱的魔法尸\nemail:zhonghuaiyu2019@163.com",
"avatar": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 0,
"vipDueDate": 0,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "455215669"
}
},
"content": {
"message": "datatest[星星眼]",
"members": [],
"emote": {
"[星星眼]": {
"id": 1956,
"package_id": 1,
"state": 0,
"type": 1,
"attr": 0,
"text": "[星星眼]",
"url": "https://i0.hdslb.com/bfs/emote/63c9d1a31c0da745b61cdb35e0ecb28635675db2.png",
"meta": {
"size": 1,
"suggest": [
""
]
},
"mtime": 1668688325,
"jump_title": "星星眼"
}
},
"jump_url": {},
"max_line": 6
},
"replies": [],
"assist": 0,
"up_action": {
"like": false,
"reply": false
},
"invisible": false,
"reply_control": {
"max_line": 6,
"time_desc": "3天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
},
{
"rpid": 270926184193,
"oid": 362747247,
"type": 11,
"mid": 455215669,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1754901514,
"mid_str": "455215669",
"oid_str": "362747247",
"rpid_str": "270926184193",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 0,
"action": 0,
"member": {
"mid": "455215669",
"uname": "Aidemofashi_",
"sex": "男",
"sign": "aidemofashi_爱的魔法尸\nemail:zhonghuaiyu2019@163.com",
"avatar": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 0,
"vipDueDate": 0,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "455215669"
}
},
"content": {
"message": "@PRTShark",
"at_name_to_mid": {
"PRTShark": 122589358
},
"at_name_to_mid_str": {
"PRTShark": "122589358"
},
"members": [
{
"mid": "122589358",
"uname": "PRTShark",
"sex": "保密",
"sign": "唱着自己的歌,就不会忘记初衷",
"avatar": "https://i1.hdslb.com/bfs/face/d361e576cfb2250c697dcef03c978df3189a5a8a.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 6,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 10,
"name": "见习偶像",
"image": "https://i2.hdslb.com/bfs/face/e93dd9edfa7b9e18bf46fd8d71862327a2350923.png",
"image_small": "https://i1.hdslb.com/bfs/face/275b468b043ec246737ab8580a2075bee0b1263b.png",
"level": "普通勋章",
"condition": "所有自制视频总播放数>=10万"
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 1,
"vipDueDate": 1673539200000,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
}
}
],
"jump_url": {},
"max_line": 6
},
"replies": [],
"assist": 0,
"up_action": {
"like": false,
"reply": false
},
"invisible": false,
"reply_control": {
"max_line": 6,
"time_desc": "3天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
},
{
"rpid": 270935559601,
"oid": 362747247,
"type": 11,
"mid": 455215669,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1754906517,
"mid_str": "455215669",
"oid_str": "362747247",
"rpid_str": "270935559601",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 0,
"action": 0,
"member": {
"mid": "455215669",
"uname": "Aidemofashi_",
"sex": "男",
"sign": "aidemofashi_爱的魔法尸\nemail:zhonghuaiyu2019@163.com",
"avatar": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 0,
"vipDueDate": 0,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "455215669"
}
},
"content": {
"message": "emojitest 😁😂😃😄👿😉😊☺️😌😍😏😒😓😔😘😚😜😝😞😠😡😢😣😥😨😪😭😰😱😲😳😷🙃😋😗😛🤑🤓😎🤗🙄🤔😩😤🤐🤒😴😀😆😅😇🙂😙😟😕☹️😫😶😐😑😯😦😧😮😵😬🤕😈👻🥺🥴🤣🥰🤩🤤🤫🤪🧐🤬🤧🤭🤠🤯🤥🥳🤨🤢🤡🤮🥵🥶💩☠️💀👽👾👺👹🤖",
"members": [],
"jump_url": {},
"max_line": 6
},
"replies": [],
"assist": 0,
"up_action": {
"like": false,
"reply": false
},
"invisible": false,
"reply_control": {
"max_line": 6,
"time_desc": "3天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
},
{
"rpid": 270936082385,
"oid": 362747247,
"type": 11,
"mid": 455215669,
"root": 0,
"parent": 0,
"dialog": 0,
"count": 0,
"rcount": 0,
"state": 0,
"fansgrade": 0,
"attr": 0,
"ctime": 1754906716,
"mid_str": "455215669",
"oid_str": "362747247",
"rpid_str": "270936082385",
"root_str": "0",
"parent_str": "0",
"dialog_str": "0",
"like": 0,
"action": 0,
"member": {
"mid": "455215669",
"uname": "Aidemofashi_",
"sex": "男",
"sign": "aidemofashi_爱的魔法尸\nemail:zhonghuaiyu2019@163.com",
"avatar": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 0,
"name": "",
"image": "",
"expire": 0,
"image_enhance": "",
"image_enhance_frame": "",
"n_pid": 0
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 0,
"vipDueDate": 0,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 0,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "",
"text": "",
"label_theme": "",
"text_color": "",
"bg_style": 0,
"bg_color": "",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
},
"avatar_subscript": 0,
"nickname_color": ""
},
"fans_detail": null,
"user_sailing": null,
"is_contractor": false,
"contract_desc": "",
"nft_interaction": null,
"avatar_item": {
"container_size": {
"width": 1.8,
"height": 1.8
},
"fallback_layers": {
"layers": [
{
"visible": true,
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"layer_config": {
"tags": {
"AVATAR_LAYER": {}
},
"is_critical": true,
"layer_mask": {
"general_spec": {
"pos_spec": {
"coordinate_pos": 2,
"axis_x": 0.9,
"axis_y": 0.9
},
"size_spec": {
"width": 1,
"height": 1
},
"render_spec": {
"opacity": 1
}
},
"mask_src": {
"src_type": 3,
"draw": {
"draw_type": 1,
"fill_mode": 1,
"color_config": {
"day": {
"argb": "#FF000000"
}
}
}
}
}
},
"resource": {
"res_type": 3,
"res_image": {
"image_src": {
"src_type": 1,
"placeholder": 6,
"remote": {
"url": "https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg",
"bfs_style": "widget-layer-avatar"
}
}
}
}
}
],
"is_critical_group": true
},
"mid": "455215669"
}
},
"content": {
"message": "@不起名发不了评论",
"at_name_to_mid": {
"不起名发不了评论": 1364672894
},
"at_name_to_mid_str": {
"不起名发不了评论": "1364672894"
},
"members": [
{
"mid": "1364672894",
"uname": "不起名发不了评论",
"sex": "保密",
"sign": "素质不详",
"avatar": "https://i2.hdslb.com/bfs/face/8b2fdc40200902cb777f7af54759aeb117b76ace.jpg",
"rank": "10000",
"face_nft_new": 0,
"is_senior_member": 0,
"senior": {},
"level_info": {
"current_level": 5,
"current_min": 0,
"current_exp": 0,
"next_exp": 0
},
"pendant": {
"pid": 1758,
"name": "至尊戒",
"image": "https://i2.hdslb.com/bfs/garb/item/025d07fa04d38236bc2258be2faf2867e2c48fe1.png",
"expire": 0,
"image_enhance": "https://i2.hdslb.com/bfs/garb/item/025d07fa04d38236bc2258be2faf2867e2c48fe1.png",
"image_enhance_frame": "",
"n_pid": 1758
},
"nameplate": {
"nid": 0,
"name": "",
"image": "",
"image_small": "",
"level": "",
"condition": ""
},
"official_verify": {
"type": -1,
"desc": ""
},
"vip": {
"vipType": 2,
"vipDueDate": 1779897600000,
"dueRemark": "",
"accessStatus": 0,
"vipStatus": 1,
"vipStatusWarn": "",
"themeType": 0,
"label": {
"path": "http://i0.hdslb.com/bfs/vip/label_annual.png",
"text": "年度大会员",
"label_theme": "annual_vip",
"text_color": "#FFFFFF",
"bg_style": 1,
"bg_color": "#FB7299",
"border_color": "",
"use_img_label": true,
"img_label_uri_hans": "",
"img_label_uri_hant": "",
"img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png",
"img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png"
},
"avatar_subscript": 1,
"nickname_color": "#FB7299"
}
}
],
"jump_url": {},
"max_line": 6
},
"replies": [],
"assist": 0,
"up_action": {
"like": false,
"reply": false
},
"invisible": false,
"reply_control": {
"max_line": 6,
"time_desc": "3天前发布",
"translation_switch": 1
},
"folder": {
"has_folded": false,
"is_folded": false,
"rule": ""
},
"dynamic_id_str": "0",
"note_cvid_str": "0",
"track_info": ""
}
],
"top": {
"admin": null,
"upper": null,
"vote": null
},
"top_replies": [],
"effects": {
"preloading": ""
},
"assist": 0,
"blacklist": 0,
"vote": 0,
"config": {
"showtopic": 1,
"show_up_flag": true,
"read_only": false
},
"upper": {
"mid": 455215669
},
"control": {
"input_disable": false,
"root_input_text": "你渴望拥有力量吗?评论让力量更强大",
"child_input_text": "你渴望拥有力量吗?评论让力量更强大",
"giveup_input_text": "不发没关系,请继续友善哦~",
"screenshot_icon_state": 3,
"upload_picture_icon_state": 1,
"answer_guide_text": "需要升级成为lv2会员后才可以评论,先去答题转正吧!",
"answer_guide_icon_url": "http://i0.hdslb.com/bfs/emote/96940d16602cacbbac796245b7bb99fa9b5c970c.png",
"answer_guide_ios_url": "https://www.bilibili.com/h5/newbie/entry?navhide=1&re_src=12",
"answer_guide_android_url": "https://www.bilibili.com/h5/newbie/entry?navhide=1&re_src=6",
"bg_text": "",
"empty_page": null,
"show_type": 1,
"show_text": "",
"web_selection": false,
"disable_jump_emote": false,
"enable_charged": false,
"enable_cm_biz_helper": false,
"preload_resources": null
},
"note": 0,
"callbacks": null
}
}

用脚本处理了一下,变成下面这样:

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
Comment 1:
User: Coronacosmo
Avatar: https://i0.hdslb.com/bfs/face/e49b2e87e33d846938fa33feac6566f439a0c1a8.jpg
Message: [热词系列_大师球]
Time: 2025-08-11 09:29:09
Likes: 1
Replies: 1
Comment ID: 272139796528
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------
Comment 2:
User: Aidemofashi_
Avatar: https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg
Message: 666,[星星眼]
Time: 2025-08-11 13:07:30
Likes: 0
Replies: 0
Comment ID: 270904965281
Root Comment ID: 272139796528
Reply to Comment ID: 272139796528
--------------------------------------------------
Comment 3:
User: PRTShark
Avatar: https://i1.hdslb.com/bfs/face/d361e576cfb2250c697dcef03c978df3189a5a8a.jpg
Message: 没事了,我把”@“给关了
Time: 2025-08-11 17:45:54
Likes: 1
Replies: 0
Comment ID: 270933519921
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------
Comment 4:
User: Aidemofashi_
Avatar: https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg
Message: emojitest 😁😂😃😄👿😉😊☺️😌😍😏😒😓😔😘😚😜😝😞😠😡😢😣😥😨😪😭😰😱😲😳😷🙃😋😗😛🤑🤓😎🤗🙄🤔😩😤🤐🤒😴😀😆😅😇🙂😙😟😕☹️😫😶😐😑😯😦😧😮😵😬🤕😈👻🥺🥴🤣🥰🤩🤤🤫🤪🧐🤬🤧🤭🤠🤯🤥🥳🤨🤢🤡🤮🥵🥶💩☠️💀👽👾👺👹🤖
Time: 2025-08-11 18:01:57
Likes: 0
Replies: 0
Comment ID: 270935559601
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------
Comment 5:
User: Aidemofashi_
Avatar: https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg
Message: @不起名发不了评论
Time: 2025-08-11 18:05:16
Likes: 0
Replies: 0
Comment ID: 270936082385
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------
Comment 6:
User: Aidemofashi_
Avatar: https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg
Message: datatest[星星眼]
Time: 2025-08-11 16:38:22
Likes: 0
Replies: 0
Comment ID: 270926105521
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------
Comment 7:
User: Aidemofashi_
Avatar: https://i1.hdslb.com/bfs/face/0bc090285a5b46c6b1652e35c18e3d54211e79ba.jpg
Message: @PRTShark
Time: 2025-08-11 16:38:34
Likes: 0
Replies: 0
Comment ID: 270926184193
Root Comment ID: 0
Reply to Comment ID: 0
--------------------------------------------------

把自己需要的提取出来就差不多了,下面是爬取和处理数据的脚本:

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
import requests
import json

def fetch_and_save_as_json(url, file_name='response_data.json'):
"""
使用伪装的请求头访问指定的URL,并将返回的数据保存为JSON文件

参数:
url (str): 要访问的URL
file_name (str): 保存的文件名,默认为'response_data.json'

返回:
bool: 操作是否成功
"""
# 模拟正常浏览器请求头
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
'Connection': 'keep-alive',
}

try:
# 发送HTTP GET请求,包含伪装的请求头
response = requests.get(url, headers=headers)

# 如果请求成功,响应状态码应该是200
if response.status_code == 200:
# 尝试将响应内容解析为JSON
try:
data = response.json()
except json.JSONDecodeError:
print("响应内容不是有效的JSON格式")
return False

# 将数据保存为JSON文件
with open(file_name, 'w', encoding='utf-8') as json_file:
json.dump(data, json_file, ensure_ascii=False, indent=4)

print(f"数据已成功保存到文件:{file_name}")
return True
else:
print(f"请求失败,状态码:{response.status_code}")
return False
except requests.exceptions.RequestException as e:
print(f"请求过程中发生错误:{e}")
return False

if __name__ == "__main__":
# 示例URL,可以根据需要修改
url = "https://api.bilibili.com/x/v2/reply/wbi/main?oid=362747247&type=11&mode=3&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=&web_location=1315875&w_rid=0e13dd54df5a4aa989eb972b1ce585c4&wts=1754889283"

# 调用函数
fetch_and_save_as_json(url)

数据处理:

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
import json
from datetime import datetime

def extract_bilibili_comments(json_file_path, output_txt_path):
try:
with open(json_file_path, 'r', encoding='utf-8') as file:
data = json.load(file)

comments = []

replies = data.get('data', {}).get('replies', [])

for reply in replies:
member = reply.get('member', {})
uname = member.get('uname', '')
avatar = member.get('avatar', '')

content = reply.get('content', {})
message = content.get('message', '')
ctime = reply.get('ctime', '')
comment_time = datetime.fromtimestamp(ctime).strftime('%Y-%m-%d %H:%M:%S') if ctime else ''

like = reply.get('like', 0)
rcount = reply.get('rcount', 0)

rpid = reply.get('rpid', '')
root = reply.get('root', '')

comment = {
'User': uname,
'Avatar': avatar,
'Message': message,
'Time': comment_time,
'Likes': like,
'Replies': rcount,
'Comment ID': rpid,
'Root Comment ID': root,
'Reply to Comment ID': reply.get('parent', '')
}

comments.append(comment)

sub_replies = reply.get('replies', [])
for sub_reply in sub_replies:
sub_member = sub_reply.get('member', {})
sub_uname = sub_member.get('uname', '')
sub_avatar = sub_member.get('avatar', '')

sub_content = sub_reply.get('content', {})
sub_message = sub_content.get('message', '')
sub_ctime = sub_reply.get('ctime', '')
sub_comment_time = datetime.fromtimestamp(sub_ctime).strftime('%Y-%m-%d %H:%M:%S') if sub_ctime else ''

sub_like = sub_reply.get('like', 0)
sub_rcount = sub_reply.get('rcount', 0)

sub_rpid = sub_reply.get('rpid', '')
sub_root = sub_reply.get('root', '')

sub_comment = {
'User': sub_uname,
'Avatar': sub_avatar,
'Message': sub_message,
'Time': sub_comment_time,
'Likes': sub_like,
'Replies': sub_rcount,
'Comment ID': sub_rpid,
'Root Comment ID': sub_root,
'Reply to Comment ID': sub_reply.get('parent', '')
}

comments.append(sub_comment)

with open(output_txt_path, 'w', encoding='utf-8') as txt_file:
for i, comment in enumerate(comments, 1):
txt_file.write(f"Comment {i}:\n")
txt_file.write(f"User: {comment['User']}\n")
txt_file.write(f"Avatar: {comment['Avatar']}\n")
txt_file.write(f"Message: {comment['Message']}\n")
txt_file.write(f"Time: {comment['Time']}\n")
txt_file.write(f"Likes: {comment['Likes']}\n")
txt_file.write(f"Replies: {comment['Replies']}\n")
txt_file.write(f"Comment ID: {comment['Comment ID']}\n")
txt_file.write(f"Root Comment ID: {comment['Root Comment ID']}\n")
txt_file.write(f"Reply to Comment ID: {comment['Reply to Comment ID']}\n")
txt_file.write("-" * 50 + "\n")

print(f"Comments data has been successfully saved to {output_txt_path}")

except Exception as e:
print(f"Error extracting comments data: {e}")

# Example usage
json_file_path = 'response_data.json' # Replace with your JSON file path
output_txt_path = 'comments.txt' # Output txt file path

extract_bilibili_comments(json_file_path, output_txt_path)

自动更新前端html

用python自动更新前端html,

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
import re
import os
import requests
from datetime import datetime
from typing import List, Dict

# 确保头像目录存在
AVATAR_DIR = "avatars"
os.makedirs(AVATAR_DIR, exist_ok=True)

def parse_comment_line(line: str) -> str:
line = line.strip()
if ':' not in line:
return None
key, value = line.split(':', 1)
return value.strip()

def download_avatar(url: str) -> str:
"""下载头像并返回本地文件路径,失败时返回默认头像"""
if not url.startswith('http'):
return 'avatars/default.jpg'

# 从 URL 提取文件名,避免特殊字符
filename = re.sub(r'[^a-zA-Z0-9._-]', '_', url.split('/')[-1].split('?')[0])
if not filename:
filename = 'avatar.jpg'
filepath = os.path.join(AVATAR_DIR, filename)

# 如果已存在则跳过下载
if os.path.exists(filepath):
return filepath.replace('\\', '/')

try:
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
response = requests.get(url, timeout=5, headers=headers)
if response.status_code == 200:
with open(filepath, 'wb') as f:
f.write(response.content)
print(f"✅ 下载头像: {filename}")
return filepath.replace('\\', '/') # 统一路径格式
else:
raise Exception(f"HTTP {response.status_code}")
except Exception as e:
print(f"❌ 下载头像失败 {url}: {e}")
# 返回默认头像(可选:下载一个默认图或使用本地默认)
default_path = os.path.join(AVATAR_DIR, 'default.jpg')
if not os.path.exists(default_path):
# 使用一个公开的默认头像(例如 GitHub 的默认头像)
try:
default_url = 'https://github.com/identicons/guest.png'
resp = requests.get(default_url, timeout=5)
with open(default_path, 'wb') as f:
f.write(resp.content)
except:
pass
return default_path.replace('\\', '/') if os.path.exists(default_path) else 'https://i1.hdslb.com/bfs/face/member/noface.jpg'

def parse_comments_from_file(file_path: str) -> List[Dict]:
"""解析出所有评论,并保留回复关系"""
comments = []
current = {}
with open(file_path, encoding='utf-8') as f:
lines = f.readlines()
for l in lines:
l = l.strip()
if l.startswith('Comment'):
if 'user' in current:
current.setdefault('message','')
current.setdefault('time', datetime.now())
comments.append(current)
current = {}
elif l.startswith('User:'):
current['user'] = parse_comment_line(l)
elif l.startswith('Avatar:'):
avatar_url = l[l.find('https://'):].split('"')[0] if 'https://' in l else 'https://i1.hdslb.com/bfs/face/member/noface.jpg'
current['avatar_url'] = avatar_url # 保留原始 URL
# 下载并设置本地路径(稍后在生成 HTML 时处理)
elif l.startswith('Message:'):
current['message'] = parse_comment_line(l)
elif l.startswith('Time:'):
current['time'] = datetime.strptime(parse_comment_line(l), '%Y-%m-%d %H:%M:%S')
elif l.startswith('Comment ID:'):
current['id'] = parse_comment_line(l)
elif l.startswith('Reply to Comment ID:'):
current['reply_to'] = parse_comment_line(l)
if 'user' in current:
comments.append(current)
return comments

def build_comment_html(comments: List[Dict]) -> str:
"""一次性生成整片评论区,含回复关系并倒序"""
if not comments:
return '<div class="comments-section"><h2>评论</h2><p style="color:white;">暂无评论</p></div>'

cid_map = {c['id']: c for c in comments if c.get('id')}
roots = [c for c in comments if not c.get('reply_to') or c['reply_to'] == '0']
roots.sort(key=lambda x: x['time'], reverse=True)

# 构建树结构
for comment in comments:
reply_to = comment.get('reply_to')
if reply_to and reply_to in cid_map:
parent = cid_map[reply_to]
if 'children' not in parent:
parent['children'] = []
parent['children'].append(comment)

def render(c: Dict, is_root=True) -> str:
user = c.get('user', '匿名')
# 下载头像并获取本地路径
avatar_url = c.get('avatar_url', 'https://i1.hdslb.com/bfs/face/member/noface.jpg')
avatar_local = download_avatar(avatar_url)
# 转换为相对路径(HTML 中使用)
avatar = os.path.relpath(avatar_local).replace('\\', '/')
msg = c.get('message', '').replace('<', '&lt;').replace('>', '&gt;')
time_str = c['time'].strftime('%m-%d %H:%M')

reply_info = ''
if c.get('reply_to') and c['reply_to'] in cid_map:
reply_info = f'<span class="reply-to">@{cid_map[c["reply_to"]]["user"]}</span> '

cls = 'root' if is_root else 'reply'
html = f'''
<div class="{cls}">
<img src="{avatar}" alt="{user}" class="avatar">
<div class="content">
<div class="head"><span class="u">{user}</span><span class="t">{time_str}</span></div>
<div class="body">{reply_info}{msg}</div>
</div>
</div>
'''
if 'children' in c:
sorted_children = sorted(c['children'], key=lambda x: x['time'])
replies_html = ''.join(render(child, is_root=False) for child in sorted_children)
html += f'<div class="replies">{replies_html}</div>'
return html

html_parts = ['<div class="comments-section"><h2>留言</h2><div class="thread">']
for root in roots:
html_parts.append(render(root, is_root=True))
html_parts.append('</div></div>')
return ''.join(html_parts)

def update_html(html_snippet: str) -> bool:
"""从 input.html 读取模板,生成新的 index.html,评论区插入在“队员”之后,“联系方式”之前"""
try:
with open('input.html', 'r', encoding='utf-8') as f:
src = f.read()

# ✅ 1. 删除已有的评论区(避免重复)
src = re.sub(r'<div class="comments-section">.*?</div>', '', src, flags=re.DOTALL)

# ✅ 2. 插入样式(确保样式存在,放在 </head> 前)
style = '''
<style>
.comments-section{background:#000;color:#fff;padding:20px;border-radius:5px;margin:30px 0}
.comments-section h2{font-size:22px;color:#fff;margin-bottom:15px;border-bottom:1px solid #333;padding-bottom:5px}
.thread{display:flex;flex-direction:column;gap:15px}
.root,.reply{display:flex;gap:12px;text-align:left}
.avatar{width:48px;height:48px;border-radius:50%;flex-shrink:0}
.content{flex:1}
.head{display:flex;gap:8px;margin-bottom:4px;flex-wrap:wrap}
.u{font-weight:bold;color:#fff;font-size:15px}
.t{color:#aaa;font-size:13px}
.body{color:#fff;font-size:16px;line-height:1.4;word-break:break-all}
.reply-to{color:#66ccff;font-size:15px}
.replies{margin-left:60px;border-left:2px solid #333;padding-left:12px;display:flex;flex-direction:column;gap:12px}
</style>
'''
src = re.sub(r'</head>', style + '\n</head>', src, flags=re.I)

# ✅ 3. 精准定位:在 "队员" 模块后、"联系方式" 前插入评论区
list_match = re.search(r'<p[^>]*class="[^"]*list[^"]*"[^>]*>.*?</p>', src, re.I | re.DOTALL)
contact_match = re.search(r'<p[^>]*class="[^"]*con[^"]*"[^>]*>.*?</p>', src, re.I | re.DOTALL)

if list_match and contact_match:
list_end = list_match.end()
contact_start = contact_match.start()

middle_part = src[list_end:contact_start].strip()
middle_clean = re.sub(r'<div class="comments-section">.*?</div>', '', middle_part, flags=re.DOTALL).strip()

insertion = f'\n{html_snippet}\n{middle_clean}\n' if middle_clean else f'\n{html_snippet}\n'

new_src = src[:list_end] + insertion + src[contact_start:]

with open('index.html', 'w', encoding='utf-8') as f:
f.write(new_src)
return True
else:
print("❌ 找不到 '队员' 或 '联系方式' 模块,无法插入评论区")
return False

except Exception as e:
print(f"生成 index.html 失败: {e}")
return False

def main():
if not os.path.exists('comments.txt'):
print('错误:缺少 comments.txt 文件')
return
if not os.path.exists('input.html'):
print('错误:缺少 input.html 模板文件')
return

comments = parse_comments_from_file('comments.txt')
html_snippet = build_comment_html(comments)

if update_html(html_snippet):
print('✅ 成功生成 index.html,评论区已更新')
else:
print('❌ 生成 index.html 失败')

if __name__ == '__main__':
main()

总结

做这个主要是要给主页实现留言功能,然后了解到一些个人主页的评论是用github评论来实现的,那就想是用b站评论也可以,就搞了一下

本人的前后端开发水平不高,代码这块是拷打ai,实现了一下想法而已,这样整个web服务是完全没用到php和py,就算在评论区想注马也没东西能执行,应该安全度会很高

然后后端写个每个10分钟讯息执行三步py文件的脚本即可


主页前端留言功能实现
https://aidemofashi.github.io/2025/08/15/主页前端留言功能实现/
作者
aidemofashi
发布于
2025年8月15日
许可协议