phantomfetch 0.4.2__tar.gz → 0.4.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.3
2
2
  Name: phantomfetch
3
- Version: 0.4.2
3
+ Version: 0.4.4
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
@@ -17,7 +17,7 @@ Classifier: Framework :: AsyncIO
17
17
  Requires-Dist: browserforge[all]>=0.5.0
18
18
  Requires-Dist: curl-cffi>=0.13.0
19
19
  Requires-Dist: msgspec>=0.20.0
20
- Requires-Dist: rebrowser-playwright>=1.52.0
20
+ Requires-Dist: playwright>=1.50.0
21
21
  Requires-Dist: undetected-playwright>=0.3.0
22
22
  Requires-Dist: rusticsoup>=0.3.0
23
23
  Requires-Dist: httpx>=0.27.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phantomfetch"
3
- version = "0.4.2"
3
+ version = "0.4.4"
4
4
  description = "High-performance agentic web scraping library combining curl-cffi speed with Playwright browser capabilities"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -32,7 +32,7 @@ dependencies = [
32
32
  "browserforge[all]>=0.5.0",
33
33
  "curl-cffi>=0.13.0",
34
34
  "msgspec>=0.20.0",
35
- "rebrowser-playwright>=1.52.0",
35
+ "playwright>=1.50.0",
36
36
  "undetected-playwright>=0.3.0",
37
37
  "rusticsoup>=0.3.0",
38
38
  "httpx>=0.27.0",
@@ -1,5 +1,7 @@
1
1
  import time
2
2
  from typing import TYPE_CHECKING, Any, Optional
3
+ import sys
4
+ from urllib.parse import urlparse
3
5
 
4
6
  from browserforge.fingerprints import FingerprintGenerator, Screen
5
7
  from browserforge.injectors.playwright import AsyncNewContext
@@ -126,10 +128,7 @@ class CDPEngine:
126
128
  async def connect(self) -> None:
127
129
  """Initialize Playwright and connect to browser."""
128
130
 
129
- if self.browser_type == "chromium":
130
- from rebrowser_playwright.async_api import async_playwright
131
- else:
132
- from playwright.async_api import async_playwright
131
+ from playwright.async_api import async_playwright
133
132
 
134
133
  self._playwright = await async_playwright().start()
135
134
 
@@ -348,12 +347,15 @@ class CDPEngine:
348
347
  context_opts["viewport"] = self.viewport
349
348
 
350
349
  if proxy:
351
- context_opts["proxy"] = {
352
- "server": proxy.url,
353
- # TODO: Auth if in URL? Playwright parses user:pass from server URL usually
354
- # but sometimes explicit username/password needed.
355
- # For now assuming proxy.url has it.
356
- }
350
+ parsed = urlparse(proxy.url)
351
+ proxy_server = f"{parsed.scheme}://{parsed.hostname}:{parsed.port}" if parsed.port else f"{parsed.scheme}://{parsed.hostname}"
352
+ proxy_dict = {"server": proxy_server}
353
+ if parsed.username:
354
+ proxy_dict["username"] = parsed.username
355
+ if parsed.password:
356
+ proxy_dict["password"] = parsed.password
357
+
358
+ context_opts["proxy"] = proxy_dict
357
359
 
358
360
  # If we have basic cookies to set via context creation (simpler than add_cookies sometimes)
359
361
  # But better to use add_cookies for consistency with 'cookies' arg
File without changes