Skip to content

gonzalopezgil/student-rooms-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

35 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

student-rooms-cli ๐Ÿ 

Python 3.10+ License MIT Providers

Multi-provider student accommodation finder and monitor. Discover properties, scan for availability, and get instant alerts when rooms matching your criteria appear.

Built for students hunting semester accommodation โ€” especially when options appear unpredictably and sell out fast.

What can I do?

You're wonderingโ€ฆ Command What it does
"What properties are available in Dublin?" student-rooms discover --provider all Lists all residences from every provider in your target city
"Are there Semester 1 rooms in Dublin under โ‚ฌ300/week?" student-rooms scan --provider all One-shot scan filtered by semester & your config criteria
"Show me everything, not just Semester 1" student-rooms scan --all-options --json Returns all tenancy options (full year, semester 2, etc.) as JSON
"Alert me the moment something opens up" student-rooms watch --provider all Continuous loop โ€” sends a notification only when new options appear
"Can I actually book this room right now?" student-rooms probe-booking --residence "Binary Hub" Deep-probes the booking flow and returns direct booking links
"Is my notification setup working?" student-rooms notify --message "Test ๐Ÿ " Sends a test message through your configured notification backend
"Does this tenancy option count as Semester 1?" student-rooms test-match --from-year 2026 --to-year 2027 Tests the semester-matching logic against sample data

Providers

Yugo

Website: yugo.com ยท Method: REST API (undocumented JSON endpoints) ยท Coverage: 11 countries, 70+ cities

Full country & city list
Country Cities
๐Ÿ‡บ๐Ÿ‡ธ USA Auburn, Fayetteville, Flagstaff, Tempe, Tucson, Fort Collins, Gainesville, Tallahassee, Atlanta, Kennesaw, Champaign, Urbana, West Lafayette, Lexington, Louisville, Minneapolis, Starkville, Charlotte, Greenville, Raleigh, Charleston, Cincinnati, Corvallis, Eugene, State College, Austin, College Station, Salt Lake City, Charlottesville, Pullman, Seattle, Madison
๐Ÿ‡ฌ๐Ÿ‡ง UK Birmingham, Bournemouth, Bristol, Cambridge, Cardiff, Edinburgh, Lancaster, Lincoln, Liverpool, London, Manchester, Newcastle, Norwich, Nottingham, Plymouth, Portsmouth, Sheffield, Southampton
๐Ÿ‡ฎ๐Ÿ‡ช Ireland Cork, Dublin
๐Ÿ‡ช๐Ÿ‡ธ Spain Alcalรก de Henares, Barcelona, Madrid, Salamanca, Sevilla, Valencia
๐Ÿ‡ฉ๐Ÿ‡ช Germany Darmstadt, Frankfurt, Hamburg, Leipzig, Mรผnster
๐Ÿ‡ซ๐Ÿ‡ท France Bordeaux, Lille, Lyon, Marseille, Paris
๐Ÿ‡ต๐Ÿ‡น Portugal Porto
๐Ÿ‡ฎ๐Ÿ‡น Italy Bologna, Florence, Padova, Turin
๐Ÿ‡ฆ๐Ÿ‡น Austria Vienna
๐Ÿ‡ฆ๐Ÿ‡บ Australia Adelaide, Melbourne, Perth
๐Ÿ‡ฆ๐Ÿ‡ช UAE Dubai

Aparto

Website: apartostudent.com ยท Method: StarRez portal probing + site scraping ยท Coverage: 5 countries, 14 cities (discovered dynamically)

Country Cities
๐Ÿ‡ฎ๐Ÿ‡ช Ireland Dublin
๐Ÿ‡ช๐Ÿ‡ธ Spain Barcelona
๐Ÿ‡ฎ๐Ÿ‡น Italy Milan, Florence
๐Ÿ‡ฌ๐Ÿ‡ง UK Aberdeen, Brighton, Bristol, Cambridge, Glasgow, Kingston, Lancaster, Oxford, Reading
๐Ÿ‡ซ๐Ÿ‡ท France Paris (discover only โ€” no StarRez portal)

Installation

# Install directly from GitHub
pip install "git+https://github.com/gonzalopezgil/student-rooms-cli.git"

# Or clone for development
git clone https://github.com/gonzalopezgil/student-rooms-cli.git
cd student-rooms-cli
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Quick Start

# Copy and edit the sample config
cp config.sample.yaml config.yaml

# List all properties in Dublin
python -m student_rooms discover --provider all

# Scan for Semester 1 availability
python -m student_rooms scan --provider all

# Scan ALL options (including full-year, unfiltered)
python -m student_rooms scan --provider all --all-options --json

# Continuous monitoring with alerts
python -m student_rooms watch --provider all

# Deep-probe a specific option's booking flow
python -m student_rooms probe-booking --provider yugo --residence "Dominick Place"

# Send a test notification
python -m student_rooms notify --message "Test alert ๐Ÿ "

If installed via pip install -e ., you can also use:

student-rooms discover --provider all
student-rooms scan --provider all

Commands

Command Description
discover List all properties available from providers in your target city
scan One-shot scan for rooms matching your semester/price/privacy criteria
watch Continuous monitoring loop โ€” alerts on new availability
probe-booking Deep-probe the booking flow for a matched option (generates direct booking links)
notify Send a test notification to verify your notification setup
test-match Test the semester matching logic against sample data

Configuration

Copy config.sample.yaml to config.yaml and edit:

# Target city
target:
  country: "Ireland"
  city: "Dublin"

# Provider settings
providers:
  aparto:
    term_id_start: 1200
    term_id_end: 1600

# Academic year & semester detection
academic_year:
  start_year: 2026
  end_year: 2027
  semester1:
    name_keywords: ["semester 1", "sem 1", "first semester"]
    require_keyword: true
    start_months: [8, 9, 10]
    end_months: [12, 1, 2]

# Filters
filters:
  private_bathroom: null   # true | false | null (any)
  private_kitchen: null    # true | false | null (any)
  max_weekly_price: 350.0
  max_monthly_price: null

# Monitoring interval
polling:
  interval_seconds: 3600
  jitter_seconds: 300

# Notifications (see below)
notifications:
  type: "stdout"

Filters apply to both scan and watch. If a room lacks the required metadata (e.g. private bathroom/kitchen), it will be excluded when that filter is set.

Notification Backends

Choose one notification backend via notifications.type:

stdout (default)

Just prints to console. No configuration needed.

webhook

Generic HTTP POST โ€” works with Discord webhooks, Slack, ntfy.sh, and more.

notifications:
  type: "webhook"
  webhook:
    url: "https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN"
    method: "POST"
    headers: {}
    body_template: '{"content": "{message}"}'

telegram

Direct Telegram Bot API โ€” provide your own bot token and chat ID.

notifications:
  type: "telegram"
  telegram:
    bot_token: "YOUR_BOT_TOKEN"
    chat_id: "YOUR_CHAT_ID"
    parse_mode: null

openclaw

OpenClaw CLI integration. Requires OpenClaw installed and configured. Supports message mode, agent mode, and automatic reservation job creation.

notifications:
  type: "openclaw"
  openclaw:
    mode: "message"
    channel: "telegram"
    target: "YOUR_CHAT_ID"
    create_job_on_match: false

How It Works

Yugo Provider

  1. Resolves country โ†’ city โ†’ residences via Yugo's JSON API
  2. For each residence, fetches room types and tenancy options
  3. Filters by academic year and semester using config-driven name keywords + date rules
  4. Supports full booking-flow probing (available beds, flat selection, portal redirect)

Aparto Provider (StarRez)

  1. Dynamically discovers properties for the target city by scraping apartostudent.com
  2. Establishes session via the EU StarRez portal (auto-selects the correct country)
  3. Probes a range of termIDs via direct room search URLs on the appropriate regional portal
  4. Filters terms by matching property names against the target city's properties (supports abbreviations like PAโ†’Pallars, CdMโ†’Cristobal de Moura)
  5. Detects Semester 1 using the same config-driven name keywords + date rules as Yugo
  6. Enriches results with pricing data scraped from property pages

Portal topology:

  • Ireland, Spain, Italy โ†’ shared IE portal (apartostudent.starrezhousing.com)
  • UK โ†’ separate UK portal (apartostudentuk.starrezhousing.com)
  • France โ†’ no StarRez portal (discover-only, no term scanning)

Watch Mode

  • Scans all enabled providers at configurable intervals
  • Deduplicates: only alerts on new options not previously seen
  • Persists seen options in ~/.local/share/student-rooms-cli/seen_options.json (or $XDG_DATA_HOME)
  • Adds random jitter to avoid request patterns

Agent Integration

This tool is designed to work well with AI agents and automation:

# JSON output for programmatic consumption
python -m student_rooms scan --provider all --json
python -m student_rooms discover --provider all --json

# Scan + notify in one command
python -m student_rooms scan --provider all --notify

# Watch mode as a background process
python -m student_rooms watch --provider all &

The --json flag outputs structured data suitable for parsing by AI agents, scripts, or pipeline tools.

Project Structure

student_rooms/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ __main__.py          # python -m student_rooms entry point
โ”œโ”€โ”€ cli.py               # CLI argument parsing + command handlers
โ”œโ”€โ”€ matching.py          # Semester matching logic
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ config.py        # Configuration dataclasses + YAML loader
โ”œโ”€โ”€ providers/
โ”‚   โ”œโ”€โ”€ base.py          # BaseProvider ABC + RoomOption dataclass
โ”‚   โ”œโ”€โ”€ yugo.py          # Yugo REST API provider
โ”‚   โ””โ”€โ”€ aparto.py        # Aparto StarRez portal provider
โ””โ”€โ”€ notifiers/
    โ”œโ”€โ”€ base.py           # BaseNotifier ABC + factory
    โ”œโ”€โ”€ webhook.py        # Generic HTTP webhook
    โ”œโ”€โ”€ telegram.py       # Direct Telegram Bot API
    โ””โ”€โ”€ openclaw.py       # OpenClaw CLI integration (optional)

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Run a specific test file
python -m pytest tests/test_notifiers.py -v

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-provider)
  3. Add tests for new functionality
  4. Ensure all tests pass (python -m pytest tests/ -v)
  5. Submit a pull request

Adding a New Provider

  1. Create student_rooms/providers/your_provider.py
  2. Implement BaseProvider (see base.py for the interface)
  3. Register it in cli.py's make_providers() function
  4. Add tests in tests/test_your_provider.py

Adding a New Notifier

  1. Create student_rooms/notifiers/your_notifier.py
  2. Implement BaseNotifier (see base.py)
  3. Add config dataclass in models/config.py
  4. Register in notifiers/base.py's create_notifier() factory
  5. Add tests in tests/test_notifiers.py

Roadmap

  • More providers (Collegiate, Host, Unite Students)
  • GitHub Actions CI
  • PyPI package

Actively developed โ€” contributions welcome!

License

MIT โ€” see LICENSE.

About

Multi-provider student accommodation finder and monitor. Discover rooms, scan availability, get instant alerts. Supports Yugo & Aparto.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages