In this tutorial I'm going to guide you through setting up a cron job, that opens https://www.gog.com/giveaway/claim every day, which adds the game currently on giveaway to your account. I'm going to use a Raspberry Pi with Raspberry Pi OS, but any Linux distro should work, as long as it's powered on during the time you plan to run the cron job. If you don't have a Raspberry Pi at home, I'd recommend using a free VPS. Google Cloud and Oracle Cloud both offer a reliable, and free VPS. For the setup, I'm going to use Chrome, but any browser is feasible.
Getting a session cookie
You can do this on your desktop machine.
- Install the EditThisCookie extension (Firefox version is also available).
- Right click EditThisCookie icon in the extensions toolbar, then click Options.
- A new tab should hvae opened. Click on options in the left sidebar, then set the "Choose the preferred export format for cookies" to "Netscape HTTP Cookie File".
- [Optional] Open a new incognito tab (you can also use a regular tab, but incognito is recommended to not interfere with your existing (or future) gog.com session). Don't forget to allow the extension to run in incognito tabs.
- Go to gog.com and log in
- Click on the EditThisCookie icon in the extensions toolbar, then click the export button.
- Create a new text file, and paste in the cookies you've copied in the previous step.
- Save the file to the machine you are going to run the cron job on. I have it saved on my Raspberry Pi at
Creating the cron job
For this part, I'll be using Raspberry Pi OS (via SSH)
- Install cronie with
sudo apt install cron
- Edit your cron jobs with
- Add a new line at the end with the following contents:
1 1 * * * curl 'https://www.gog.com/giveaway/claim' -b "<REPLACE_THIS_WITH_COOKIE_FILE_LOCATION>" -c "<REPLACE_THIS_WITH_COOKIE_FILE_LOCATION>"
This will open https://www.gog.com/giveaway/claim with cookies from the file we saved above every day at 01:01. If you'd like to change the time, use https://crontab.guru/.
I also have a user-agent added to the request, that's optional. It'd make curl look (a bit more like) Chrome. To add it, append the following at the end of the line:
-H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/188.8.131.52 Safari/537.36"
- Save the file (if you are using nano, press
If you have any questions, or improvements, feel free to leave a comment below.