phantomfetch 0.5.9__tar.gz → 0.5.10__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.
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/PKG-INFO +1 -1
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/pyproject.toml +1 -1
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/browser/cdp.py +19 -6
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/fetch.py +7 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/README.md +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/__init__.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/cache.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/captcha.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/__init__.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/base.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/browser/__init__.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/browser/actions.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/engines/curl.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/pool.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/presets.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/registry.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/strategy_advisor.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/telemetry.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/tools/selector_builder.py +0 -0
- {phantomfetch-0.5.9 → phantomfetch-0.5.10}/src/phantomfetch/types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: phantomfetch
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.10
|
|
4
4
|
Summary: High-performance agentic web scraping library combining curl-cffi speed with Playwright browser capabilities
|
|
5
5
|
Keywords: web-scraping,playwright,curl-cffi,async,browser-automation,http-client,agentic,anti-detection
|
|
6
6
|
Author: CosmicBull
|
|
@@ -217,6 +217,7 @@ class CDPEngine:
|
|
|
217
217
|
self._browser: Any = None
|
|
218
218
|
self._existing_context: Any = None
|
|
219
219
|
self._existing_page: Any = None
|
|
220
|
+
self._connect_lock = asyncio.Lock()
|
|
220
221
|
|
|
221
222
|
async def connect(self) -> None:
|
|
222
223
|
"""Initialize Playwright and connect to browser with retry."""
|
|
@@ -442,6 +443,17 @@ class CDPEngine:
|
|
|
442
443
|
self._camoufox_context = None
|
|
443
444
|
self._camoufox_proxy_key = None
|
|
444
445
|
|
|
446
|
+
async def start(self) -> None:
|
|
447
|
+
"""Start the browser engine."""
|
|
448
|
+
async with self._connect_lock:
|
|
449
|
+
await self.connect()
|
|
450
|
+
|
|
451
|
+
async def restart(self) -> None:
|
|
452
|
+
"""Restart the browser engine."""
|
|
453
|
+
async with self._connect_lock:
|
|
454
|
+
await self.disconnect()
|
|
455
|
+
await self.connect()
|
|
456
|
+
|
|
445
457
|
async def _handle_route(self, route: "Route") -> None:
|
|
446
458
|
"""Handle network requests for caching."""
|
|
447
459
|
if not self.cache:
|
|
@@ -601,12 +613,13 @@ class CDPEngine:
|
|
|
601
613
|
|
|
602
614
|
# Ensure browser is running.
|
|
603
615
|
# CloakBrowser persistent mode uses _cloak_context (not _browser).
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
616
|
+
async with self._connect_lock:
|
|
617
|
+
needs_connect = not self._browser and not (
|
|
618
|
+
(self._cloak_browser_available and self.persistent_context_dir)
|
|
619
|
+
or (self._camoufox_available and self.persistent_context_dir)
|
|
620
|
+
)
|
|
621
|
+
if needs_connect:
|
|
622
|
+
await self.connect()
|
|
610
623
|
|
|
611
624
|
# Create context
|
|
612
625
|
# We create a fresh context for each request to ensure isolation
|
|
@@ -203,6 +203,13 @@ class Fetcher:
|
|
|
203
203
|
if self._browser:
|
|
204
204
|
await self._browser.disconnect()
|
|
205
205
|
|
|
206
|
+
async def restart_browser(self) -> None:
|
|
207
|
+
"""
|
|
208
|
+
Restart the browser engine.
|
|
209
|
+
"""
|
|
210
|
+
if self._browser and hasattr(self._browser, "restart"):
|
|
211
|
+
await self._browser.restart()
|
|
212
|
+
|
|
206
213
|
def save_session(self, path: str) -> None:
|
|
207
214
|
"""
|
|
208
215
|
Save the current session storage (cookies, localStorage) to a file.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|