Transcription and summarization tool for YouTube, Twitter/X.com videos, and local files with automatic translation and language model processing
Project description
TRNS - Transcription and Language Model Processing
TRNS is a powerful tool for transcribing YouTube videos, Twitter/X.com videos, and local video files with automatic translation and language model processing. It provides both a command-line interface and a Telegram bot for easy access.
Features
- 🎥 Multi-source support: YouTube videos, Twitter/X.com videos, and local video files
- 🗣️ Speech-to-text: Uses Whisper for high-quality transcription
- 🌍 Automatic translation: Translates transcriptions to Russian
- 🤖 Language model processing: Processes transcriptions through OpenRouter.ai for intelligent summaries
- 📱 Telegram bot: Interactive bot interface with real-time transcription updates
- 🖥️ CLI tool: Simple command-line interface:
trns <url>
Quick Start
Installation
pip install trns
CLI Usage
# Transcribe a YouTube video
trns https://www.youtube.com/watch?v=VIDEO_ID
# Transcribe a Twitter/X.com video
trns https://twitter.com/user/status/1234567890
# Transcribe a local video file
trns /path/to/video.mp4
Telegram Bot Setup
- Create a Telegram bot via @BotFather
- Set environment variables or create config files:
export BOT_TOKEN=your_bot_token export AUTH_KEY=your_auth_key export OPENROUTER_API_KEY=your_api_key export ALLOWED_USER_IDS=123456789,987654321
- Run the bot:
python -m trns.bot.server
- Configure webhook (see SETUP.md for details)
Configuration
TRNS supports both environment variables and file-based configuration:
Environment Variables
BOT_TOKEN: Telegram bot tokenAUTH_KEY: Authentication key for bot accessOPENROUTER_API_KEY: OpenRouter.ai API keyALLOWED_USER_IDS: Comma-separated list of allowed Telegram user IDsHOST: Server host (default: 0.0.0.0)PORT: Server port (default: 8000)CONFIG_PATH: Path to config.json (default: config.json)METADATA_PATH: Path to metadata.json (default: metadata.json)
File-based Configuration
Create the following files in the project root:
bot_key.txt: Telegram bot tokenkey.txt: Authentication keyapi_key.txt: OpenRouter.ai API key (one per line)allowed_ids.txt: Allowed user IDs (one per line)config.json: Application configurationmetadata.json: Localization and metadata
See config/ directory for example files.
Requirements
- Python 3.8+
- FFmpeg (for audio processing)
- macOS:
brew install ffmpeg - Linux:
sudo apt-get install ffmpeg - Windows: Download from ffmpeg.org
- macOS:
Documentation
- Setup Guide - Detailed setup instructions
- Deployment Guide - Cloud deployment instructions
- Architecture - System architecture documentation
- Architecture (Russian) - Архитектура системы
- User Guide (Russian) - Руководство пользователя Telegram бота
Development
# Clone the repository
git clone https://github.com/yourusername/trns.git
cd trns
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Format code
ruff format .
# Type checking
mypy src/
Docker
# Build image
docker build -f docker/Dockerfile -t trns .
# Run with docker-compose
docker-compose -f docker/docker-compose.yml up
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests.
Support
For issues and questions, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trns-0.1.1.tar.gz.
File metadata
- Download URL: trns-0.1.1.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31ea8e1af2efd0c1e08b285c0cb90c3840bb28b22cf4a9303edff5597492f9bd
|
|
| MD5 |
f6a8396441246337efc03f4869d988eb
|
|
| BLAKE2b-256 |
eeb7a8de53ee157d862d2253aaf4d003575ac538036d3f0a1422a66aa56d3aef
|
File details
Details for the file trns-0.1.1-py3-none-any.whl.
File metadata
- Download URL: trns-0.1.1-py3-none-any.whl
- Upload date:
- Size: 49.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b0809a5e39fb251c67e8922512a4a2d04db7edb3a6a29a6dac1be24e044017c
|
|
| MD5 |
697ba2e5a7dc6930aa9a1fa5834dcb20
|
|
| BLAKE2b-256 |
18279eed888c6ef1306e9645f92cabdb8ac6ba307f83136b3a24da71dece4a6e
|