PlaywrightCapture 1.42.2__tar.gz → 1.42.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PlaywrightCapture
3
- Version: 1.42.2
3
+ Version: 1.42.4
4
4
  Summary: A simple library to capture websites using playwright
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -28,7 +28,7 @@ Requires-Dist: dnspython (>=2.8.0,<2.9.0) ; python_version == "3.10"
28
28
  Requires-Dist: dnspython (>=2.9.0,<3.0.0) ; python_version >= "3.11" and python_version < "4.0"
29
29
  Requires-Dist: lookyloo-models (>=0.4.7)
30
30
  Requires-Dist: orjson (>=3.12,<4.0.0)
31
- Requires-Dist: playwright (>=1.63.0)
31
+ Requires-Dist: playwright (>=1.64.0)
32
32
  Requires-Dist: playwright-stealth (>=2.0.3)
33
33
  Requires-Dist: pure-magic-rs (>=0.5.1)
34
34
  Requires-Dist: pydub-ng (>=0.2.0) ; extra == "recaptcha"
@@ -546,45 +546,35 @@ class Capture():
546
546
  async def initialize_context(self) -> None:
547
547
  device_context_settings = {}
548
548
  vp: dict[str, int] | None = None
549
- no_viewport = True
550
549
  if self.device_name:
551
550
  device_context_settings = self.playwright.devices[self.device_name]
552
551
  # We need to make sure the device_context_settings dict doesn't contains
553
552
  # keys that are set by default in the context creation
554
553
  ua = device_context_settings.pop('user_agent', self._user_agent)
555
554
  vp = device_context_settings.pop('viewport', self._viewport)
556
- # NOTE 2026-10-13: cannot set no_viewport if either scale factor or ismobile are set:
557
- # https://github.com/microsoft/playwright/blob/a3401cfe0dcf317101572d025fa46248d0779b42/packages/playwright-core/src/server/browserContext.ts#L755
558
- if 'device_scale_factor' in device_context_settings or 'is_mobile' in device_context_settings:
559
- no_viewport = False
560
555
  else:
561
556
  ua = self._user_agent
562
- vp = self._viewport
563
-
564
- # NOTE 2026-04-10: Very specific edge case:
565
- # * capture in remote headfull mode with xpra
566
- # * the browser is webkit
567
- # => setting a viewport fails with (possibly related to x11?):
568
- # BrowserContext.new_page: Protocol error (Emulation.setDeviceMetricsOverride): Failed to resize window
569
- # fun thing is that is seems to be working as expected with
570
- # self._env.update({'DEBUG': 'pw:protocol'})
571
- # Playwright bug: https://github.com/microsoft/playwright/issues/40149
572
- # So skip the viewport for now, it's not a very big deal.
573
- # if self.remote_headfull and self.browser_name == 'webkit':
574
- # vp = None
557
+ if self._viewport:
558
+ vp = self._viewport
559
+ elif self.headless:
560
+ vp = self._default_viewport
561
+ else:
562
+ # headfull mode and no viewport in the settings, vp is intentionally None
563
+ # no_viewport is then passed as True, allowing resizing.
564
+ pass
575
565
 
576
566
  self.context = await self.browser.new_context(
577
567
  record_har_path=self._temp_harfile.name,
578
568
  ignore_https_errors=True,
579
569
  bypass_csp=True,
580
- no_viewport=no_viewport, # Allows resize in headfull mode.
570
+ no_viewport=vp is None, # Allows resize in headfull mode.
581
571
  java_script_enabled=self._java_script_enabled,
582
572
  http_credentials=self._http_credentials, # type: ignore[arg-type]
583
573
  user_agent=ua,
584
574
  locale=self._locale,
585
575
  timezone_id=self._timezone_id,
586
576
  color_scheme=self._color_scheme,
587
- viewport=vp if vp else self._default_viewport, # type: ignore[arg-type]
577
+ viewport=vp, # type: ignore[arg-type]
588
578
  storage_state=self._storage, # type: ignore[arg-type]
589
579
  record_video_dir=self._temp_video_dir.name if self._temp_video_dir else None,
590
580
  record_video_size=self.__video_size(vp) if self._temp_video_dir else None, # type: ignore[arg-type]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PlaywrightCapture"
3
- version = "1.42.2"
3
+ version = "1.42.4"
4
4
  description = "A simple library to capture websites using playwright"
5
5
  authors = [
6
6
  {name="Raphaël Vinot", email= "raphael.vinot@circl.lu"}
@@ -12,7 +12,7 @@ requires-python = ">=3.10,<3.15"
12
12
  dynamic = [ "classifiers" ]
13
13
 
14
14
  dependencies = [
15
- "playwright (>=1.63.0)",
15
+ "playwright (>=1.64.0)",
16
16
  "beautifulsoup4[charset-normalizer,lxml] (>=4.15.0)",
17
17
  "w3lib (>=2.5.0)",
18
18
  "playwright-stealth (>=2.0.3)",