A simple CLI script to upload media from URLs to a Telegram channel.
Ensure the following dependencies are installed:
- ffmpeg – Generates thumbnails, retrieves duration, and remuxes/merges m3u8 streams for
yt-dlp
. - aria2 – The primary downloader used for all downloads.
- yt-dlp – Supports m3u8 downloads and additional sites, using
aria2
as an external downloader. - Go Compiler – Required to build and run the script.
-
Ubuntu/Debian:
sudo apt update sudo apt install ffmpeg aria2 sudo pip install yt-dlp
-
macOS (Homebrew):
brew install ffmpeg aria2 yt-dlp
-
Windows:
Download and install them from their official websites:
Follow this guide to build the Telegram API server.
After building, save the generated telegram-bot-api
binary for later use.
- Ubuntu/Debian:
sudo apt install golang
- macOS (Homebrew):
brew install go
- Windows:
Download from the official Go website.
git clone https://github.com/Sadwhy/tgup.git
cd tgup
go mod tidy
go build -o tgup ./src/main.go
This generates a tgup
binary.
-
Place the
telegram-bot-api
binary in the same directory astgup
. -
Create a
.env
file with the following:BOT_TOKEN=12345678:qwertyuiopasdfghjkl API_HASH=zxcvbnmasdfghjkl API_ID=1234567890
-
Get your API credentials:
./tgup
- Enter your Channel ID (and Topic ID for supergroups, if applicable).
- Provide the media URL when prompted.
-
Create a
list.json
file with media links:[ "https://example.com/file1.mp4", "https://example.com/file2.jpg", "https://example.com/file3.png" ]
-
Run the script:
./tgup
- Enter your Channel/Group ID (and Topic ID if using supergroups).
- The script will process each file in
list.json
.
- Missing Dependencies? Verify
ffmpeg
,aria2
,yt-dlp
, and Go are installed. - Invalid API Credentials? Double-check
.env
values (BOT_TOKEN
,API_HASH
,API_ID
). - Execution Issues? Ensure
tgup
andtelegram-bot-api
binaries have execute permissions.