This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdemo_yui.py
63 lines (62 loc) · 2.56 KB
/
demo_yui.py
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
import bilib
import time
def show_comment(aid,page = 1,video = True):
info = bilib.video_comment(aid = aid,page=page,video=video)
for key,value in info.items():
total_page = value["total_page"]
print("第" + str(page) + "页/共" + str(total_page) + "页")
break
for key,value in info.items():
if str(key).isdigit():
main_key = str(int(key) + 1)
else:
main_key = str(key)
print("---------------------")
print("第" + main_key + "条评论:")
ctime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(value["ctime"]))
print("发送时间:" + ctime)
print("评论ID:" + str(value["rpid"]))
print("此楼评论总数:" + str(value["rcount"]))
print("来自 " + value["uname"] + "(" + value["mid"] + ")," + value["sex"])
print("其评论:" + value["message"])
print("点赞数:" + str(value["like"]))
if value["up_like"] == True:
print("UP主觉得很赞")
else:
pass
if value["up_reply"] == True:
print("UP主在此层回复了")
else:
pass
if str(value["replies_item"]) == str("None"):
print("此层无回复")
else:
replies_item = {}
replies_item = value["replies_item"]
for part_key,part_value in replies_item.items():
if str(key).isdigit():
part_key = str(int(part_key))
else:
part_key = str(part_key)
print(" |")
print("---第" + main_key + "层下的第" + part_key + "条评论:")
ctime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(part_value["ctime"]))
print(" ---发送时间:" + ctime)
print(" ---评论ID:" + str(part_value["rpid"]))
print(" ---来自 " + part_value["uname"] + "(" + part_value["mid"] + ")," + part_value["sex"])
print(" ---其评论:" + part_value["message"])
print(" ---点赞数:" + str(part_value["like"]))
if part_value["up_like"] == True:
print(" ---UP主觉得很赞")
else:
pass
if part_value["up_reply"] == True:
print(" ---UP主在此层回复了")
else:
pass
"""
show_comment(bilib.video_info("BV117411p7US")["aid"])
for i in range(14,57 + 1):
show_comment(2543959,page = i)
time.sleep(3)
"""