mirror of
https://github.com/zhao-zg/jd-login.git
synced 2026-01-12 05:10:42 +08:00
Update login.py
修复滑块
This commit is contained in:
parent
51cd92c7ad
commit
63329ba727
27
login.py
27
login.py
@ -612,9 +612,11 @@ 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
|
||||||
|
|
||||||
@ -652,9 +654,11 @@ 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
|
||||||
|
|
||||||
@ -798,17 +802,16 @@ 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()
|
||||||
await page.mouse.move(
|
steps=50
|
||||||
box["x"] + distance + random.uniform(3, 15), box["y"], {"steps": 10}
|
for i in range(steps):
|
||||||
)
|
t=i/steps
|
||||||
|
if t<0.7:
|
||||||
|
x_step=distance*(t**1.2)+random.uniform(-2, 2)
|
||||||
|
else:
|
||||||
|
x_step=distance*(0.7+(t-0.7))+random.uniform(-1, 1)
|
||||||
|
await page.mouse.move(box["x"]+x_step,box["y"],{"steps": 2})
|
||||||
await page.waitFor(
|
await page.waitFor(
|
||||||
random.randint(100, 500)
|
random.randint(100, 300)
|
||||||
)
|
|
||||||
await page.mouse.move(
|
|
||||||
box["x"] + distance, box["y"], {"steps": 10}
|
|
||||||
)
|
|
||||||
await page.waitFor(
|
|
||||||
random.randint(400, 1000)
|
|
||||||
)
|
)
|
||||||
await page.mouse.up()
|
await page.mouse.up()
|
||||||
logger.info("过滑块结束")
|
logger.info("过滑块结束")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user