Skip to content

mrfeod/tgdigest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

126 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tgdigest

Build and push Docker image

What's this?

It's a tool to generate a video from telegram channel's posts.

This is how the result looks like.

As additional artifact the tool can create statistics or digest page.

Build and Run

cargo build
cargo run -- -c config.json

If this is your first run and there is no valid tgdigest.session, you have to log in with your Telegram account.

config.json: file example:

{
  "input_dir": "~/tgdigest/data",
  "output_dir": "./output",
  "tg_session": "./tgdigest.session",
  "tg_id": <tg_app_id>,
  "tg_hash": "<tg_app_hash>",
  "cache_limit_mb": 1024,
  "public_base_url": "https://digest.example.com",
  "proxy_url": "socks5://host:port"
}
  • tg_*: create your Telegram App credentials https://my.telegram.org/apps.
  • public_base_url (optional): public base URL used in digest meta tags such as canonical, og:url, og:image, twitter:image.
  • proxy_url (optional): SOCKS5 proxy for Telegram connection. Supports socks5://host:port or socks5://user:pass@host:port. Omit the field to connect directly.

After server start, basic API calls:

Docker

Run with Docker Compose:

docker compose up --build -d

Or use prebuilt image from GHCR:

export TGDIGEST_IMAGE=ghcr.io/mrfeod/tgdigest:master
docker pull $TGDIGEST_IMAGE
docker compose up -d --no-build

If this is your first run and there is no valid tgdigest.session, log in using interactive mode:

docker compose run --rm tgdigest -c /app/config/config.json

After that, the session is stored in ./state, and regular docker compose up -d works.

Default directory mounts in docker-compose.yml:

  • ./config -> /app/config (read-only, for secrets)
  • ./data -> /app/data (read-only, templates)
  • ./output -> /app/output
  • ./state -> /app/state

Override paths with environment variables, for example:

TGDIGEST_CONFIG_DIR=~/tgdigest-config \
TGDIGEST_DATA_DIR=~/tgdigest/data \
TGDIGEST_OUTPUT_DIR=$(pwd)/output \
TGDIGEST_STATE_DIR=$(pwd)/state \
docker compose up --build -d

Example docker-config.json:

{
  "input_dir": "/app/data",
  "output_dir": "/app/output",
  "tg_session": "/app/state/tgdigest.session",
  "tg_id": <tg_app_id>,
  "tg_hash": "<tg_app_hash>",
  "cache_limit_mb": 1024,
  "public_base_url": "https://digest.example.com",
  "proxy_url": "socks5://host:port"
}

Server Endpoints

Parameters without specified data type are flags, i.e. comments, dark, force, etc. Example: ?darkdark=true`

Ranking params belong to the range [1, top_count]. Example: ?views=1` → use the best by views.

Timestamps (utc_ts_sec) are Unix timestamps in seconds (UTC).

Path param mode: directory name inside ./data Example: /digest/example/ithueti→ uses templates from./data/example`.

About

Generate a video-digest from Telegram channel's posts.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors