Python模拟手机滑动浏览淘宝页面!

淘金币里有做任务可以提高第二天领取金币比例的任务,里面大多任务是要求浏览指定页面10秒以上,所以我写了这个函数,模拟浏览手机页面10秒以上,滑动n次,总浏览时间10秒以上。

# _*_ encoding:utf-8 _*_
import os
import time
import random


def swip(times):
    shell = "adb shell input swipe 536 1519 543 1079 200"
    total_time = 0
    for i in range(0,times):
        os.system(shell)
        delay = 5 * random.random()
        time.sleep(delay)
        total_time += delay

    if total_time<10:
        time.sleep(10 - total_time)


swip(3)
1234567891011121314151617181920

不足之处:每次滑动的起始位置和终止位置是一样的,不知道淘宝有没有监控措施,如果有的话,会发现这种异常。以后有机会可以把滑动的起始位置和滑动时间改成随机数。

猜你喜欢

转载自blog.csdn.net/weixin_43881394/article/details/109030803