mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
* 🔥 删除现有模板 * ✨ 自动克隆模板仓库 * 🔥 删除 identicon 相关代码 * 🚚 修改静态文件路径 * ✨ 使用新模板进行渲染 * ✨ 每次渲染都获取一次模板, 以应对实时更新 * ✨ TETR.IO 绑定图使用新模板 * 🚚 修改网络路径 * ✨ TOP 绑定图使用新模板 * ✨ TOS 绑定图使用新模板 * 🐛 防止截图超时 * 🐛 Pydantic V1 会把 float 转换成 int * ✏️ 模板字段名写错了 * ✨ 兼容 Pydantic V1 * ✨ TETR.IO 查询图使用新模板 * 🐛 在查询的用户没有历史记录时不去查询更多记录
12 lines
394 B
Python
12 lines
394 B
Python
from .browser import BrowserManager
|
|
|
|
|
|
async def screenshot(url: str) -> bytes:
|
|
browser = await BrowserManager.get_browser()
|
|
async with (
|
|
await browser.new_page(no_viewport=True, viewport={'width': 0, 'height': 0}) as page,
|
|
):
|
|
await page.goto(url)
|
|
await page.wait_for_load_state('networkidle')
|
|
return await page.screenshot(full_page=True, type='png')
|