Skip to main content

Upload (and download) files to Telegram up to 4 GiB using your account.

Project description

Upload, download and clone files on Telegram up to 4 GiB (2 GiB for free users) using your personal account. Turn Telegram into your personal ☁ cloud!

$ pip install yaichi-tg

🐍 Python 3.7-3.13 supported.

❓ Setup

You need a Telegram account and your App api_id & api_hash (get it in my.telegram.org). The first time you run a command it requests your 📱 telephone, api_id and api_hash. Bot tokens cannot be used.

⬆️ Upload

$ tg-up file1.mp4 file2.mkv          # Upload to saved messages
$ tg-up video.mp4 --to @chat         # Upload to a chat/channel
$ tg-up video.mp4 --to @chat --reply-to 42   # Reply to a message
$ tg-up --interactive                # Interactive file selection

Options: --to, --reply-to, --thumbnail-file, --no-thumbnail, --caption, --large-files split, --proxy, --config, -i.

⤵️ Download

$ tg-dw                              # Latest files from saved messages
$ tg-dw --from @channel              # From a chat/channel
$ tg-dw --interactive                # Interactive dialog & file selection
$ tg-dw --url https://t.me/c/123/456/789       # By message URL
$ tg-dw --url https://t.me/username/100-105    # URL with range
$ tg-dw --from @chat --ids "1-5,10,15-20"      # By message IDs
$ tg-dw --url ... --raw              # Print JSON metadata only
$ tg-dw --url ... --raw-dl           # Print JSON metadata AND download

Options: --from, --url, --ids, --raw, --raw-dl, --delete-on-success, --split-files, --proxy, --config, -i.

–url supports: - Public: https://t.me/username/123, https://t.me/username/100-105 - Private: https://t.me/c/chatid/123, https://t.me/c/chatid/topic/123 - Ranges: 100-105, 100,102,105-110

–ids accepts comma-separated IDs and ranges: 1-5,10,15-20.

–raw/–raw-dl outputs all details: caption, entities, file attributes (video/audio/doc), forward info, media type, document thumbs, chat entity, message flags.

🔄 Clone

Copy messages between chats — media, captions, formatting, and all attributes preserved.

$ tg-clone --to @dest --url https://t.me/source/123        # By URL
$ tg-clone --to @dest --from @source --ids "1-5,10"        # By IDs
$ tg-clone --to @dest --from @source                       # All latest files
$ tg-clone --to @dest -i                                   # Interactive selection
$ tg-clone --to @dest --url ... --forward                  # Forward (keeps sender)
$ tg-clone --to @dest --url ... --dry-run                  # Preview only

Clone strategy:

  1. Direct copy (server-side, instant) — sends the media reference directly. Works when you have access to the source media.

  2. Fallback download+upload (auto) — downloads the file and re-uploads with all original attributes (mime_type, video/audio attrs, thumbnails, caption entities, filename, streaming support).

  3. Disable fallback with --no-fallback.

Options: --to (required), --from, --url, --ids, --forward, --no-fallback, --keep-files, --dry-run, --proxy, --config, -i.

Interactive mode

The --interactive / -i flag opens a terminal 🪄 wizard to pick dialogs and files:

$ tg-up --interactive       # Upload (select files)
$ tg-dw --interactive       # Download (select files)
$ tg-clone -i --to @dest    # Clone (select source + files)

Split & join files

Upload large files split into Telegram parts:

$ tg-up --large-files split large-video.mkv
$ tg-dw --split-files join

Delete on success

--delete-on-success deletes the Telegram message after download / local file after upload.

Configuration

Credentials saved in ~/.config/tg-up.json and ~/.config/tg-up.session. You can copy these files to authenticate on more machines.

Proxy: --proxy socks5://user:pass@1.2.3.4:8080 or env TG_UP_PROXY. Parallel upload blocks: env TG_UP_PARALLEL_UPLOAD_BLOCKS (default: 2).

💡 Features

  • Upload and download files up to 4 GiB.

  • Clone messages between chats with full attribute preservation.

  • URL download — download by any Telegram message URL, including ranges.

  • ID download — download by message ID range (1-5,10,15-20).

  • JSON metadata (--raw / --raw-dl) — full message info: caption, entities, file attrs, forward, media, thumbs.

  • Forward mode for clone — preserves original sender attribution.

  • Dry-run for clone — preview without executing.

  • Interactive wizard for dialog and file selection.

  • Reply to a specific message (--reply-to).

  • Thumbnails for videos and documents.

  • Split and join large files.

  • Delete local or remote file on success.

  • Variables in caption messages.

  • Proxy support (http, socks4/5, mtproxy).

  • Parallel upload blocks (env: TG_UP_PARALLEL_UPLOAD_BLOCKS).

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

yaichi_tg-0.3.1.tar.gz (290.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaichi_tg-0.3.1-py2.py3-none-any.whl (57.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file yaichi_tg-0.3.1.tar.gz.

File metadata

  • Download URL: yaichi_tg-0.3.1.tar.gz
  • Upload date:
  • Size: 290.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for yaichi_tg-0.3.1.tar.gz
Algorithm Hash digest
SHA256 63ccf8889d2cdce3871c8ff201739a8498045e239c2b0a31ae944e8128b6c5e7
MD5 4af3ffaacd72755e567ec84892f1cdef
BLAKE2b-256 040ebb1a443a70a6e8fb77bcff5c561fe6cbc3f4b4956dfffc499d36cc1c3173

See more details on using hashes here.

File details

Details for the file yaichi_tg-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: yaichi_tg-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for yaichi_tg-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4b3089f6236a128aeee9d12c92e5e7f74f07ff4bdaa04bec1b8d8ba6fd61156e
MD5 a18eb894478a0bc17e6ae0ae22c0fb82
BLAKE2b-256 f32ae24a5e594debe18874db0b1b167e2ccd355a72d25bff29560b38cee76f6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page