StackAutoLogin (SAL) is a Python script that in combination with a GitHub workflow, allows you to log in to your Stack Exchange sites every day. This allows you to continue your consecutive visited days no matter what happens.
SAL uses the Python selenium webDriver and ChromeDriver to browse the web without a human! First, it logs into the Stack Exchange website. Then, it goes to the Meta Stack Exchange website. It will visit any other SE websites you put in the SITES repository secret along with their Meta sites!
NOTE: If you log in using Google, that won't work with SAL. You can easily configure your account to be able to log in without Google (in addition to logging in with Google) by making a password for normal login. Put in your email and click "Forgot Password." Remember the password for setting SAL up.
You must provide your credentials by putting your email and password into actions repository secrets.
Put your email into a secret with the name EMAIL
And your password into a secret named PASSWORD
Any other sites you would like SAL to log in to you must put into a secret named SITES. They must be the domain of the site without ".com". For example, for Ask Ubuntu, it's domain is askubuntu.com. Use askubuntu. Or for Apple Stack Exchange, its domain is apple.stackexchange.com. Use apple.stackexchange.
Your final SITES secret may look something like this:
Your secrets list should look like this:
After this, you can sit back and relax as it logs in at 00:00 UTC every day.
If you would like to try it out on your computer, you must create a virtual Python environment and install the selenium (just like the Action does every time it runs).
NOTE: You may need the python3-venv package before being able to create a virtual environment.
sudo apt update && sudo apt install python3-venvCreate the virtual environment. Try python3 instead of python if it doesn't work
python -m venv venvActivate the environment
source ./venv/bin/activateEdit environment file
sudo nano /etc/environmentAdd environment variables to file
EMAIL=myemail@example.com
PASSWORD=mypassword
SITES="stackoverflow, superuser, serverfault, gaming.stackexchange, gamedev.stackexchange, apple.stackexchange, security.stackexchange, askubuntu, english.stackexchange, unix.stackexchange, raspberrypi.stackexchange, diy.stackexchange, photo.stackexchange"When you're finished press CTRL + X and then Y.
Create the virtual environment
python -m venv venvActivate the environment
.\venv\Scripts\activateSet environment variables
setx EMAIL myemail@example.com /msetx PASSWORD mypassword /msetx SITES "stackoverflow, superuser, serverfault, gaming.stackexchange, gamedev.stackexchange, apple.stackexchange, security.stackexchange, askubuntu, english.stackexchange, unix.stackexchange, raspberrypi.stackexchange, diy.stackexchange, photo.stackexchange" /mInstall selenium
pip install -r requirements.txtRun SAL with the unbuffered option. It makes it so the log outputs things right away
python -u main.pyYou can see SAL working in your browser
Go to chrome://inspect, click Configure, add 127.0.0.1:9222, and click done. A "remote target" should pop up. When it does, click Inspect.
Now you can watch SAL browse the web live!
SAL also saves a screenshot as stackexchange.png so you can see right away if it successfully logged in or not.
(c) 2024 Anston Sorensen



