A REST API to stream or download Telegram video files.
It is a Rust-based application that uses the Telegram MTProto library grammers to fetch video files and stream them to clients.
- Clone the repository.
- Create a
.envfile with the following content:
# Rust
RUST_LOG=trace # Log level
RUST_BACKTRACE=1 # Expand backtrace
# Database
DATABASE_URL=postgres://user:password@host:port/database # Your database URL
# Server
JWT_SECRET=YourSecretKey
SERVER_HOST=127.0.0.1 # Your server host
SERVER_PORT=3000 # Your server port
# Telegram
TELEGRAM_API_ID=YOUR_API_ID # Your Telegram API ID
TELEGRAM_API_HASH=YOUR_API_HASH # Your Telegram API hash- Install
sqlx-cli:
cargo install sqlx-cli --no-default-features --features postgres- After initializing the postgres database, run the migrations:
sqlx migrate run- Add a new session with
cargo run -- -n. - Run the server with
cargo run. - Access the API documentation at
http://localhost:3000/api/v1.
When you add a new session, it's necessary for the added session to ‘know’ the chat, i.e. receive some update from Telegram regarding the chat in which the video is, it could be anything, a message from a user or the user of the session in that chat, a service message or even a status update, such as ‘someone is typing’ or things like that.
This is only necessary the first time the session is added, after which the chat will be saved in the cache.
All the libraries and binaries contained in this repository are licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Thank you for considering to contribute! I'll try my best to provide quick, constructive feedback on your issues or pull requests. Please do call me out if you think my behaviour is not acceptable at any time. I will try to keep the discussion as technical as possible. Similarly, I will not tolerate poor behaviour from your side towards other people (including myself).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.