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.0.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.0-py2.py3-none-any.whl (57.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: yaichi_tg-0.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 97371c25d6669918ac9cc1e80a15a4b5ff70ec9a796eedbfc6d9d13b1a23bb37
MD5 305146c83e05d8c8961f2f46964ddebc
BLAKE2b-256 8f95c07b2c928320179507a58b9235b38a9747d67d273aa9f0f7058991e9e4bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yaichi_tg-0.3.0-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.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 81056b20f8405295fcbe36057dbdbe233b7baa9111e5e9d580e3dc365bb59793
MD5 e1e25863b53c44eb4c022adcb8446717
BLAKE2b-256 5346b15d1a4ef00c58ba54fcad787670f29413b78f1b7242f1cd68f72d1a5f4a

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