Warning
Not maintained, tested or used for a long time.
TranschiavoBot is a simple Telegram bot written in Python designed to download files from WeTransfer and SwissTransfer links. It utilizes Selenium for automating web interactions, making it an ideal solution for users who frequently receive download links via Telegram and wish to streamline file retrieval.
- Automatic Download: Detects and downloads files from WeTransfer and SwissTransfer links.
- Selenium Automation: Uses Selenium to automate the download process via a headless browser.
- Telegram Integration: Seamlessly integrates with Telegram to receive and process messages.
- Docker Support: Easily deployable using Docker.
- Simple Configuration: Manage settings via environment variables and configuration files.
- Python 3.7 or higher (see
requirements.txtfor dependencies) - pip package manager
- Selenium WebDriver (ChromeDriver or GeckoDriver, depending on your preferred browser)
- A valid Telegram Bot API token
- Clone the repository:
git clone https://github.com/SamueleOrazioDurante/TranschiavoBot.git
- Navigate to the repository directory:
cd TranschiavoBot - (Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
- Copy the file
example.envto.envand update it with your Telegram Bot token and any other configuration parameters.
- Copy the file
- config.py: Contains the bot’s configuration, including the Telegram token and other relevant settings.
- example.env: Provides a sample configuration for environment variables. Rename and customize this file as needed.
- tokenManager.py: Manages API tokens securely to ensure proper authentication.
To start the bot, run:
python main.pyThe bot will connect to Telegram and begin listening for messages. Upon receiving a WeTransfer or SwissTransfer download link, it will trigger the download process using Selenium.
You can run the bot in a Docker container for easier deployment:
- Build the Docker image:
docker build -t transchiavobot . - Run the container:
docker run --env-file .env transchiavobot
Alternatively, use the provided docker-compose.yml:
docker-compose up -d- logger.py and fileLogger.py are responsible for logging the bot's activity.
- Logs are output to both the console and, if configured, to log files.
- You can adjust the logging level in
config.pyto assist with debugging.
- Introduzione
- Caratteristiche
- Installazione
- Configurazione
- Utilizzo
- Esecuzione con Docker
- Logging e Debugging
TranschiavoBot è un semplice bot per Telegram scritto in Python, progettato per scaricare file da link di WeTransfer e SwissTransfer. Utilizza Selenium per automatizzare le interazioni web, rendendolo una soluzione ideale per gli utenti che ricevono frequentemente link di download su Telegram e desiderano semplificare il recupero dei file.
- Download Automatico: Rileva e scarica automaticamente file da link di WeTransfer e SwissTransfer.
- Automazione con Selenium: Utilizza Selenium per automatizzare il processo di download tramite un browser headless.
- Integrazione con Telegram: Si integra perfettamente con Telegram per ricevere ed elaborare i messaggi.
- Supporto Docker: Facilmente deployabile utilizzando Docker.
- Configurazione Semplice: Gestione delle impostazioni tramite variabili d'ambiente e file di configurazione.
- Python 3.7 o superiore (vedi
requirements.txtper le dipendenze) - Gestore di pacchetti pip
- Selenium WebDriver (ChromeDriver o GeckoDriver, a seconda del browser scelto)
- Un token valido per Telegram Bot API
- Clona il repository:
git clone https://github.com/SamueleOrazioDurante/TranschiavoBot.git
- Naviga nella cartella del repository:
cd TranschiavoBot - (Opzionale) Crea e attiva un ambiente virtuale:
python3 -m venv venv source venv/bin/activate # Su Windows: venv\Scripts\activate
- Installa le dipendenze:
pip install -r requirements.txt
- Configura le variabili d'ambiente:
- Copia il file
example.envin.enve imposta il token del tuo bot Telegram e gli altri parametri di configurazione.
- Copia il file
- config.py: Contiene la configurazione del bot, incluso il token di Telegram e altre impostazioni rilevanti.
- example.env: File di esempio per le variabili d'ambiente. Rinominalo e personalizzalo in base alle tue esigenze.
- tokenManager.py: Gestisce in modo sicuro i token API per garantire una corretta autenticazione.
Per avviare il bot, esegui:
python main.pyIl bot si connetterà a Telegram e inizierà ad ascoltare i messaggi. Quando riceve un link di download da WeTransfer o SwissTransfer, avvierà il processo di download utilizzando Selenium.
È possibile eseguire il bot tramite Docker per una gestione semplificata:
- Costruisci l'immagine Docker:
docker build -t transchiavobot . - Avvia il container:
docker run --env-file .env transchiavobot
In alternativa, utilizza il file docker-compose.yml fornito:
docker-compose up -d- logger.py e fileLogger.py gestiscono il logging delle attività del bot.
- I log vengono inviati sia alla console che, se configurato, a file di log.
- È possibile regolare il livello di logging in
config.pyper facilitare il debugging.