An open API service indexing awesome lists of open source software.

https://github.com/coolcodehere/steam-monitor

it monitors steam
https://github.com/coolcodehere/steam-monitor

Last synced: about 1 month ago
JSON representation

it monitors steam

Awesome Lists containing this project

README

          

# PageMonitor

Fetch a web page, compare the **``** inner HTML to a local snapshot, and update the snapshot when the body changes. Head, scripts, and other markup outside `` are ignored. Volatile bits (hidden config blocks, large `data-*` blobs, session hashes, timestamps) are stripped before compare so routine session noise does not trigger updates.

## Usage

### Python API

```python
from pagemonitor import check_for_changes

if check_for_changes("https://example.com", "snapshots/example.html"):
print("Page changed!")
```

Behavior:

- **No snapshot yet** — saves the body inner HTML and returns `False`.
- **Snapshot matches** — returns `False` (snapshot is left as-is).
- **Snapshot differs** — prints only the changed fragments to stdout, overwrites the snapshot, and returns `True`.

### Discord notifications

After each check, PageMonitor posts the result to a Discord channel using the [bot API](https://discord.com/developers/docs/resources/channel#create-message)—changed, unchanged, or first-time baseline. The outgoing request is printed to the console (token redacted).

For [Steam Frame](https://store.steampowered.com/hardware/steamframe), any detected **change** pings the **@Steam Frame Interest** role (Discord requires `allowed_mentions` in the API payload for the ping to fire). Set `DISCORD_NOTIFY_ROLE_ID` to that role's ID; the bot needs permission to mention the role in that channel.

Test the ping:

```bash
python3 scripts/ping_role.py
```

Simulate a Steam Frame change (reserve/buy detected, role ping, no fetch):

```bash
python3 scripts/simulate_change.py
```

Copy `.env.example` to `.env` in the project root (or run from a directory that has its own `.env`):

```bash
cp .env.example .env
# edit .env with your bot token and channel id
```

| Variable | Description |
|----------|-------------|
| `DISCORD_BOT_TOKEN` | Bot token from the [Discord Developer Portal](https://discord.com/developers/applications) |
| `DISCORD_CHANNEL_ID` | Channel ID to post in (bot needs **Send Messages** in that channel) |
| `DISCORD_NOTIFY_USER_ID` | Your Discord **user** ID — @mentioned in that channel when the page changes |
| `DISCORD_NOTIFY_ROLE_ID` | **@Steam Frame Interest** role ID — @mentioned on Steam Frame page changes |

```bash
python3 scripts/check_page.py https://example.com snapshots/example.html
```

Values in `.env` are loaded automatically. Variables already set in your shell take precedence. If Discord variables are missing, monitoring still works; notifications are skipped. Pass `notify=False` to `check_for_changes()` to disable Discord posts.

### CLI

```bash
python scripts/check_page.py https://example.com snapshots/example.html
```

Or after install:

```bash
pip install -e .
check-page https://example.com snapshots/example.html
```

### Docker (Steam Frame every 30 seconds)

All Docker files live in [`docker/`](docker/). See [`docker/README.md`](docker/README.md).

Equivalent to running this on a loop:

```bash
python3 scripts/check_page.py https://store.steampowered.com/hardware/steamframe snapshots/steamframe.html
```

```bash
cp .env.example .env # Discord token + channel id
./docker/docker-up.sh
```

- Loads secrets from `.env` in the project root
- Persists `snapshots/steamframe.html` on the host
- Checks every **30 seconds** (`PAGEMONITOR_INTERVAL` to override)

Stop: `docker compose -f docker/docker-compose.yml down`

### Tests

```bash
python3 -m unittest discover -s tests -v
```

The suite mocks page fetches and injects HTML changes between runs to verify detection works and session noise is ignored.

Note: This is slopcoded so I cannot guarantee performance.