π‘ Add your own screenshots here β e.g., the homepage, search results, and media player views.
| Home / Browse | Search Results | Media Player |
|---|---|---|
screenshot_home.png |
screenshot_search.png |
screenshot_player.png |
| Feature | Description |
|---|---|
| π Smart Indexing | Index one or multiple Telegram channels/chats |
| π± Web Interface | Browse messages and media files directly in your browser |
| π Advanced Search | Search through all indexed content instantly |
| π‘ Multi-Channel | Index multiple channels simultaneously |
| πΌοΈ Thumbnails | Channel profile thumbnails displayed in-browser |
| π Auth Support | Optional username/password login protection |
| π₯ Media Download | Download files via browser or download managers |
| π― Selective Indexing | Choose specific chats or index everything at once |
| π Channel Lock | Lock specific channels from public access |
- Channel lock functionality
- Multi-client worker bot support
- Caching system
- API Support
- Admin Dashboard
git clone https://github.com/odysseusmax/tg-index.git
cd tg-indexpython -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activatepip install -U -r requirements.txtRun the included script and follow the prompts:
python3 app/generate_session_string.pyπ‘ Alternatively, use the Telethon Session Generator online tool.
Create a .env file in the root directory (see Configuration below).
python3 -m appThe app will be available at http://localhost:8080 (or your configured host/port).
| Variable | Description |
|---|---|
API_ID |
Telegram API ID from my.telegram.org/apps |
API_HASH |
Telegram API Hash from my.telegram.org/apps |
SESSION_STRING |
Generated by running python3 app/generate_session_string.py |
INDEX_SETTINGS |
JSON config (see below) |
| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Port the app listens on |
HOST |
0.0.0.0 |
Host the app listens on |
DEBUG |
false |
Set to true for verbose logging |
BLOCK_DOWNLOADS |
(unset) | Set any value to disable downloads |
RESULTS_PER_PAGE |
20 |
Number of results per page |
TGINDEX_USERNAME |
'' |
Username for auth (leave blank to disable) |
PASSWORD |
'' |
Password for auth (leave blank to disable) |
SHORT_URL_LEN |
β | Length of alias URLs |
SESSION_COOKIE_LIFETIME |
60 |
Session duration (minutes) |
SECRET_KEY |
β | 32-char string for signing cookies (required if auth is enabled) |
{
"index_all": false,
"index_private": false,
"index_group": false,
"index_channel": true,
"exclude_chats": [],
"include_chats": [-1001234567890]
}| Key | Description |
|---|---|
index_all |
Index all available chats (true/false) |
index_private |
Include private chats (requires index_all: true) |
index_group |
Include groups (requires index_all: true) |
index_channel |
Include channels (requires index_all: true) |
exclude_chats |
Array of chat IDs to exclude |
include_chats |
Array of specific chat IDs to index (requires index_all: false) |
import secrets, string
chars = string.ascii_letters + string.digits + string.punctuation
print(''.join(secrets.choice(chars) for _ in range(32)))- Always set a strong, random
SECRET_KEYwhen enabling login - Consider enabling
BLOCK_DOWNLOADSfor public-facing deployments - Only index channels/chats you have permission to access
- Keep your
SESSION_STRINGprivate β treat it like a password - Regularly update your dependencies to patch security vulnerabilities
Q: The app starts but no media is showing up.
A: Double-check your INDEX_SETTINGS. Make sure the include_chats IDs are correct and that the Telegram account used for the session is a member of those chats.
Q: I'm getting a SESSION_STRING error on startup.
A: Regenerate your session string using python3 app/generate_session_string.py. Make sure you log in with the correct Telegram account.
Q: Downloads are not working.
A: Make sure BLOCK_DOWNLOADS is not set in your environment. If it's set to any value, downloads will be disabled.
Q: How do I find my Telegram chat ID?
A: Forward a message from the channel/group to @userinfobot or use a bot like @username_to_id_bot.
Q: Authentication isn't working after I set a username and password.
A: Make sure you've also set a valid SECRET_KEY (32 characters). Auth won't function without it.
Q: Can I host this on a free cloud platform?
A: Yes! The demo is hosted on Koyeb. Platforms like Railway, Render, and Fly.io also work well.
Contributions are always welcome! Feel free to:
- π Open an issue for bugs or feature requests
- π Submit a pull request with improvements
- β Star the repo if you find it useful!
- Base repo by odysseusmax β tg-index
- Fixed & enhanced by ScripterSaurav
Licensed under the GNU General Public License. See LICENSE for details.
β οΈ Disclaimer: Make sure you have the appropriate permissions to access and index any Telegram channels or chats. Always comply with Telegram's Terms of Service and respect user privacy.
