Idealista Notifier Bot

February 12, 2025 Β· View on GitHub

Overview

This project is a Telegram bot that automatically scrapes Idealista for new apartment listings in Barcelona. It filters listings based on predefined criteria and sends real-time notifications via Telegram, including:

  • πŸ“ Location
  • πŸ’° Price
  • πŸ›οΈ Rooms
  • πŸ“ Size (mΒ²)
  • 🏒 Floor
  • πŸ“ Description
  • πŸ”— Direct link to the listing

Project Structure

idealista-notifier/
│── src/
β”‚   β”œβ”€β”€ scraper.py          # Scrapes Idealista & sends Telegram notifications
│── .env                    # Stores API keys (excluded from Git)
│── requirements.txt        # Python dependencies
│── Dockerfile              # Container configuration
│── docker-compose.yml      # Deployment configuration
│── README.md               # Project documentation

How It Works

  1. The script scrapes Idealista every 2 minutes
  2. It filters out unwanted areas (e.g., Raval, GΓ²tic)
  3. If a new listing appears, it extracts:
    • Location, price, size, rooms, floor, and description
  4. It sends a formatted message to your Telegram bot

Setup & Installation

  1. Clone the Repository
git clone https://github.com/martin0995/idealista-notifier.git
cd idealista-notifier
  1. Install Dependencies
pip install -r requirements.txt
  1. Set Up Environment Variables Create a .env file in the root directory and add:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_CHAT_ID=your_chat_id_here
  • TELEGRAM_BOT_TOKEN β†’ Get this from Telegram's @BotFather
  • TELEGRAM_CHAT_ID β†’ Get this using the /getUpdates API
  1. Run the Bot
python3 src/scraper.py

Docker Setup

Run Locally with Docker

To run the bot using Docker:

docker build -t idealista-bot .
docker run -d --restart unless-stopped --name idealista-bot idealista-bot

Run with Docker Compose

docker-compose up -d

This ensures the bot persists data and auto-restarts if it stops.

Deploy to Railway.app

  1. Install Railway CLI
curl -fsSL https://railway.app/install.sh | sh
railway login
  1. Link Project & Deploy
railway init
railway up
  1. Set Environment Variables
railway variables --set "TELEGRAM_BOT_TOKEN=your_bot_token_here" --set "TELEGRAM_CHAT_ID=your_chat_id_here"
  1. Check Logs & Status
railway logs -f
railway status

The bot will now run 24/7, even if you turn off your computer.

Try it out: https://t.me/Idealista_Notifier_Bot

Contributing

Feel free to open issues or submit a pull request to improve the project!