A bot to help answer questions on trivia APP. This bot takes screenshot of the game from phone and uses googles tesseract OCR to read the questions and options. It automates the process of googling of the answers and gives the most likely answer! It is 85%+ accurate!
Since it is against the policy of trivia apps i do not encourage anyone to use this during a live game and this is purely for educational purposes.
Use python 2.7 or you can use python37(some compatibility issues )particular the packages/libraries used are...
- JSON - Data Storage
- Pillow - Image manipulation
- Google-Search-API - Google searching
- pytesseract - Google's free/open source OCR (requires separate installation)
- beautifulsoup4 - Parse google searches/html
- lxml - Beautifulsoup parser
- opencv2 - Image manipulation
- pyscreenshot - Take screenshot of the game
To easily install these
-
Install python 2.7
-
Install above packages
$ pip install -r requirements.txt
-
For tesseract
$ sudo apt-get install tesseract-ocr
in linux distribution
-
For opencv
$ brew install opencv
-
Android adb
Either you have android sdk or minimal ADB
Make sure all packages above are installed. For android phones use, To use this script :
Connect you Android phone via usb cable start loco app when you see questions press l and enter
$ git clone https://github.com/SubhamTyagi/loco-hack
$ cd loco-hack
$ pip install -r requirements.txt
$ python bot.py
Press l for live game, s to run against sample questions or q to quit:
s
...Question...
$ python bot2.py
This bot will run in demo mode by default , for run live game set demo= False
at line
129
- Take a screenshot of question with option
- Go to your phone Settings >Developer option>Pointer location
- Switch on Pointer location
- Get both(i.e. top and bottom) co-ordinates of question and all option
- set these values in bot2.py file from line number 91 ,95 , 98 ,101
All contributions welcome.
The MIT License (MIT)