Making a bot to do daily tasks on the internet
I'm interested in writing a robot that'll do some things on the internet everyday, such as making a new wiki page, how would I go about making this?
I want the bot to go to a specific website, click a text entry, enter a number, then go to another website, copy all the text there, and paste it into a wiki page.
It should do this once a day.
I also want the bot to do this without me having to turn on my computer if possible.
svg files cannot be displayed: https://replanalytics.repl.co/track/f0fc8ef1-6a25-4dde-b207-cda92d02cff1/countbadge.svg
Anything that interacts with the web will usually involve an API, though you might be able to do it through a webdriver.
Being able to do this without having to have your computer be on requires one that will. This is usually done with a server, either onsite or offsite. Either way, it's not ideal.
Typically APIs are used for this kind of task. Do you have any specifics on what page(s) you are using?
Thanks for answering so soon!
How would I make an API? Would I be using JS?
There's a game that I play called Greed Control, here. The instructions for the game are here. Basically I want the robot to go to the first link, enter a number. Then go to the scores page and copy everything (the equivalent of pressing Ctrl A then Ctrl C). Next, paste what it copied into a wiki page with yesterday's date in it's title, for example if I ran the code today it would give me this wiki page:
I also want it to go to the statistics page and copy variables d1 and d2:
Then paste them into the wiki page created before.
In the end it should look like this.
Please tell me if I should explain some more.
@piphi Thanks for the reply!
Interesting. I'm not very familiar with Python, but I hear you can interact with the web browser and do exactly what you said, press keys, click things, etc.
I'm not super sure on exactly how you would get the variables, as you have to render the page, and then inspect the code. Or maybe not, I don't know.
If you do know some Python, try using the Pygame browser(?)
import webbot import os import time import random os.system('pip3 install pyautogui') driver = webbot.Browser() print("") driver.go_to('google.com') while True: time.sleep(0.0001)
Again, I don't know much Python, but I've seen that it's possible to do about exactly what you said.
<iframe src="greedPageLink" id="greedPage"></iframe>
var greedPage = document.getElementById('greedPage'); var greedWindow = greedPage.contentWindow; //greedWindow is like the local window. You can do document.getElementById(), get elements, etc var numberBox = greedWindow.document.getElementById('some-id'); //I don't know the id for the input box, find it in Inspect :) numberBox.value = YOURNUMBER;//This is the number you want to put in. var submitButton = greedPage.document.getElementById('some-id');//Again, I don't know the id of the submit button, you can find it on your own submitbutton.click();//Click the submit button
That submits the form with your number.
We're using the same script as before, just adding to it here.
Luckily for us, the variables are global! :)
This means all we need to do to get the graph data is
var d1 = greedPage.d1;//This is the data var d2 = greedPage.d2;