@jayyuen66/dsh-scrapling 0.1.7 → 0.1.8

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.
package/py/adapters.py CHANGED
@@ -759,7 +759,6 @@ SESSION_ONLY_KEYS = frozenset(
759
759
  "block_ads",
760
760
  "block_webrtc",
761
761
  "blocked_domains",
762
- "cdp_url",
763
762
  "cookies",
764
763
  "disable_resources",
765
764
  "dns_over_https",
@@ -787,9 +786,14 @@ SESSION_ONLY_KEYS = frozenset(
787
786
  # 部署命名空间里的浏览器旋钮:源键 → 引擎参数名 → 期望类型。类型逐项写死,是因为这一层
788
787
  # 与模型入参走同一条通道而它承载的是**部署表态**:类型错了静默生效比报错更糟(例如
789
788
  # maxRecordedRequests 收到字符串,上游会拿它当容量直接炸会话构造)。
789
+ #
790
+ # 这里没有 CDP 端点那一枚:Scrapling 0.5.1 把 `cdp_url` 收归 RemoteSession,递给
791
+ # StealthSession 会 `TypeError`(`engines/_browsers/_validators.py` 的
792
+ # 「cdp_url and new_context require RemoteSession」那条),而本包没有远端会话模式。
793
+ # 递过去在 0.5 上能用、在 0.5.1 上炸会话构造,等于让同一条文档范围 `>=0.5,<0.6` 里
794
+ # 的两个版本行为分叉,所以这个旋钮整体撤掉。
790
795
  _DEPLOYMENT_KNOBS: tuple[tuple[str, str, type], ...] = (
791
796
  ("browserExecutablePath", "executable_path", str),
792
- ("browserCdpUrl", "cdp_url", str),
793
797
  ("browserInitScript", "init_script", str),
794
798
  ("browserRealChrome", "real_chrome", bool),
795
799
  ("browserDnsOverHttps", "dns_over_https", bool),
@@ -921,7 +925,7 @@ def _session_browser_params(args: dict[str, Any]) -> dict[str, Any]:
921
925
  """会话构造期的浏览器参数:只收**只有开场才生效**的那些键。
922
926
 
923
927
  会话内每次 fetch 传 ``block_ads`` / ``record_requests`` / ``executable_path`` /
924
- ``cdp_url`` / ``locale`` / ``timezone_id`` / ``useragent`` / ``headless`` 都会被
928
+ ``locale`` / ``timezone_id`` / ``useragent`` / ``headless`` 都会被
925
929
  ``validate_fetch`` 丢掉,于是设置卡上这些旋钮对会话路径完全不生效 —— 而且不报错。
926
930
  这里把它们挪到唯一生效的位置。
927
931
 
@@ -1587,7 +1591,7 @@ def _make_session(kind: str, args: dict[str, Any]) -> Any:
1587
1591
  from scrapling.fetchers import StealthySession
1588
1592
 
1589
1593
  # 只有开场才生效的那些设置(block_ads / record_requests / headless / locale /
1590
- # timezone_id / useragent / executable_path / cdp_url / timeout)必须在这里进会话:
1594
+ # timezone_id / useragent / executable_path / timeout)必须在这里进会话:
1591
1595
  # fetch 层传过去会被 validate_fetch 静默丢掉(见 FETCH_LEVEL_KEYS)。
1592
1596
  common: dict[str, Any] = _session_browser_params(args)
1593
1597
  # 每会话的记录开关:模型可以为这一次会话打开记录(部署侧那枚是默认值)。记录不改变
@@ -1804,7 +1808,7 @@ def session_fetch(args: dict[str, Any]) -> dict[str, Any]:
1804
1808
  #
1805
1809
  # level="fetch" 是这条路径的关键:会话内每次 fetch 只认 FETCH_LEVEL_KEYS,
1806
1810
  # 其余键(block_ads / record_requests / headless / locale / timezone_id /
1807
- # useragent / executable_path / cdp_url,以及 hide_canvas / block_webrtc /
1811
+ # useragent / executable_path,以及 hide_canvas / block_webrtc /
1808
1812
  # allow_webgl)会被 validate_fetch **静默丢掉**。那些设置已经在 session.open
1809
1813
  # 时经 _session_browser_params 进过会话了,这里再发一遍只会制造「拧了没反应」
1810
1814
  # 的假象。