关注公众号:逸佳笔记,回复关键词“副业”,免费获取各平台引流教程合集以及10个小项目教程
或者下面这个网盘链接也可以免费获取各平台引流教程和小项目教程:
链接:https://pan.baidu.com/s/101HhdI6oA5apANTIfiW4_Q?pwd=6666 提取码:6666
或者复制下方链接到浏览器打开可以获取全网最新项目,实时更新中!
https://zy.66yyba.com/?ref=1385





实验前的准备

自动获取手机文字
1、利用ADB控制手机:
os.system("adb shell /system/bin/screencap -p /sdcard/screen.png") #截取屏幕,图片命名为screen.png
os.system("adb pull /sdcard/screen.png C:/Users/jia/Desktop") #将截图保存到电脑在桌面
os.system("adb shell input tap {}{}".format(x,y))#x ,y为点击处的像素点
#adb手机截图
def get_image():
os.system('adb shell screencap -p /sdcard/image.png')
os.system('adb pull /sdcard/image.png .')
xigua_size = (150,530,1800,800)
2、对图片文字识别:
tesseract imagename outbase [-l lang] [-psm N] [configfile...]
#读取图像
get_image()
img=Image.open('image.png')
img_que = img.crop(xigua_size)
#识别截图文字
question=pytesseract.image_to_string(img_que,lang='chi_sim')
question=question.replace(' ','').replace('n','')
que = question[question.find('.')+1: question.find('?')]

自动搜题的实现
1、浏览器操作:
-
webbrowser 有以下方法:
webbrowser.open(url[, new=0[, autoraise=1]])
webbrowser.open_new(url)
webbrowser.open_new_tab(url)
webbrowser.get([name])
webbrowser.register(name, construtor[, instance])
#引擎搜索
url = "https://www.baidu.com/s?wd=" +que
webbrowser.open(url)
get_image()
img=Image.open('image.png')
img_que = img.crop(xigua_size)
question1= pytesseract.image_to_string(img_que,)
question1=question1.replace(' ','').replace('n','')
que = question1[question.find('.')+1: question.find('?')]
while True:
while(question1==question):
get_image()
img = Image.open('image.png')
img_que = img.crop(xigua_size)
question1 = pytesseract.image_to_string(img_que,)
question1 = question1.replace(' ', '').replace('n', '')
que = question1[question.find('.') + 1: question.find('?')]
get_image()
img = Image.open('image.png')
img_que = img.crop(xigua_size)
# 识别截图文字
question = pytesseract.image_to_string(img_que,)
question = question.replace(' ', '').replace('n', '')
que = question[question.find('.') + 1: question.find('?')]
continue
while(question1!=question):
get_image()
img = Image.open('image.png')
img_que = img.crop(xigua_size)
# 识别截图文字
question = pytesseract.image_to_string(img_que,)
question1 = pytesseract.image_to_string(img_que,)
question1 = question1.replace(' ', '').replace('n', '')
que = question1[question.find('.') + 1: question.find('?')]
question = question.replace(' ', '').replace('n', '')
que = question[question.find('.') + 1: question.find('?')]
# 引擎搜索
url = "https://www.baidu.com/s?wd=" + que
webbrowser.open(url)
continue

作者介绍:
李秋键,CSDN 博客专家,CSDN达人课作者。硕士在读于中国矿业大学,开发有taptap安卓武侠游戏一部,vip视频解析,文意转换工具,写作机器人等项目,发表论文若干,多次高数竞赛获奖等等。



原文始发于微信公众号(AI科技大本营):
本文转载自以上首发公众号,如有侵权,联系站长删除
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧






