日报增加Cookie有效期检测(ALF字段), 按剩余天数分级预警
This commit is contained in:
@@ -12,6 +12,11 @@ import re
|
||||
import asyncio
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "backend"))
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
|
||||
|
||||
# 兼容容器内运行(/app 目录)
|
||||
if os.path.exists("/app/shared"):
|
||||
sys.path.insert(0, "/app")
|
||||
|
||||
from shared.config import shared_settings
|
||||
from shared.crypto import decrypt_cookie, derive_key
|
||||
@@ -56,6 +61,16 @@ async def main():
|
||||
|
||||
print(f"🍪 Cookie 数量: {len(cookies)}, keys: {list(cookies.keys())}")
|
||||
|
||||
# 检查 Cookie 有效期
|
||||
from datetime import datetime
|
||||
alf = cookies.get("ALF", "")
|
||||
if alf and alf.isdigit():
|
||||
expire_time = datetime.fromtimestamp(int(alf))
|
||||
remain = (expire_time - datetime.now()).days
|
||||
print(f"📅 Cookie 过期时间: {expire_time.strftime('%Y-%m-%d %H:%M:%S')} (还剩 {remain} 天)")
|
||||
else:
|
||||
print(f"📅 ALF 字段: {alf or '无'} (无法判断过期时间)")
|
||||
|
||||
await engine.dispose()
|
||||
|
||||
# 测试 1: 访问 weibo.com
|
||||
|
||||
Reference in New Issue
Block a user