2020-08-10 09:23:19 +02:00
# Telegram Index
> Python Web App which indexes a telegram channel(or a chat) and serves its files for download.
## Overview
* This app indexes all the available messages.
* If the message is a media message, you can download the file.
* You can search for specific terms too.
2020-08-15 09:25:25 +02:00
## Demo
Hosted demo site: https://tg-index-demo.herokuapp.com/
2020-08-10 09:23:19 +02:00
## Deploy Guide
2020-08-17 09:44:02 +02:00
* **Clone to local machine.**
2020-08-10 09:23:19 +02:00
```bash
$ git clone https://github.com/odysseusmax/tg-index.git
$ cd tg-index
```
2020-08-17 09:44:02 +02:00
* **Create and activate virtual environment.**
2020-08-10 09:23:19 +02:00
```bash
$ pip3 install virtualenv
$ virtualenv venv
$ source venv/bin/activate
```
2020-08-17 09:44:02 +02:00
* **Install dependencies.**
2020-08-10 09:23:19 +02:00
```bash
$ pip3 install -U -r requirements.txt
```
2020-08-17 09:44:02 +02:00
* **Environment Variables.**
2020-08-10 09:23:19 +02:00
2020-08-17 09:44:02 +02:00
| Variable Name | Value
2020-08-10 09:24:30 +02:00
|------------- | -------------
2020-08-10 09:23:19 +02:00
| `API_ID` (required) | Telegram api_id obtained from https://my.telegram.org/apps.
| `API_HASH` (required) | Telegram api_hash obtained from https://my.telegram.org/apps.
2020-08-17 09:44:02 +02:00
| `INDEX_SETTINGS` (required) | See the below description.
2020-08-10 09:23:19 +02:00
| `SESSION_STRING` (required) | String obtained by running `$ python3 app/generate_session_string.py` . (Login with the telegram account which is a participant of the given channel (or chat).
| `PORT` (optional) | Port on which app should listen to, defaults to 8080.
| `HOST` (optional) | Host name on which app should listen to, defaults to 0.0.0.0.
2020-08-11 09:52:36 +02:00
| `DEBUG` (optional) | Give some value to set logging level to debug, info by default.
2020-08-10 09:23:19 +02:00
2020-08-17 09:44:02 +02:00
* **Setting value for `INDEX_SETTINGS` **
This is the general format, change the values for corresponding fields as your requirements.
```
{
"index_all": true,
"index_private":false,
"index_group": false,
"index_channel": true,
"exclude_chats": []
"include_chats": [],
}
```
* `index_all` - Whether to consider all the chats associated with the telegram account. Value should either be `true` or `false` .
* `index_private` - Whether to index private chats. Only considered if `index_all` is set to `true` . Value should either be `true` or `false` .
* `index_group` - Whether to index group chats. Only considered if `index_all` is set to `true` . Value should either be `true` or `false` .
* `index_channel` - Whether to index channels. Only considered if `index_all` is set to `true` . Value should either be `true` or `false` .
* `exclude_chats` - An array/list of chat id's that should be ignored for indexing. Only considered if `index_all` is set to `true` .
* `include_chats` - An array/list of chat id's to index. Only considered if `index_all` is set to `false` .
* **Run app.**
2020-08-10 09:23:19 +02:00
2020-08-10 09:25:42 +02:00
```bash
$ python3 -m app
```
2020-08-10 09:23:19 +02:00
2020-08-11 09:53:47 +02:00
* Other quick methods.
2020-08-10 09:44:31 +02:00
2020-08-11 09:53:47 +02:00
[![Deploy ](https://www.herokucdn.com/deploy/button.svg )](https://heroku.com/deploy?template=https://github.com/odysseusmax/tg-index/tree/master) [![Run on Repl.it ](https://repl.it/badge/github/odysseusmax/tg-index )](https://repl.it/github/odysseusmax/tg-index)
2020-08-11 09:52:36 +02:00
2020-08-12 13:12:53 +02:00
## Video Tutorial
Here's a YouTube tutorial video for deploying to [Heroku ](https://heroku.com/ "Heroku" ). [Video Link ](https://youtu.be/V8MKM6yzydw "Tutorial video for deploying to Heroku" )
2020-08-10 09:23:19 +02:00
## Contributions
Contributions are welcome.
## Contact
You can contact me [@odysseusmax ](https://tx.me/odysseusmax ).
## License
Code released under [The GNU General Public License ](LICENSE ).