Evilmass
commited on
Commit
·
1336d47
1
Parent(s):
71baa3b
add misfire_grace_time && coalesce=True
Browse files- _playwright/bilibili.py +1 -4
- api.py +64 -8
_playwright/bilibili.py
CHANGED
@@ -24,7 +24,7 @@ from __init__ import (
|
|
24 |
# 判断登录状态
|
25 |
async def is_login(page):
|
26 |
await page.goto(bilibili_url)
|
27 |
-
if await page.get_by_text("修改资料").is_visible(timeout=
|
28 |
bilibili_logger.info("登录成功")
|
29 |
return True
|
30 |
else:
|
@@ -63,9 +63,6 @@ async def sign(page):
|
|
63 |
async def live(page):
|
64 |
msg = []
|
65 |
|
66 |
-
if not await is_login(page):
|
67 |
-
return "bilibili_not_login"
|
68 |
-
|
69 |
bilibili_live_rooms = await get_bilibili_live_rooms_from_pi()
|
70 |
for room_id in list(bilibili_live_rooms.keys()):
|
71 |
await page.goto(f"{bilibili_live_url}/{str(room_id)}")
|
|
|
24 |
# 判断登录状态
|
25 |
async def is_login(page):
|
26 |
await page.goto(bilibili_url)
|
27 |
+
if await page.get_by_text("修改资料").is_visible(timeout=5000):
|
28 |
bilibili_logger.info("登录成功")
|
29 |
return True
|
30 |
else:
|
|
|
63 |
async def live(page):
|
64 |
msg = []
|
65 |
|
|
|
|
|
|
|
66 |
bilibili_live_rooms = await get_bilibili_live_rooms_from_pi()
|
67 |
for room_id in list(bilibili_live_rooms.keys()):
|
68 |
await page.goto(f"{bilibili_live_url}/{str(room_id)}")
|
api.py
CHANGED
@@ -28,19 +28,75 @@ def run_scheduler(loop):
|
|
28 |
# add task
|
29 |
task = AsyncIOScheduler()
|
30 |
task.configure(timezone=pytz.timezone("Asia/Shanghai"))
|
31 |
-
task.add_job(tick, "cron", second="*/59", next_run_time=datetime.now())
|
32 |
-
task.add_job(bilibili_sign, "cron", hour=6, minute=1, next_run_time=datetime.now())
|
33 |
-
task.add_job(v2ex_sign, "cron", hour=6, minute=2, next_run_time=datetime.now())
|
34 |
-
task.add_job(tsdm_sign, "cron", hour="*/6", minute=3, next_run_time=datetime.now())
|
35 |
-
task.add_job(wuaipojie_sign, "cron", hour=6, minute=4, next_run_time=datetime.now())
|
36 |
task.add_job(
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
)
|
39 |
task.add_job(
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
)
|
42 |
task.add_job(
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
)
|
45 |
task.start()
|
46 |
try:
|
|
|
28 |
# add task
|
29 |
task = AsyncIOScheduler()
|
30 |
task.configure(timezone=pytz.timezone("Asia/Shanghai"))
|
|
|
|
|
|
|
|
|
|
|
31 |
task.add_job(
|
32 |
+
tick,
|
33 |
+
"cron",
|
34 |
+
second="*/59",
|
35 |
+
next_run_time=datetime.now(),
|
36 |
+
coalesce=True,
|
37 |
+
misfire_grace_time=60,
|
38 |
)
|
39 |
task.add_job(
|
40 |
+
bilibili_sign,
|
41 |
+
"cron",
|
42 |
+
hour=6,
|
43 |
+
minute=1,
|
44 |
+
next_run_time=datetime.now(),
|
45 |
+
coalesce=True,
|
46 |
+
misfire_grace_time=60 * 60 * 12,
|
47 |
)
|
48 |
task.add_job(
|
49 |
+
v2ex_sign,
|
50 |
+
"cron",
|
51 |
+
hour=6,
|
52 |
+
minute=2,
|
53 |
+
next_run_time=datetime.now(),
|
54 |
+
coalesce=True,
|
55 |
+
misfire_grace_time=60 * 60 * 12,
|
56 |
+
)
|
57 |
+
task.add_job(
|
58 |
+
tsdm_sign,
|
59 |
+
"cron",
|
60 |
+
hour=6,
|
61 |
+
minute=3,
|
62 |
+
next_run_time=datetime.now(),
|
63 |
+
coalesce=True,
|
64 |
+
misfire_grace_time=60 * 60 * 12,
|
65 |
+
)
|
66 |
+
task.add_job(
|
67 |
+
wuaipojie_sign,
|
68 |
+
"cron",
|
69 |
+
hour=6,
|
70 |
+
minute=4,
|
71 |
+
next_run_time=datetime.now(),
|
72 |
+
coalesce=True,
|
73 |
+
misfire_grace_time=60 * 60 * 12,
|
74 |
+
)
|
75 |
+
task.add_job(
|
76 |
+
vits_sign,
|
77 |
+
"cron",
|
78 |
+
hour="0, 12",
|
79 |
+
minute=6,
|
80 |
+
next_run_time=datetime.now(),
|
81 |
+
coalesce=True,
|
82 |
+
misfire_grace_time=60 * 60 * 12,
|
83 |
+
)
|
84 |
+
task.add_job(
|
85 |
+
aliyundrive_sign,
|
86 |
+
"cron",
|
87 |
+
hour=6,
|
88 |
+
minute=7,
|
89 |
+
next_run_time=datetime.now(),
|
90 |
+
coalesce=True,
|
91 |
+
misfire_grace_time=60 * 60 * 12,
|
92 |
+
)
|
93 |
+
task.add_job(
|
94 |
+
validate_access_token,
|
95 |
+
"cron",
|
96 |
+
hour="*/2",
|
97 |
+
next_run_time=datetime.now(),
|
98 |
+
coalesce=True,
|
99 |
+
misfire_grace_time=60 * 60 * 12,
|
100 |
)
|
101 |
task.start()
|
102 |
try:
|