Skip to content

metheoryt/embedthat

Repository files navigation

Embed That! Bot

A Telegram bot that converts social media links into playable embeds or native videos directly in chat.

Live at: https://t.me/embedthat_bot

Supported Platforms

Platform Behavior
YouTube Downloads and uploads video natively (up to 50 MB, split into parts if needed)
Instagram Rewrites link to ddinstagram.com proxy
TikTok Rewrites link to vxtiktok.com proxy
Twitter / X Rewrites link to fxtwitter.com / fixupx.com

Requirements

  • Python 3.12
  • uv
  • FFmpeg
  • Node.js + vot-cli (npm install -g vot-cli) — for YouTube audio translation
  • Redis

Setup

  1. Clone the repo and install dependencies:

    uv sync
  2. Copy .env.dist to .env and fill in the required values:

    cp .env.dist .env
Variable Required Description
BOT_TOKEN Yes Telegram bot token from @BotFather
DUMP_CHAT_ID Yes Chat ID where videos are temporarily sent to obtain Telegram file_ids for caching
REDIS_URL No Redis connection string (default: redis://redis)
LOGLEVEL No Log level (default: INFO)
TZ No Timezone for log timestamps (default: Asia/Almaty)
FEED_CHANNEL_ID No Channel to mirror processed links to
ADMIN_CHAT_ID No Admin chat for error notifications

Running

Locally (requires Redis running separately):

uv run main.py

With Docker Compose (includes Redis):

docker compose up -d

Build Docker image:

docker build -t metheoryt/embedthat:latest .

How It Works

  1. User sends a social media link.
  2. bot/handlers.py detects the LinkOrigin and routes accordingly.
  3. Instagram/TikTok/Twitter links are rewritten to embed-friendly proxy domains and sent back.
  4. YouTube links go through a full pipeline:
    • Best quality stream within Telegram's 50 MB limit is selected
    • Video and audio are downloaded separately and merged with FFmpeg
    • If the result exceeds 50 MB, it is split into up to 10 parts
    • Optionally, audio is translated: language is detected via Whisper, translated via vot-cli, and mixed with the original (quieted)
  5. Processed YouTube file_ids are cached in Redis — repeat requests are served instantly without re-downloading.

About

Telegram bot for embedding instagram/tiktok/youtube short videos

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors