Skip to content

Commit

Permalink
update shop.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fllesser committed Jan 9, 2025
1 parent e93b169 commit 80dd0b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nonebot_plugin_fortnite/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ async def screenshot_shop_img() -> Path:

async with async_playwright() as p:
try:
browser = await p.chromium.launch(headless=True) # 启动无头模式的 Chromium 浏览器
browser = await p.chromium.launch(headless=True, ignore_https_errors=True) # 启动无头模式的 Chromium 浏览器
# page = await browser.new_page()
context = await browser.new_context(
extra_http_headers = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
'Referer': 'https://fortnite.gg',
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
'Accept-Encoding': "gzip, deflate",
'upgrade-insecure-requests': "1",
Expand All @@ -46,6 +47,7 @@ async def screenshot_shop_img() -> Path:
# }])

page = await context.new_page()
await page.add_style_tag(content='* { transition: none !important; animation: none !important; }')
await page.goto(url, wait_until='networkidle', timeout=60000)
# await page.wait_for_load_state('load') # 等待页面加载完毕
await page.screenshot(path=shop_file, full_page=True)
Expand Down

0 comments on commit 80dd0b8

Please sign in to comment.