Tip:
Highlight text to annotate it
X
To follow this tutorial, it would be good to have knowledge of C++, object oriented
programming, and it would be a big plus if you had knowledge of the Qt libraries. So,
you will need to have Qt Creator installed, and the Qt libraries. You can search Google
"Download Qt" and download the libraries that match your system. They're available libraries
for Mac, Windows and Linux. So, you will not have any problem if you're using a different
system than mine. So, how our web bot works? Our web bot, our internet bot does exactly
the things that a human being does. For example, it loads URLs, it fills in forms, it can also
press elements on the page. For example, press some button or some link. It can simulate
key presses like [Enter], etc. It can also read, it can interpret, process data, etc.
So, here is an internet bot that I made that logins into Facebook and likes all the pages.
And likes all the posts on my Facebook homepage. Let's see that in action. So, it fills in
my login credentials, it waits for the page to load and begins liking. It likes, likes
everything. Everything in my homepage. Scrolls automatically and it likes. So, It would like
29 posts or comments. I don't want it to do that so I just stop the process. Let's see
the code a bit. This is a FacebookAllLike class. This class calls our Web Bot. Every
variable that ends with an underscore is a private member variable. So, this is a private
member variable of FacebookAllLike. Everything will become more clear in the next part of
the series. So, do not worry if you do not understand something right now. I will explain
everything, how everything works. For now I want you to see the basic concept of our
Internet Bot. So, OOP allows us to imagine the Internet Bot like an object that we instruct.
The first line here, show the action, makes the internet bot show this window in which
we see what is being done. Normally, we want our Internet Bot to run on the background.
We do not want it to be annoying. We just want it to log everything in text files that
we can see later. We don't want it to always be visible. So, the showTheAction function
just initiates this window that we can see what is being done. The "load" just loads
a URL. Here facebook.com. The "fillIn" function fills in some elements of the page based on
their IDs with the data. The username here is this one passed from the "setLogin" function.
Then it presses enter, it waits for the page to load, and it clicks on all the elements
being of class UFILikeLink with a delay of 2000 (ms). And simple as that, this is 7 lines
of code, we are able to like all the links on our facebook homepage. This is just a very
simple demonstration of how to use this Web Bot. So, it's all about programming this Web
Bot. How is this Web Bot class designed. And, it is really not that difficult, because Qt provides
us with some very high level classes. But we'll talk about this on the next video.