PlaywrightCapture 1.25.1__py3-none-any.whl → 1.25.3__py3-none-any.whl
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.
- playwrightcapture/capture.py +6 -7
- {playwrightcapture-1.25.1.dist-info → playwrightcapture-1.25.3.dist-info}/METADATA +2 -2
- {playwrightcapture-1.25.1.dist-info → playwrightcapture-1.25.3.dist-info}/RECORD +5 -5
- {playwrightcapture-1.25.1.dist-info → playwrightcapture-1.25.3.dist-info}/LICENSE +0 -0
- {playwrightcapture-1.25.1.dist-info → playwrightcapture-1.25.3.dist-info}/WHEEL +0 -0
playwrightcapture/capture.py
CHANGED
@@ -32,7 +32,7 @@ from playwright._impl._errors import TargetClosedError
|
|
32
32
|
from playwright.async_api import async_playwright, Frame, Error, Page, Download, Request
|
33
33
|
from playwright.async_api import TimeoutError as PlaywrightTimeoutError
|
34
34
|
from playwright_stealth import stealth_async, StealthConfig # type: ignore[import-untyped]
|
35
|
-
from puremagic import PureError, from_string
|
35
|
+
from puremagic import PureError, from_string
|
36
36
|
from w3lib.html import strip_html5_whitespace
|
37
37
|
from w3lib.url import canonicalize_url, safe_url_string
|
38
38
|
|
@@ -683,6 +683,7 @@ class Capture():
|
|
683
683
|
try:
|
684
684
|
page = await self.context.new_page()
|
685
685
|
await page.clock.install()
|
686
|
+
page.on("dialog", lambda dialog: dialog.accept())
|
686
687
|
except Error as e:
|
687
688
|
self.logger.warning(f'The context is in a broken state: {e}')
|
688
689
|
self.should_retry = True
|
@@ -805,12 +806,6 @@ class Capture():
|
|
805
806
|
except Exception as e:
|
806
807
|
self.logger.warning(f'Could not find body: {e}')
|
807
808
|
|
808
|
-
# fast forward 30s
|
809
|
-
await page.clock.run_for(10000)
|
810
|
-
await page.clock.resume()
|
811
|
-
await self._wait_for_random_timeout(page, 5) # Wait 5 sec
|
812
|
-
self.logger.warning('Moved time forward.')
|
813
|
-
|
814
809
|
if parsed_url.fragment:
|
815
810
|
# We got a fragment, make sure we go to it and scroll only a little bit.
|
816
811
|
fragment = unquote(parsed_url.fragment)
|
@@ -870,6 +865,10 @@ class Capture():
|
|
870
865
|
z.writestr(f'{i}_{filename}', file_content)
|
871
866
|
to_return["downloaded_file"] = mem_zip.getvalue()
|
872
867
|
|
868
|
+
# fast forward 30s
|
869
|
+
await page.clock.run_for("30")
|
870
|
+
self.logger.debug('Moved time forward.')
|
871
|
+
|
873
872
|
self.logger.debug('Done with instrumentation, waiting for network idle.')
|
874
873
|
await self._wait_for_random_timeout(page, 5) # Wait 5 sec after instrumentation
|
875
874
|
await self._safe_wait(page)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: PlaywrightCapture
|
3
|
-
Version: 1.25.
|
3
|
+
Version: 1.25.3
|
4
4
|
Summary: A simple library to capture websites using playwright
|
5
5
|
Home-page: https://github.com/Lookyloo/PlaywrightCapture
|
6
6
|
License: BSD-3-Clause
|
@@ -28,7 +28,7 @@ Requires-Dist: beautifulsoup4[charset-normalizer,lxml] (>=4.12.3,<5.0.0)
|
|
28
28
|
Requires-Dist: dateparser (>=1.2.0,<2.0.0)
|
29
29
|
Requires-Dist: playwright (>=1.45.0,<2.0.0)
|
30
30
|
Requires-Dist: playwright-stealth (>=1.0.6,<2.0.0)
|
31
|
-
Requires-Dist: puremagic (>=1.
|
31
|
+
Requires-Dist: puremagic (>=1.26,<2.0)
|
32
32
|
Requires-Dist: pydub (>=0.25.1,<0.26.0) ; extra == "recaptcha"
|
33
33
|
Requires-Dist: pytz (>=2024.1,<2025.0) ; python_version < "3.9"
|
34
34
|
Requires-Dist: setuptools (>=70.3.0,<71.0.0)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
playwrightcapture/__init__.py,sha256=F90Y8wYS13tDjgsfjuFrCfmzQfdnH44G-ovuilJfLEE,511
|
2
|
-
playwrightcapture/capture.py,sha256=
|
2
|
+
playwrightcapture/capture.py,sha256=6OzlAFUE7fzywSfd5E6d_BvKMN0gi7vNNXsp0SBbyak,69419
|
3
3
|
playwrightcapture/exceptions.py,sha256=LhGJQCGHzEu7Sx2Dfl28OFeDg1OmrwufFjAWXlxQnEA,366
|
4
4
|
playwrightcapture/helpers.py,sha256=SXQLEuxMs8-bcWykMiUVosHzzxBKuS-QC0gBV3OmKmo,1764
|
5
5
|
playwrightcapture/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
playwrightcapture-1.25.
|
7
|
-
playwrightcapture-1.25.
|
8
|
-
playwrightcapture-1.25.
|
9
|
-
playwrightcapture-1.25.
|
6
|
+
playwrightcapture-1.25.3.dist-info/LICENSE,sha256=uwFc39fTLacBUG-XTuxX6IQKTKhg4z14gWOLt3ex4Ho,1775
|
7
|
+
playwrightcapture-1.25.3.dist-info/METADATA,sha256=LjyYrFwB8WzSAldFOmKeSuci_wdI8DDd45jHn8B-MyY,3173
|
8
|
+
playwrightcapture-1.25.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
9
|
+
playwrightcapture-1.25.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|