Evilmass commited on
Commit ·
71baa3b
1
Parent(s): 20360a6
修复bilibili随送img_url参数
Browse files- _playwright/bilibili.py +1 -1
- api.py +20 -12
- app.py +2 -2
_playwright/bilibili.py
CHANGED
|
@@ -115,7 +115,7 @@ async def bilibili_sign():
|
|
| 115 |
push_msg(
|
| 116 |
title=bilibili_title,
|
| 117 |
message="\n".join([sign_result, "", live_result]),
|
| 118 |
-
|
| 119 |
)
|
| 120 |
|
| 121 |
|
|
|
|
| 115 |
push_msg(
|
| 116 |
title=bilibili_title,
|
| 117 |
message="\n".join([sign_result, "", live_result]),
|
| 118 |
+
img_url=bilibili_img,
|
| 119 |
)
|
| 120 |
|
| 121 |
|
api.py
CHANGED
|
@@ -26,17 +26,23 @@ def tick():
|
|
| 26 |
def run_scheduler(loop):
|
| 27 |
asyncio.set_event_loop(loop)
|
| 28 |
# add task
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
try:
|
| 41 |
asyncio.get_event_loop().run_forever()
|
| 42 |
except (KeyboardInterrupt, SystemExit):
|
|
@@ -44,7 +50,9 @@ def run_scheduler(loop):
|
|
| 44 |
|
| 45 |
|
| 46 |
def start_daemon_scheduler(loop):
|
| 47 |
-
t = threading.Thread(
|
|
|
|
|
|
|
| 48 |
t.start()
|
| 49 |
|
| 50 |
|
|
|
|
| 26 |
def run_scheduler(loop):
|
| 27 |
asyncio.set_event_loop(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 |
+
vits_sign, "cron", hour="0, 12", minute=6, next_run_time=datetime.now()
|
| 38 |
+
)
|
| 39 |
+
task.add_job(
|
| 40 |
+
aliyundrive_sign, "cron", hour="*/6", minute=7, next_run_time=datetime.now()
|
| 41 |
+
)
|
| 42 |
+
task.add_job(
|
| 43 |
+
validate_access_token, "cron", hour="*/2", next_run_time=datetime.now()
|
| 44 |
+
)
|
| 45 |
+
task.start()
|
| 46 |
try:
|
| 47 |
asyncio.get_event_loop().run_forever()
|
| 48 |
except (KeyboardInterrupt, SystemExit):
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
def start_daemon_scheduler(loop):
|
| 53 |
+
t = threading.Thread(
|
| 54 |
+
target=run_scheduler, args=(loop,), name="schedule", daemon=True
|
| 55 |
+
)
|
| 56 |
t.start()
|
| 57 |
|
| 58 |
|
app.py
CHANGED
|
@@ -36,7 +36,7 @@ async def do_run(token: str):
|
|
| 36 |
return res
|
| 37 |
|
| 38 |
|
| 39 |
-
#
|
| 40 |
@app.get("/kill")
|
| 41 |
def do_kill(token: str):
|
| 42 |
if token != api_token:
|
|
@@ -96,4 +96,4 @@ def do_push(token: str):
|
|
| 96 |
|
| 97 |
|
| 98 |
if __name__ == "__main__":
|
| 99 |
-
run("app:app", host="0.0.0.0", port=8000, reload=
|
|
|
|
| 36 |
return res
|
| 37 |
|
| 38 |
|
| 39 |
+
# 关闭定时任务
|
| 40 |
@app.get("/kill")
|
| 41 |
def do_kill(token: str):
|
| 42 |
if token != api_token:
|
|
|
|
| 96 |
|
| 97 |
|
| 98 |
if __name__ == "__main__":
|
| 99 |
+
run("app:app", host="0.0.0.0", port=8000, reload=False)
|