PlaywrightCapture 1.41.7__tar.gz → 1.42.0__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.41.7
3
+ Version: 1.42.0
4
4
  Summary: A simple library to capture websites using playwright
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -25,7 +25,7 @@ Requires-Dist: async-timeout (>=5.0.1) ; python_version < "3.11"
25
25
  Requires-Dist: beautifulsoup4[charset-normalizer,lxml] (>=4.15.0)
26
26
  Requires-Dist: charset-normalizer (>=3.4.6,<4.0.0)
27
27
  Requires-Dist: dnspython (>=2.7.0,<3.0.0)
28
- Requires-Dist: lookyloo-models (>=0.4.6)
28
+ Requires-Dist: lookyloo-models (>=0.4.7)
29
29
  Requires-Dist: orjson (>=3.12,<4.0.0)
30
30
  Requires-Dist: playwright (>=1.63.0)
31
31
  Requires-Dist: playwright-stealth (>=2.0.3)
@@ -35,7 +35,7 @@ Requires-Dist: pyfaup-rs (>=0.4.6,<0.5.0)
35
35
  Requires-Dist: python-socks (>=3.0.0,<4.0.0)
36
36
  Requires-Dist: rfc3161-client (>=1.0.4,<2.0.0)
37
37
  Requires-Dist: typing-extensions (>=4.12.2,<5.0.0) ; python_version < "3.12"
38
- Requires-Dist: w3lib (>=2.4.1)
38
+ Requires-Dist: w3lib (>=2.5.0)
39
39
  Project-URL: Issues, https://github.com/Lookyloo/PlaywrightCapture/issues
40
40
  Project-URL: Repository, https://github.com/Lookyloo/PlaywrightCapture
41
41
  Description-Content-Type: text/markdown
@@ -313,7 +313,7 @@ class Capture():
313
313
  # if the capture is triggered with video, create the directory
314
314
  self._temp_video_dir: TemporaryDirectory[str] | None = None
315
315
  if self.with_video:
316
- self._temp_video_dir = TemporaryDirectory(delete=False, prefix="playwright_capture_video", ignore_cleanup_errors=True)
316
+ self._temp_video_dir = TemporaryDirectory(prefix="playwright_capture_video", ignore_cleanup_errors=True)
317
317
 
318
318
  # all the errors gathered during the capture
319
319
  self.errors: list[str] = []
@@ -1069,12 +1069,17 @@ class Capture():
1069
1069
  await self._safe_wait(page)
1070
1070
  self.logger.debug('Done with waiting.')
1071
1071
 
1072
- async def _safe_get_storage_state(self) -> dict[str, Any]:
1072
+ async def _safe_get_storage_state(self, page: Page) -> dict[str, Any]:
1073
1073
  # Collect storage state, including IndexedDB, to capture the full browser state.
1074
1074
  # 2026-09-08: add WebAuth credentials
1075
1075
  # 2026-09-17: Add opfs
1076
+ # 2026-10-06: Do not try to get the OPFS from non-secure context, it always fails.
1077
+ in_secure_context = any(page.url.startswith(b) for b in ['https://', 'file://', 'http://localhost'])
1078
+ if not in_secure_context:
1079
+ self.logger.info("Not in a secure context, skip OPFS.")
1080
+
1081
+ to_store = {'indexed_db': True, 'opfs': in_secure_context, 'credentials': True}
1076
1082
  # Quite a few captures fail either on opfs or on indexed db, so we hav a few fallbacks
1077
- to_store = {'indexed_db': True, 'opfs': True, 'credentials': True}
1078
1083
  while True:
1079
1084
  try:
1080
1085
  async with timeout(15):
@@ -1157,7 +1162,7 @@ class Capture():
1157
1162
  self.errors.append(f'[Generic Exception] Unable to get the cookies: {e}')
1158
1163
  self.should_retry = True
1159
1164
 
1160
- to_return['storage'] = await self._safe_get_storage_state()
1165
+ to_return['storage'] = await self._safe_get_storage_state(page)
1161
1166
 
1162
1167
  try:
1163
1168
  if page.is_closed():
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PlaywrightCapture"
3
- version = "1.41.7"
3
+ version = "1.42.0"
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"}
@@ -14,7 +14,7 @@ dynamic = [ "classifiers" ]
14
14
  dependencies = [
15
15
  "playwright (>=1.63.0)",
16
16
  "beautifulsoup4[charset-normalizer,lxml] (>=4.15.0)",
17
- "w3lib (>=2.4.1)",
17
+ "w3lib (>=2.5.0)",
18
18
  "playwright-stealth (>=2.0.3)",
19
19
  "async-timeout (>=5.0.1) ; python_version < \"3.11\"",
20
20
  "aiohttp[speedups] (>=3.14.3)",
@@ -25,7 +25,7 @@ dependencies = [
25
25
  "rfc3161-client (>=1.0.4,<2.0.0)",
26
26
  "orjson (>=3.12,<4.0.0)",
27
27
  "pure-magic-rs (>=0.5.1)",
28
- "lookyloo-models (>=0.4.6)",
28
+ "lookyloo-models (>=0.4.7)",
29
29
  "charset-normalizer (>=3.4.6,<4.0.0)",
30
30
  "pyfaup-rs (>=0.4.6,<0.5.0)"
31
31
  ]
@@ -52,7 +52,7 @@ recaptcha = [
52
52
  [tool.poetry.group.dev.dependencies]
53
53
  types-beautifulsoup4 = "^4.12.0.20250516"
54
54
  pytest = "^9.1.1"
55
- mypy = "^2.3.1"
55
+ mypy = "^2.4.0"
56
56
  types-dateparser = "^1.4.3.20260907"
57
57
  types-pytz = "^2026.4.0.20260926"
58
58