From 94163581e2b4ba9ec452dfca60482851531da15f Mon Sep 17 00:00:00 2001 From: fllesser Date: Thu, 9 Jan 2025 02:31:31 +0800 Subject: [PATCH] update pve.py --- nonebot_plugin_fortnite/pve.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonebot_plugin_fortnite/pve.py b/nonebot_plugin_fortnite/pve.py index 022cab4..0b30773 100644 --- a/nonebot_plugin_fortnite/pve.py +++ b/nonebot_plugin_fortnite/pve.py @@ -5,6 +5,7 @@ async def screenshot_vb_img(): url = "https://freethevbucks.com/timed-missions" + temp_file = cache_dir / "temp.png" file = cache_dir / "vb.png" async with async_playwright() as p: try: @@ -12,13 +13,13 @@ async def screenshot_vb_img(): page = await browser.new_page() await page.goto(url) # 打开指定 URL element = await page.query_selector('.infonotice') - await element.screenshot(path=file) # 截取整个页面 + await element.screenshot(path=temp_file) # 截取整个页面 except Exception as e: raise e finally: await browser.close() - with Image.open(file) as img: + with Image.open(temp_file) as img: clip = (0, 0, 500, 0) cropped_img = img.crop(clip) cropped_img.save(file)