Skip to content

Commit

Permalink
update pve.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fllesser committed Jan 8, 2025
1 parent 90e66ae commit 9416358
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nonebot_plugin_fortnite/pve.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@

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:
browser = await p.chromium.launch(headless=True) # 启动无头模式的 Chromium 浏览器
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)
Expand Down

0 comments on commit 9416358

Please sign in to comment.