A telegram bot and web server with an API Rest, that indexes telegram channels videos files and serve the information through its API to build an url for stream or download.
- Index files of public and private channel
- API Rest with auth token system.
- Stream and download video files using an API endpoint
- Database support
- Tmdb API support
-
Request:
- Method:
GET
- URL:
/stream/series/{tmdb_id}:{season}:{episode}.json
- Headers:
Authorization: Bearer <token>
- Method:
-
Response:
- Status:
200 OK
- Body:
{ "tmdb_id": "77163", "streams": [ { "name": "Telegram", "title": "TV Show Title", "date": "2021-12-31", "duration": 33, "quality": "720p", "size": 263039472, "hash": "XXXXXX" } ] }
- Status:
-
Request:
- Method:
GET
- URL:
/stream/movie/{tmdb_id}.json
- Headers:
Authorization: Bearer <token>
- Method:
-
Response:
- Status:
200 OK
- Body:
{ "tmdb_id": "592831", "streams": [ { "name": "Telegram", "title": "Movie Title", "date": "2024-09-25", "duration": 138, "quality": "720p", "size": 1189639567, "hash": "XXXXXX" } ] }
- Status:
-
Request:
- Method:
GET
- URL:
/search?query=value1&page=value2
- Headers:
Authorization: Bearer <token>
- Method:
-
Response:
- Status:
200 OK
- Body:
{ "page": 1, "total_count": 1, "results": [ { "tmdb_id": 118956, "type": "tv", "country": "US", "language": "en", "files": [ { "name": "Telegram", "title": "TV Show or Movie Title", "date": "2022-01-18", "duration": 25, "quality": "720p", "size": 65661748, "hash": "XXXXXX" }, ] } ] }
- Status:
-
Request:
- Method:
GET
- URL:
/dl/{tmdb_id}?hash=XXXXXX
- Headers:
Authorization: Bearer <token>
- Method:
-
Response:
- Status:
200 OK
: Full file download when noRange
header is provided.206 Partial Content
: Partial file download when a validRange
header is included.
- Body: Binary content of the requested media file or portion of it.
- Status:
Add the following environment variables to your config.env file.
API_ID
: (required) | Telegram api_id obtained from https://my.telegram.org/apps.int
API_HASH
: (required) | Telegram api_hash obtained from https://my.telegram.org/apps.str
BOT_TOKEN
: (required) | The Telegram Bot Token that you got from @BotFatherstr
DATABASE_URL
:(required) | Your Mongo Database URL (Connection string).str
SESSION_STRING
: | Use same account which is a participant of the channels to index.LOGS_CHANNEL
: | Channel where the indexed video files will be saved.int
TMDB_API
: | API token for tmdb authentification.str
TMDB_LANGUAGE
: | Language for tmdb metadata. Default: "en-US".str
BASE_URL
: (required) | Valid BASE URL where the bot is deployed. Format of URL should behttp://myip
, where myip is the IP/Domain(public) of your bot.str
PORT
: | Port on which app should listen to, defaults to8080
.int
SECRET_KEY
: | Secret key for encrypt and decrypt authentification tokens.str
SLEEP_THRESHOLD
: | Set a sleep threshold for flood wait exceptions, defaut is60
.int
- Go to
https://mongodb.com/
and sign-up. - Create Shared Cluster.
- Press on
Database
underDeployment
Header, your created cluster will be there. - Press on connect, choose
Allow Access From Anywhere
and press onAdd IP Address
without editing the ip, then create user. - After creating user press on
Choose a connection
, then press onConnect your application
. ChooseDriver
python andversion
3.6 or later. - Copy your
connection string
and replace<password>
with the password of your user, then press close.
start - Welcome message
index - Store files of a channel in the db
search - Search a file on db by name
del - Delete a file on the db
count - Count all files on the db
token - Generate a token to authorize using API
save_db - Save the db
del_db - Delete a db by name
This bot should only be used to access movies and TV series not protected by copyright.