mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-06 09:35:48 +00:00
Compare commits
2 Commits
send-test-
...
playwright
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d2bc5049b | ||
|
|
186016e605 |
@@ -96,7 +96,7 @@ def execute_ruleset_against_all_plugins(current_watch_uuid: str, application_dat
|
|||||||
|
|
||||||
ruleset_settings = application_datastruct['watching'].get(current_watch_uuid)
|
ruleset_settings = application_datastruct['watching'].get(current_watch_uuid)
|
||||||
|
|
||||||
if ruleset_settings.get("conditions"):
|
if ruleset_settings and ruleset_settings.get("conditions"):
|
||||||
logic_operator = "and" if ruleset_settings.get("conditions_match_logic", "ALL") == "ALL" else "or"
|
logic_operator = "and" if ruleset_settings.get("conditions_match_logic", "ALL") == "ALL" else "or"
|
||||||
complete_rules = filter_complete_rules(ruleset_settings['conditions'])
|
complete_rules = filter_complete_rules(ruleset_settings['conditions'])
|
||||||
if complete_rules:
|
if complete_rules:
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ def capture_full_page(page):
|
|||||||
step_size = SCREENSHOT_SIZE_STITCH_THRESHOLD # Size that won't cause GPU to overflow
|
step_size = SCREENSHOT_SIZE_STITCH_THRESHOLD # Size that won't cause GPU to overflow
|
||||||
screenshot_chunks = []
|
screenshot_chunks = []
|
||||||
y = 0
|
y = 0
|
||||||
|
|
||||||
# If page height is larger than current viewport, use a larger viewport for better capturing
|
|
||||||
if page_height > page.viewport_size['height']:
|
if page_height > page.viewport_size['height']:
|
||||||
|
if page_height < step_size:
|
||||||
|
step_size = page_height # Incase page is bigger than default viewport but smaller than proposed step size
|
||||||
|
logger.debug(f"Setting bigger viewport to step through large page width W{page.viewport_size['width']}xH{step_size} because page_height > viewport_size")
|
||||||
# Set viewport to a larger size to capture more content at once
|
# Set viewport to a larger size to capture more content at once
|
||||||
page.set_viewport_size({'width': page.viewport_size['width'], 'height': step_size})
|
page.set_viewport_size({'width': page.viewport_size['width'], 'height': step_size})
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ async def capture_full_page(page):
|
|||||||
screenshot_chunks = []
|
screenshot_chunks = []
|
||||||
y = 0
|
y = 0
|
||||||
if page_height > page.viewport['height']:
|
if page_height > page.viewport['height']:
|
||||||
|
if page_height < step_size:
|
||||||
|
step_size = page_height # Incase page is bigger than default viewport but smaller than proposed step size
|
||||||
await page.setViewport({'width': page.viewport['width'], 'height': step_size})
|
await page.setViewport({'width': page.viewport['width'], 'height': step_size})
|
||||||
|
|
||||||
|
|
||||||
while y < min(page_height, SCREENSHOT_MAX_TOTAL_HEIGHT):
|
while y < min(page_height, SCREENSHOT_MAX_TOTAL_HEIGHT):
|
||||||
await page.evaluate(f"window.scrollTo(0, {y})")
|
await page.evaluate(f"window.scrollTo(0, {y})")
|
||||||
screenshot_chunks.append(await page.screenshot(type_='jpeg',
|
screenshot_chunks.append(await page.screenshot(type_='jpeg',
|
||||||
|
|||||||
Reference in New Issue
Block a user