Spying on your friends steam with cronjobs

Most steam users didn't set their profile as private so now anyone in the world can view their activity.

Steam even turns on automatically so you can pretty much see when someone is using their computer.

script

This script returns the status and currently played game by someone with current date

#!/bin/sh

ucurl() {
    curl -L -g -s --user-agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.15.2 Chrome/87.0.4280.144 Safari/537.36' -H 'Accept-Encoding: gzip, deflate' --compressed "$@"
}

get_page() {
    printf '%s,%s\n' "$(ucurl "$1" | reliq 'div .profile_in_game_header | "%i,", div .profile_in_game_name | "%i\n"' | tr -d '\t\r\n')" "$(date +%F-%H-%M)"
}

while [ "$#" -gt 0 ]
do
    case "$1" in
        https://steamcommunity.com/id/*)
            get_page "$1";;
        https://steamcommunity.com/profiles/*)
            get_page "$1";;
        *)
            get_page "https://steamcommunity.com/id/$1";;
    esac
    shift
done

It depends on reliq. You can name it steamm which stands for steam monitor.

cronjob

I execute them every minute to be accurate, steam has never blocked them anyway.

* * * * * /bin/sh -c '${HOME}/.local/bin/steamm someone >> "${HOME}/someone.csv"'
* * * * * /bin/sh -c '${HOME}/.local/bin/steamm "https://steamcommunity.com/profiles/76865199077739612" >> "${HOME}/someoneelse.csv"'

I store my scripts in ~/.local/bin directory.

reading the results

Now your csv file will look like

Currently In-Game,RPG Maker VX Ace,2025-02-06-16-21
Currently In-Game,RPG Maker VX Ace,2025-02-06-16-22
Currently In-Game,RPG Maker VX Ace,2025-02-06-16-23
Currently In-Game,RPG Maker VX Ace,2025-02-06-16-24
Currently Online,,2025-02-06-16-25
Currently Online,,2025-02-06-16-26
Currently Online,,2025-02-06-16-27
Currently Online,,2025-02-06-16-28
Currently Online,,2025-02-06-16-29
Currently Online,,2025-02-06-16-30

And if your connection fails for any reason you get empty fields in between

Currently Offline,,2025-02-08-09-53
,2025-02-08-09-54
,2025-02-08-09-55
,2025-02-08-09-56
Currently Offline,,2025-02-08-09-57
,2025-02-08-09-58

That's a lot of records and browsing through them is not pleasant so i've made another script that summarizes them

#!/bin/sh
awk -F , '!/^,/{ time=mktime(gensub(/(....)-(..)-(..)-(..)-(..)/,"\\1 \\2 \\3 \\4 \\5 00","g",$3));
    if (firsttimef == 0) {
        firsttimef=$3; prestate=$1; pregame=$2; pretime=time; firsttime=time;
    } else if (prestate != $1 || pregame != $2) {
        if (prestate ~ "In-Game") {
            printf("%s,%s,%s\n",firsttimef,pregame,(time-firsttime)/60); }
        else {
            x="Offline"; if (prestate ~ "Online") x="Online"; printf("%s,%s,%s\n",firsttimef,x,(time-firsttime)/60)
        }
        firsttimef=$3; prestate=$1; pregame=$2; pretime=time; firsttime=time;
    } else {
        prestate = $1; pregame = $2; pretime = time;
    }
}'  < "$@"

I've named it steammread.

Now you have the activity with minutes spend and time of it's start

2025-02-04-12-19,Online,4
2025-02-04-12-23,The Binding of Isaac: Rebirth,31
2025-02-04-12-54,Online,18
2025-02-04-13-12,Godot Engine,17
2025-02-04-13-29,Online,9
2025-02-04-13-38,Godot Engine,46
2025-02-04-14-24,Online,73
2025-02-04-15-37,Godot Engine,83
2025-02-04-17-00,Offline,7
2025-02-04-17-07,Online,4
2025-02-04-17-11,The Binding of Isaac: Rebirth,23
2025-02-04-17-34,Online,17
2025-02-04-17-51,Godot Engine,89
2025-02-04-19-20,Blender,4
2025-02-04-19-24,Godot Engine,15
2025-02-04-19-39,Online,4
2025-02-04-19-43,Godot Engine,1
2025-02-04-19-44,Online,5
2025-02-04-19-49,Godot Engine,37
2025-02-04-20-26,Online,17
2025-02-04-20-43,Offline,108
2025-02-04-22-31,Online,29
2025-02-04-23-00,Offline,883
2025-02-05-13-43,The Binding of Isaac: Rebirth,45
2025-02-05-14-28,Online,83
2025-02-05-15-51,Offline,142
2025-02-05-18-13,Online,46
2025-02-05-18-59,Godot Engine,2
2025-02-05-19-01,Online,71
2025-02-05-20-12,Godot Engine,1
2025-02-05-20-13,Online,111
2025-02-05-22-04,Offline,8
2025-02-05-22-12,Online,173
2025-02-06-01-05,Offline,858
2025-02-06-15-23,Online,24
2025-02-06-15-47,RPG Maker VX Ace,38
2025-02-06-16-25,Online,58
2025-02-06-17-23,Godot Engine,221

practical use

I use it mainly for nagging my friends about how they spend their christmas on the computer.

Even if they get annoyed with me and change their profile as private for some reason after a couple of weeks it's visible again, so just keep your script running.