MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _guess_impersonate_from_user_agent

Function _guess_impersonate_from_user_agent

src/api/admin.py:221–237  ·  view source on GitHub ↗

从 UA 选择可用的 curl_cffi 浏览器指纹版本。

(user_agent: str)

Source from the content-addressed store, hash-verified

219
220
221def _guess_impersonate_from_user_agent(user_agent: str) -> str:
222 """从 UA 选择可用的 curl_cffi 浏览器指纹版本。"""
223 ua = (user_agent or "").strip()
224 major_match = re.search(r"(?:Chrome|Chromium|Edg|EdgA|EdgiOS)/(\d+)", ua)
225 if not major_match:
226 return "chrome120"
227
228 try:
229 major = int(major_match.group(1))
230 except Exception:
231 return "chrome120"
232
233 if major >= 124:
234 return "chrome124"
235 if major >= 120:
236 return "chrome120"
237 return "chrome120"
238
239
240def _build_proxy_map(proxy_url: str) -> Optional[Dict[str, str]]:

Callers 1

test_captcha_scoreFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_captcha_scoreFunction · 0.68