Answer the question
In order to leave comments, you need to log in
How to automate website crawling with HTML5 canvas?
Hello!
For the sake of fun and self-development, I'm trying to automate the process of playing one web-based game. The game is a website with an HTML5 canvas element on which the playing field is drawn.
The required sequence of actions is as follows:
Answer the question
In order to leave comments, you need to log in
Your question looks like a freelance job.
It seems to me that the easiest and surest way to make a bot as you described is to study the api through which the client works.
Then imitate the client in any convenient language, the browser in this case is completely optional, even headless.
Because the browser is not a full-fledged client as such, there is no kind of protection against emulation by anything. In other words, the server is deeply concerned with where the data comes from, the browser or the script in the console.
I did this by searching for a picture in a picture. quite sporty, machine vision and pattern recognition are not needed here. it is convenient that you do not need to study the inner workings of the game and do not depend on code changes / new versions. also handy for closed source (flash) games.
but if you want to do it at the level of business logic, then the choice is small: it’s
easier: to peep what requests go to the server and write a script that sends the same ones, from the minuses - you won’t see changes visually on the screen until you reboot, although the browser is essentially not required here at all .
a little more difficult but cooler: extract the js code and look at the internal api (the difficulty is that the code is most likely minified and possibly obfuscated, then it can be more difficult without naming variables). after parsing the code, you can change it (add your own business logic) and replace it in the browser, you can add new buttons and functions to the interface.
I use all methods depending on the task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question