微信读书自动翻页
思路:利用adb工具实现微信阅读自动翻页
1、所需工具:python3.7、adb工具包、安卓模拟器(mumu,夜神等都可);
2、前期准备:
2.1、将以上工具均进行安装或解压工作;
2.2、mumu模拟器安装微信阅读app;
3、代码:
'''
# encoding:utf-8
from subprocessimport run
import time
import random
import os
def book(rv_sel, rv_page_num, rv_t1, rv_t2):
rv_sel= int(rv_sel)
if rv_sel== 1:
print('程序运行中')
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 1000 600 200 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
exit()
elif rv_sel== 2:
print('程序运行中')
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 200 600 1000 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
exit()
else:
print()
print('* ' * 8, '1.正循环-倒循环,无限循环', '* ' * 8)
print('* ' * 8, '2.倒循环-正循环,无限循环', '* ' * 8)
print()
loop= int(input('请选择循环方式:'))
print('程序运行中')
if loop== 1:
while 1:
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 1000 600 200 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 200 600 1000 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
else:
while 1:
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 200 600 1000 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
for iin range(rv_page_num):
time.sleep(random.uniform(rv_t1,rv_t2))
run('adb shell input swipe 1000 600 200 600', shell=True)
n= i+ 1
print('总计需翻阅 %d 页,已翻阅 %d 页,剩余 %d 页' % (rv_page_num, n, rv_page_num- n))
def rand_time(rv_xh):
if int(rv_xh) == 1:
return 10,20
else:
while 1:
t1= int(input('请输入最小等待时间:'))
t2= int(input('请输入最大等待时间:'))
if t2>= t1:
return t1,t2
break
else:
print('最小时间不得小于最大时间,请重新输入')
print('* ' * 50,)
print('告知:')
print('信阅读暂未公布有效翻阅取时规则,如自动翻页未获得有效阅读时间,请及时增加翻阅时间间隔')
print('请选择间隔时间方式:')
print('1.系统推荐:10—20秒')
print('2.自主输入:0—+∞',)
print('* ' * 50,)
while 1:
xh= input('请输入序号:')
if xh== '':
print('输入有误,请重新输入')
elif xhin str([1,2]):
t1,t2= rand_time(xh)
break
else:
print('输入有误,请重新输入')
run('cd e:\tool\adb', shell=True)
run('adb connect 127.0.0.1:7555', shell=True)
while 1:
print()
print('* ' * 8, '1.正翻', '* ' * 8)
print('* ' * 8, '2.倒翻', '* ' * 8)
print('* ' * 8, '3.连环', '* ' * 8)
print()
sel= input('请选择翻书方式:')
if selin str([1,2,3]):
page_num= int(input('请输入书籍总页数:'))
book(sel,page_num,t1,t2)
elif sel== '':
print('输入错误')
else:
print('输入错误')
'''