Git Product home page Git Product logo

weread-dailyquestion-helper's Introduction

微信读书每日一答辅助

功能描述

简单的说就是每隔一段时间截张图,去百度搜答案。

配置环境

  • Python 3.10.4
  • 微信Macos版
  • 百度AI平台

原理

  1. 截图

  2. OCR识别问题和答案

  3. 根据问题去百度搜答案

    选择答案的依据是,以问题作为关键字进行搜索,在搜索结果的首页中,选择出现频率最高的答案作为候选结果,并把它的上下文作为依据。

  4. 自动寻找答案位置并作答

  5. 循环执行1,2,3,4

使用方法

因为Macos没办法获取到小程序的窗口,所以需要手动测量小程序窗口大小,调整题目和答案位置。
文件位置:process/ScreenCapture.py 截图效果会输出在output/images目录下,可参考校对位置

  1. 登陆百度AI开放平台,创建一个通用场景OCR应用(每天免费1w次够用了),并在应用列表中查看AppID,API Key和Secret Key
  2. 打开百度网站登录,复制出cookie
  3. 在根目录下仿照configdemo.json创建一个config.json文件,把上面得到的值填进去
  4. 电脑打开微信读书小程序,并保持在最前,且不要被遮挡
  5. 运行根目录下的main.py
  6. 进入每日一答页面开始答题,隔一段时间控制台就会输出结果:

1.png

2.png

3.png

4.png

5.png

6.png


仅供学习参考,这玩意正确率目测80-90%,也不是标准答案,不能保证完全正确。 目前的最大的瓶颈还是在于速度,速度不够快即使答对了,也不能保证赢。暂时也没有想到好的方案解决

自动化答题总时间 = 截图时间 + OCR时间 + 搜索引擎查询时间 + 自动化答题时间

致谢

@maotoumao

weread-dailyquestion-helper's People

Contributors

lllyin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

weread-dailyquestion-helper's Issues

有一个问题

问题: 南宋著名的爱国
正确答案: 辛弃疾
概率: 范仲淹 :14.3% 辛弃疾 :85.7%
依据: 国诗人南宋爱国诗词-文学词典-可可诗词网2019年5月14日此外,南宋爱国诗人还有辛弃疾(已于豪放词派介绍)、陈亮、刘辰翁、谢枋得、谢翱等,这里不再一一赘述。www.kekeshic
Traceback (most recent call last):
File "D:/Program Files (x86)/weread-dailyquestion-helper-main/main.py", line 71, in
cc.run(appImg, answ, rightAnswer)
File "D:\Program Files (x86)\weread-dailyquestion-helper-main\process\Click.py", line 36, in run
locations = [v for v in locations]
File "D:\Program Files (x86)\weread-dailyquestion-helper-main\process\Click.py", line 36, in
locations = [v for v in locations]
File "C:\ProgramData\Anaconda3\lib\site-packages\pyscreeze_init_.py", line 257, in _locateAll_opencv
raise ImageNotFoundException('Could not locate the image (highest confidence = %.3f)' % result.max())
pyscreeze.ImageNotFoundException: Could not locate the image (highest confidence = 0.628)

进程已结束,退出代码为 1
这啥意思呀@lllyin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.