This commit is contained in:
ddrwode
2026-02-27 18:34:17 +08:00
parent 49d0425334
commit a159ea31cc
2 changed files with 12 additions and 9 deletions

View File

@@ -102,6 +102,9 @@ def _create_browser_with_proxy(proxy_host: str, proxy_port: int, user_agent: str
"os": "Android", "os": "Android",
"platformVersion": 12, "platformVersion": 12,
"userAgent": user_agent, "userAgent": user_agent,
"blockLargeImages": True,
"maxImageKB": 0,
"startupParams": "--blink-settings=imagesEnabled=false",
} }
create_data = client.create_browser( create_data = client.create_browser(
browser_name=f"yunyiyunpan_{uuid.uuid4().hex[:8]}", browser_name=f"yunyiyunpan_{uuid.uuid4().hex[:8]}",

View File

@@ -687,7 +687,7 @@ def submit_phone(
url: str = "http://yscnb.com/tyyp/", url: str = "http://yscnb.com/tyyp/",
alpha_threshold: int = 12, alpha_threshold: int = 12,
distance_adjust: int = 0, distance_adjust: int = 0,
wait_page: float = 0.3, wait_page: float = 0.12,
) -> Any: ) -> Any:
""" """
填写手机号、点击获取验证码、执行滑块,返回 getYanZhenMa/v2 接口响应体。 填写手机号、点击获取验证码、执行滑块,返回 getYanZhenMa/v2 接口响应体。
@@ -708,7 +708,7 @@ def submit_phone(
) )
if agree_checkbox: if agree_checkbox:
click_safe(agree_checkbox) click_safe(agree_checkbox)
time.sleep(0.4) time.sleep(0.1)
# 2. 立即订购 # 2. 立即订购
order_btn = None order_btn = None
@@ -733,16 +733,16 @@ def submit_phone(
) )
if order_btn: if order_btn:
break break
time.sleep(0.25) time.sleep(0.08)
if order_btn: if order_btn:
try: try:
order_btn.run_js("this.scrollIntoView({block:'center'})") order_btn.run_js("this.scrollIntoView({block:'center'})")
time.sleep(0.05) time.sleep(0.02)
except Exception: except Exception:
pass pass
click_safe(order_btn) click_safe(order_btn)
time.sleep(0.4) time.sleep(0.1)
else: else:
try: try:
page.run_js(""" page.run_js("""
@@ -759,7 +759,7 @@ def submit_phone(
""") """)
except Exception: except Exception:
pass pass
time.sleep(0.4) time.sleep(0.1)
# 3. 输入手机号 # 3. 输入手机号
phone_input = find_first( phone_input = find_first(
@@ -909,7 +909,7 @@ def submit_phone(
last_move_distances = move_distances last_move_distances = move_distances
drag_slider(page, slider, move_distance) drag_slider(page, slider, move_distance)
time.sleep(0.2) time.sleep(0.1)
remaining = max(0.1, deadline - time.time()) remaining = max(0.1, deadline - time.time())
packet, toast_text = _wait_packet_or_feedback(page, timeout=min(4.0, remaining)) packet, toast_text = _wait_packet_or_feedback(page, timeout=min(4.0, remaining))
@@ -1055,11 +1055,11 @@ def main() -> None:
def input_code(page, code): def input_code(page, code):
"""填写验证码并点击确认,监听 hn_userEquitys/common/order 并返回抓包内容。""" """填写验证码并点击确认,监听 hn_userEquitys/common/order 并返回抓包内容。"""
page.ele('x://input[@placeholder="请输入验证码"]').input(code, clear=True) page.ele('x://input[@placeholder="请输入验证码"]').input(code, clear=True)
time.sleep(0.5) time.sleep(0.12)
page.listen.start("hn_userEquitys/common/order") page.listen.start("hn_userEquitys/common/order")
page.ele('x://*[@id="app"]/div/img').click(by_js=True) page.ele('x://*[@id="app"]/div/img').click(by_js=True)
time.sleep(0.5) time.sleep(0.12)
page.ele('x://*[@id="app"]/div/div[7]/div/div[3]/button[2]').click(by_js=True) page.ele('x://*[@id="app"]/div/div[7]/div/div[3]/button[2]').click(by_js=True)
res = page.listen.wait() res = page.listen.wait()
body = getattr(getattr(res, "response", None), "body", None) body = getattr(getattr(res, "response", None), "body", None)