tflix: A Telegram CLI interface for media downloading and streaming.
Project description
tflix
A Telegram CLI interface for media downloading and streaming, built on top of Telethon.
Description
tflix streamlines the process of discovering, downloading and streaming media files from Telegram bots. It provides an interactive command-line interface that handles bot navigation, automatic channel joining, and media file streaming and downloads with minimal user intervention.
Features
- Interactive CLI - Navigate bot menus and send messages directly from the terminal
- Auto-Join Support - Automatically joins groups via invite links when required
- Button Navigation - Click numbered options from bot menus instantly
- Media Filtering - Lists only media files
- Downloading and Streaming - Can download or stream media files directly
- Movie/Series Search - Use Tab to search and autocomplete movies or series titles
Requirements
- Python 3.8+
- Telegram API Credentials
Installation
From PyPI
pip install tflix
From Source
git clone https://github.com/voidsnax/tflix.git
cd tflix
pip install -e .
Usage
Setup Guide
Creating the .env File
-
Locate the config folder:
- Windows:
C:\Users\<User>\tflix\ - Linux/Mac:
~/.config/tflix/
- Windows:
-
Create a new file named
.envin the config folder -
Get your Telegram API credentials:
- Visit https://my.telegram.org
- Log in with your Telegram account
- Go to "API development tools"
- Create a new application
- Copy your
api_idandapi_hash
-
Add your credentials to
.env:TGRAM_API_ID=your_api_id_here TGRAM_API_HASH=your_api_hash_here -
Optional: Add movie database API keys for title suggestions
Note: TMDB is recommended for vast movie and series collections, while OMDB is recommended for quicker response times.
-
TMDB
- Create an account at https://www.themoviedb.org/
- Go to Settings > API and apply for an API key
- Add
TMDB_API_KEY=your_tmdb_api_keyto.env
-
OMDB
- Visit http://www.omdbapi.com/apikey.aspx
- Request a free API key
- Add
OMDB_API_KEY=your_omdb_api_keyto.env
Example:
TGRAM_API_ID=your_api_id_here TGRAM_API_HASH=your_api_hash_here TMDB_API_KEY=your_tmdb_api_key_here OMDB_API_KEY=your_omdb_api_key_here -
-
Save the file
Configuration File
tflix also supports a config file for advanced settings. The default location is:
- Linux/Mac:
~/.config/tflix/tflix.conf - Windows:
C:\Users\<User>\tflix\tflix.conf
A sample config file looks like:
[chat]
auto_join_buttons = join updates channel, join channel, me joined, request to my updates channel
buttons_to_skip = search movies here, search on google
[log]
# channel =
[server]
host = http://localhost
port = 8080
[stream]
auto_stream = True
copy_links = False
[download]
connection_count = 4
Options:
auto_join_buttons: comma-separated button labels to auto-click for joining channels/groupsbuttons_to_skip: comma-separated button labels to ignorechannel: log channel ID for forwading streaming files (needed if u want to start or use streaming services also u can connect to log channel and access files by just mentioning log channel name, e.g,tflix streamlogs -s)host: streaming server hostport: streaming server portauto_stream: automatically generate stream links for filescopy_links: copy streaming links to clipboardconnection_count: number of download connections (1-20) (higher values can cause instability or flood wait)
If the config file does not exist, it is created automatically with default values.
Basic Command
tflix CHAT [OPTIONS]
Options
CHAT Chat username, ID, or link
-o, --output PATH Output directory for downloads (default: current dir)
-l, --list [LIMIT/STRING] List recent N bot media messages (default: 1) or searches across the chat for the file if a string is provided
-d, --download [INDEX] Download recent N bot media messages (default: 1)
-s, --stream Starts streaming server
Interactive Commands
h → Print help table
<text> → Send message to bot
<number> → Click button # from the list
ls [LIMIT/STRING] → List files to a limit or based on string
stream [INDEX] → Stream files
dl [INDEX] → Download files (e.g., indices '1', '1,2,3', '1:3', '1-3')
exit/ctrl-c → Quit
Examples
Connect to a bot and list 5 recent files:
tflix @mybot -l 5
Connect to a bot with server running:
tflix @mybot -s
Connect to a bot and set output folder:
tflix @mybot -o C:\Downloads
Then interact :)
Notes
- API Credentials - Create
.envin config folder withTGRAM_API_IDandTGRAM_API_HASH - Session Changes - Overwrites existing session when .env file attributes changes
- Private groups - need invite link to connect
- Input Delay - Allow 10-15 seconds for input to process if responses or input prompt arrow seem delayed
- Faster downloads - Install
cryptgortelethon-tgcryptofor faster download speeds (pip install cryptg OR pip install telethon-tgcrypto). - Video listing filter - Only video files with size greater than 15 MB are listed by default.
- Copying streaming links - Depends on platform:
- Windows/Mac: install
pyperclip(pip install pyperclip) to enable clipboard copying. - Linux:
wl-copyfrom thewl-clipboardpackage is used (e.g. on Debian/Ubuntu:sudo apt install wl-clipboard). - Termux: requires the Termux:API add-on and
termux-apipackage (install Termux:API from F‑Droid/GitHub repo, the original source you have used to install termux and runpkg install termux-api).
- Windows/Mac: install
- Streamable links - Use the generated streamable links in a media player like mpv for a better streaming experience.You can also use the links in a download managers when server is active.
License
MIT License
Project details
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 tflix-1.1.2.tar.gz.
File metadata
- Download URL: tflix-1.1.2.tar.gz
- Upload date:
- Size: 151.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47157d40c2a9648defe93bb2bed2b2e2f530ee6481cf99de1e77ebcc2a54da08
|
|
| MD5 |
fd9bcc03a8f16a0fd138830de974d133
|
|
| BLAKE2b-256 |
7641ce0b9c84c09d41155eced8b978492911d3eb130c7f8b174e25be70f389fe
|
Provenance
The following attestation bundles were made for tflix-1.1.2.tar.gz:
Publisher:
publish.yaml on voidsnax/tflix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tflix-1.1.2.tar.gz -
Subject digest:
47157d40c2a9648defe93bb2bed2b2e2f530ee6481cf99de1e77ebcc2a54da08 - Sigstore transparency entry: 2076515970
- Sigstore integration time:
-
Permalink:
voidsnax/tflix@3256af60fe307036060d0446682aa7f9385db45d -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/voidsnax
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@3256af60fe307036060d0446682aa7f9385db45d -
Trigger Event:
push
-
Statement type:
File details
Details for the file tflix-1.1.2-py3-none-any.whl.
File metadata
- Download URL: tflix-1.1.2-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73fd8adca8ea4f3898f8ed5aa8f0d834f95d5704bf9ede270a937a7099361da5
|
|
| MD5 |
02c7bde4d8cc3b5e5f17c59b670543ee
|
|
| BLAKE2b-256 |
d7ceed90c1c55fdc594f8b1f5aa4132d5fc677cb98794f7c9df0ee0efa361383
|
Provenance
The following attestation bundles were made for tflix-1.1.2-py3-none-any.whl:
Publisher:
publish.yaml on voidsnax/tflix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tflix-1.1.2-py3-none-any.whl -
Subject digest:
73fd8adca8ea4f3898f8ed5aa8f0d834f95d5704bf9ede270a937a7099361da5 - Sigstore transparency entry: 2076516035
- Sigstore integration time:
-
Permalink:
voidsnax/tflix@3256af60fe307036060d0446682aa7f9385db45d -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/voidsnax
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@3256af60fe307036060d0446682aa7f9385db45d -
Trigger Event:
push
-
Statement type: