Initial commit: inberlin apartment monitor with autopilot
This commit is contained in:
commit
bf9d7f1371
9 changed files with 4900 additions and 0 deletions
11
.env.example
Normal file
11
.env.example
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Telegram Bot Configuration
|
||||||
|
# Create a bot via @BotFather on Telegram to get these
|
||||||
|
TELEGRAM_BOT_TOKEN=your_bot_token_here
|
||||||
|
TELEGRAM_CHAT_ID=your_chat_id_here
|
||||||
|
|
||||||
|
# inberlinwohnen.de Login
|
||||||
|
INBERLIN_EMAIL=aron@petau.net
|
||||||
|
INBERLIN_PASSWORD=BvA5n0iKmGV1
|
||||||
|
|
||||||
|
# Check interval in seconds (default: 600 = 10 minutes)
|
||||||
|
CHECK_INTERVAL=600
|
||||||
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env/
|
||||||
|
|
||||||
|
# Data
|
||||||
|
data/
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
1
.python-version
Normal file
1
.python-version
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
3.11.8
|
||||||
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
FROM mcr.microsoft.com/playwright/python:v1.56.0-jammy
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy application
|
||||||
|
COPY monitor.py .
|
||||||
|
|
||||||
|
# Create data directory
|
||||||
|
RUN mkdir -p /data && chmod 777 /data
|
||||||
|
|
||||||
|
CMD ["python", "-u", "monitor.py"]
|
||||||
107
README.md
Normal file
107
README.md
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
# inberlin-monitor
|
||||||
|
|
||||||
|
Monitors [inberlinwohnen.de](https://www.inberlinwohnen.de/wohnungsfinder/) for new apartment listings and sends Telegram notifications. Supports automatic application submission via autopilot mode.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- 🔐 Logs in to your personal Wohnungsfinder for filtered results
|
||||||
|
- ⏰ Checks every 5 minutes (configurable)
|
||||||
|
- 📱 Sends Telegram notifications for new listings with clickable links
|
||||||
|
- 🤖 **Autopilot mode**: Automatically applies to new listings
|
||||||
|
- 📊 **/plot command**: Visualize when listings appear throughout the week
|
||||||
|
- 🏢 Supports multiple housing companies: HOWOGE, Gewobag, Degewo, Gesobau, Stadt und Land, WBM
|
||||||
|
- 💾 Persists state to detect only truly new listings
|
||||||
|
- 📈 Logs listing times for pattern analysis
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### 1. Create Telegram Bot
|
||||||
|
|
||||||
|
1. Message [@BotFather](https://t.me/botfather) on Telegram
|
||||||
|
2. Send `/newbot` and follow the prompts
|
||||||
|
3. Copy the bot token
|
||||||
|
|
||||||
|
### 2. Get Your Chat ID
|
||||||
|
|
||||||
|
1. Message your new bot (send anything)
|
||||||
|
2. Visit: `https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates`
|
||||||
|
3. Find `"chat":{"id":123456789}` - that's your chat ID
|
||||||
|
|
||||||
|
### 3. Configure
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
# Edit .env with your credentials
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Check Logs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose logs -f
|
||||||
|
# or
|
||||||
|
cat data/monitor.log
|
||||||
|
```
|
||||||
|
|
||||||
|
## Telegram Commands
|
||||||
|
|
||||||
|
| Command | Description |
|
||||||
|
|---------|-------------|
|
||||||
|
| `/autopilot on` | Enable automatic applications |
|
||||||
|
| `/autopilot off` | Disable automatic applications |
|
||||||
|
| `/status` | Show current status and application stats |
|
||||||
|
| `/plot` | Generate weekly listing pattern visualization |
|
||||||
|
| `/help` | Show available commands |
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
| Variable | Description |
|
||||||
|
|----------|-------------|
|
||||||
|
| `TELEGRAM_BOT_TOKEN` | Telegram bot token from BotFather |
|
||||||
|
| `TELEGRAM_CHAT_ID` | Your Telegram chat ID |
|
||||||
|
|
||||||
|
### Optional - Login
|
||||||
|
|
||||||
|
| Variable | Description | Default |
|
||||||
|
|----------|-------------|---------|
|
||||||
|
| `INBERLIN_EMAIL` | inberlinwohnen.de login email | - |
|
||||||
|
| `INBERLIN_PASSWORD` | inberlinwohnen.de password | - |
|
||||||
|
| `CHECK_INTERVAL` | Seconds between checks | 300 |
|
||||||
|
|
||||||
|
### Optional - Form Data (for Autopilot)
|
||||||
|
|
||||||
|
| Variable | Description | Default |
|
||||||
|
|----------|-------------|---------|
|
||||||
|
| `FORM_ANREDE` | Salutation (Herr/Frau) | Herr |
|
||||||
|
| `FORM_VORNAME` | First name | Aron |
|
||||||
|
| `FORM_NACHNAME` | Last name | Petau |
|
||||||
|
| `FORM_EMAIL` | Contact email | `aron@petau.net` |
|
||||||
|
| `FORM_PHONE` | Phone number | 017695773688 |
|
||||||
|
| `FORM_PERSONS` | Number of persons moving in | 1 |
|
||||||
|
| `FORM_CHILDREN` | Number of children | 0 |
|
||||||
|
| `FORM_INCOME` | Monthly household net income (€) | 1600 |
|
||||||
|
|
||||||
|
## Without Login
|
||||||
|
|
||||||
|
If you don't provide login credentials, the monitor will use the public Wohnungsfinder (shows all listings instead of your personalized filtered results).
|
||||||
|
|
||||||
|
## Data Files
|
||||||
|
|
||||||
|
All data is stored in the `./data` directory:
|
||||||
|
|
||||||
|
| File | Description |
|
||||||
|
|------|-------------|
|
||||||
|
| `listings.json` | Known listings (for duplicate detection) |
|
||||||
|
| `state.json` | Monitor state (autopilot on/off) |
|
||||||
|
| `applications.json` | Record of submitted applications |
|
||||||
|
| `listing_times.csv` | Timing data for pattern analysis |
|
||||||
|
| `monitor.log` | Application logs |
|
||||||
|
| `weekly_plot.png` | Generated plot from /plot command |
|
||||||
|
| `*.png` | Screenshots from application attempts |
|
||||||
3399
debug_page.html
Normal file
3399
debug_page.html
Normal file
File diff suppressed because one or more lines are too long
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
services:
|
||||||
|
inberlin-monitor:
|
||||||
|
build: .
|
||||||
|
container_name: inberlin-monitor
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
# Telegram notifications
|
||||||
|
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
|
||||||
|
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
|
||||||
|
# inberlinwohnen.de login
|
||||||
|
- INBERLIN_EMAIL=${INBERLIN_EMAIL}
|
||||||
|
- INBERLIN_PASSWORD=${INBERLIN_PASSWORD}
|
||||||
|
# Check interval in seconds (default: 300 = 5 minutes)
|
||||||
|
- CHECK_INTERVAL=${CHECK_INTERVAL:-300}
|
||||||
|
# Form data for applications
|
||||||
|
- FORM_ANREDE=${FORM_ANREDE:-Herr}
|
||||||
|
- FORM_VORNAME=${FORM_VORNAME:-Aron}
|
||||||
|
- FORM_NACHNAME=${FORM_NACHNAME:-Petau}
|
||||||
|
- FORM_EMAIL=${FORM_EMAIL:-aron@petau.net}
|
||||||
|
- FORM_PHONE=${FORM_PHONE:-017695773688}
|
||||||
|
- FORM_PERSONS=${FORM_PERSONS:-1}
|
||||||
|
- FORM_CHILDREN=${FORM_CHILDREN:-0}
|
||||||
|
- FORM_INCOME=${FORM_INCOME:-1600}
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
1312
monitor.py
Normal file
1312
monitor.py
Normal file
File diff suppressed because it is too large
Load diff
4
requirements.txt
Normal file
4
requirements.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
requests>=2.31.0
|
||||||
|
playwright>=1.49.0
|
||||||
|
matplotlib>=3.8.0
|
||||||
|
pandas>=2.0.0
|
||||||
Loading…
Add table
Add a link
Reference in a new issue