Skip to content

Renfe-bot es un bot de Telegram + scraper que te ayudará a buscar billetes, especialmente útil cuando están agotados y dependen de la cancelación de otros usuarios

License

Notifications You must be signed in to change notification settings

emartinez-dev/renfe-bot

Repository files navigation

renfe-bot

También puedes leer esto en Español

Description

Renfe-bot is a Telegram bot designed to assist users in purchasing train tickets from Renfe, the main railway operator in Spain. The bot monitors ticket availability, especially in situations when tickets are sold out and only become available when someone cancels their reservation. It promptly notifies users when there are tickets available for purchase. The bot now supports a Telegram chatbot interface for enhanced user interaction.

The error handling is not perfect, so if you encounter any issues, retrying the command should work. If the issue persists, please open an issue on GitHub.

How to run

Option A: Running normally in your computer

Requirements

The required dependencies to run this project are included in the requirements.txt file. To install the requirements, use the following command:

pip install -r requirements.txt

Installation

Follow the below steps to install and set up the Renfe-bot:

  1. Clone this repository to your local machine.
  2. Install the required dependencies using the command mentioned in the 'Requirements' section.
  3. Install playwright and its dependencies with the following commands: playwright install && playwright install-deps
  4. Run the bot by executing it (python renfe-bot.py) in the root directory of the project.
  5. Anything required like the API key will be prompted for when you run the bot for the first time.

Option B: Running it as a Docker container

Requirements

To run this in Docker, you will just need to have a valid installation of Docker, everything else is provided in the Dockerfile.

Important

It's possible that you need to add sudo before every command, or you can add your user to the docker group, check this doc.

Installation

First you need to build the image, do it with the following command:

docker build -t renfe-bot .

When the image finishes building, it can already be run with the following command:

docker run -it -v $(pwd):/app renfe-bot

Or if you are using Windows:

docker run -it -v %cd%:/app renfe-bot

Usage

To use the bot, send a message to your bot on Telegram. You need to provide inputs such as origin and destination stations, and dates. The bot will monitor the ticket availability and notify you immediately when there's a ticket available for your journey.

Contributing

This project is open source and contributions are very much welcomed. If you would like to contribute to the project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Make your changes.
  4. Push your changes to your fork.
  5. Submit a pull request with a description of the changes.

Before merging, all changes will be tested to ensure they function correctly. Contributions are not limited to code changes; opening issues or providing suggestions are equally valuable.

License

This project is licensed under the terms of the MIT License.

The MIT License is a permissive license that allows for reuse of software within proprietary software provided that all copies of the licensed software include a copy of the MIT License terms and the copyright notice.

This means that you are free to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, as long as you include the necessary attribution and provide a copy of the MIT license.

You can see the full license text in the LICENSE file.

About

Renfe-bot es un bot de Telegram + scraper que te ayudará a buscar billetes, especialmente útil cuando están agotados y dependen de la cancelación de otros usuarios

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages