mirror of
https://github.com/zhao-zg/jd-login.git
synced 2026-01-20 02:19:37 +08:00
Compare commits
No commits in common. "34952a36e43ce47ac2c3cd23edadc6d6e79b29e5" and "51cd92c7ad36ce5d9e37b8f601795f65e8b17054" have entirely different histories.
34952a36e4
...
51cd92c7ad
52
login.py
52
login.py
@ -612,11 +612,9 @@ async def sendSMSDirectly(page):
|
|||||||
while True:
|
while True:
|
||||||
if await page.xpath('//*[@id="small_img"]'):
|
if await page.xpath('//*[@id="small_img"]'):
|
||||||
await verification(page)
|
await verification(page)
|
||||||
|
elif await page.xpath('//*[@id="captcha_modal"]/div/div[4]/button'):
|
||||||
elif await page.xpath('//*[@id="captcha_modal"]/div/div[3]/button'):
|
|
||||||
if await verification_shape(page) == "notSupport":
|
if await verification_shape(page) == "notSupport":
|
||||||
return "notSupport"
|
return "notSupport"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -654,11 +652,9 @@ async def sendSMS(page):
|
|||||||
while True:
|
while True:
|
||||||
if await page.xpath('//*[@id="small_img"]'):
|
if await page.xpath('//*[@id="small_img"]'):
|
||||||
await verification(page)
|
await verification(page)
|
||||||
|
elif await page.xpath('//*[@id="captcha_modal"]/div/div[4]/button'):
|
||||||
elif await page.xpath('//*[@id="captcha_modal"]/div/div[3]/button'):
|
|
||||||
if await verification_shape(page) == "notSupport":
|
if await verification_shape(page) == "notSupport":
|
||||||
return "notSupport"
|
return "notSupport"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -802,38 +798,18 @@ async def verification(page):
|
|||||||
distance = await get_distance()
|
distance = await get_distance()
|
||||||
await page.mouse.move(box["x"] + 10, box["y"] + 10)
|
await page.mouse.move(box["x"] + 10, box["y"] + 10)
|
||||||
await page.mouse.down()
|
await page.mouse.down()
|
||||||
steps=50
|
await page.mouse.move(
|
||||||
start_x = box["x"] # 直接使用box的x作为起点
|
box["x"] + distance + random.uniform(3, 15), box["y"], {"steps": 10}
|
||||||
start_y = box["y"] # Y轴固定不变
|
)
|
||||||
end_x = start_x + distance
|
await page.waitFor(
|
||||||
|
random.randint(100, 500)
|
||||||
for i in range(steps):
|
)
|
||||||
t = i / steps
|
await page.mouse.move(
|
||||||
|
box["x"] + distance, box["y"], {"steps": 10}
|
||||||
# ==== 三阶贝塞尔曲线控制 ====
|
)
|
||||||
if t < 0.7:
|
await page.waitFor(
|
||||||
# 加速阶段:贝塞尔控制点偏向终点
|
random.randint(400, 1000)
|
||||||
phase_ratio = t / 0.7
|
)
|
||||||
x_ratio = 3 * (phase_ratio**2) - 2 * (phase_ratio**3) # 三阶缓动
|
|
||||||
current_x = start_x + distance * 0.8 * x_ratio
|
|
||||||
noise = random.uniform(-2, 2) # 允许较大初始抖动
|
|
||||||
else:
|
|
||||||
# 减速阶段:精准收敛至终点
|
|
||||||
phase_ratio = (t - 0.7) / 0.3
|
|
||||||
x_ratio = 0.8 + 0.2 * (1 - (1 - phase_ratio)**3) # 三阶缓入
|
|
||||||
current_x = start_x + distance * x_ratio
|
|
||||||
noise = random.uniform(-1, 1) * (1 - t) # 扰动衰减至0
|
|
||||||
|
|
||||||
# 应用噪声(距离越大抖动幅度越大)
|
|
||||||
current_x += noise
|
|
||||||
|
|
||||||
# 移动鼠标(Y轴始终不变)
|
|
||||||
await page.mouse.move(current_x, start_y, steps=2)
|
|
||||||
|
|
||||||
# 双重校准终点(应对任何残余误差)
|
|
||||||
await page.mouse.move(end_x, start_y, steps=2)
|
|
||||||
await page.waitFor(random.randint(100,300))
|
|
||||||
|
|
||||||
await page.mouse.up()
|
await page.mouse.up()
|
||||||
logger.info("过滑块结束")
|
logger.info("过滑块结束")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user