Context-Aware Routing
Context-Aware Routing
Section titled “Context-Aware Routing”Context-Aware Routing 会为你的目标 URL 自动选择最佳 IP 类型 —— residential、datacenter 或 dedicated —— 无需手动配置。
| 类型 | 最适合 | 速度 | 成本 |
|---|---|---|---|
| Residential | 电商、社交媒体、反爬站点 | 中等 | $$$ |
| Datacenter | API、无防护站点、批量请求 | 快 | $ |
| Dedicated | 账户管理、长会话 | 中等 | $$ |
当你请求代理时,HydraSkill 会分析目标:
# HydraSkill 自动为 Amazon 选择 residentialproxy = client.get_proxy(target="amazon.com")print(proxy.type) # "residential"
# 为公开 API 选择 datacenterproxy = client.get_proxy(target="api.github.com")print(proxy.type) # "datacenter"路由引擎会考虑:
- 目标域名信誉 —— 已知的反爬系统会分配 residential IP
- 历史封锁率 —— 频繁封锁的域名会分配高级 IP
- 请求模式 —— 高频请求分配 datacenter,基于会话的分配 residential
- 地理需求 —— 某些地区的 residential 覆盖更好
你随时可以手动指定 IP 类型:
# 即使是 API 也强制使用 residentialproxy = client.get_proxy( target="api.example.com", ip_type="residential")
# 为追求速度强制使用 datacenterproxy = client.get_proxy( target="amazon.com", ip_type="datacenter" # 更便宜,但封锁风险更高)路由规则(Enterprise)
Section titled “路由规则(Enterprise)”Enterprise 套餐可以定义自定义路由规则:
routing_rules: - match: "*.amazon.*" ip_type: residential country: auto # 匹配目标所在地区 - match: "api.*" ip_type: datacenter - match: "*.google.com" ip_type: residential rotate_every: 10 # 每 10 个请求换一个新 IPContext-Aware Routing 默认就能省钱 —— 只在需要时才使用昂贵的 residential IP。对于没有反爬防护的目标,它会自动通过更便宜的 datacenter IP 路由。
典型节省:相比始终使用 residential 可节省 30-50%。