Skip to content

A Telegram bot written in Rust that downloads videos and photo-slides from TikTok. Send a link, get the media file instantly.

License

Notifications You must be signed in to change notification settings

xairaven/MediaFetchBot

Repository files navigation

Media Fetch Bot

Looking for an easy way to download TikTok or Instagram content? I'm proud to present an open-source Telegram bot written in 🦀Rust🦀 using the Teloxide🤖 library. This bot allows you to effortlessly download content by simply sending a link.


What do you need to start:

Quick Start

Firstly, create a file named .env with this structure:

BOT_TOKEN=...
BOT_NAME=your_telegram_bot_username
LOG_LEVEL=...
WHITELIST=ON/OFF

# Optional
LOG_FORMAT="..."

# Optional
TIKTOK_API_KEY=...

# Optional
INSTAGRAM_API_KEY=...

Place it in the location specified in the instruction for the preferred method.

Log Level:

If you want to change the log level (default is ERROR), set the LOG_LEVEL variable to the desired level (error, warn, info, debug, trace, off).

Whitelist:

If you want to enable the whitelist, change the value of WHITELIST to ON instead of OFF. You also need to create a file named whitelist.json next to the .env file and fill it in the following format:

[
  123123,   // Some id
  -1231231  // Another id for example
]

Log Format:

You can change the log format if desired.

Parameters:

  • %MESSAGE - The message.
  • %LEVEL - The verbosity level of the message.
  • %TARGET - The name of the target of the directive.
  • %Y - Year.
  • %m - Month.
  • %D - Day.
  • %H - Hours.
  • %M - Minutes.
  • %S - Seconds.

For example, the default format is [%Y-%m-%D %H-%M-%S %LEVEL %TARGET] %MESSAGE.

Usage example: [2024-11-02 00-03-24 INFO media_fetch_bot] Started bot.


Then clone the repo if you want to use method 2 or 3:

git clone https://github.com/xairaven/MediaFetchBot.git

Method 1. Manual Start

Download the archive from the latest release corresponding to your OS.

In the archives, there is only one file — the executable. Place .env in the same folder.

Method 2. Docker

Place .env in <repo_folder>/media_fetch_bot/.

Change bot_username in Dockerfile:

# Your app name (write same name to both)
ARG APP_NAME_ARG=...
ENV APP_NAME_ENV=...same

Then, in the repo folder:

cd media_fetch_bot
docker build -t <come-up-with-image-name> .
docker run --name <come-up-with-container-name> <your-image-name>

Method 3. Compile by yourself

For this, you'll need rust compiler and cargo. You can find the installation instructions here.

Place .env in <repo_folder>/media_fetch_bot/.

After that, when you open the folder:

cd media_fetch_bot
cargo run

Congrats!🥳 The bot is working now.

Available Inputs:

  • /help — Instruction. You can also change localization text. For that, change the text in media_fetch_bot/locales/en.json.
  • TikTok or Instagram Link — Get your content! Videos, Photo Slides, Instagram Photos, Reels and Stories available.

Contributions

Contributions are welcome! 🎉

It's better to create an issue with description of your bug/feature before creating pull requests.

About branching

This project uses TBD git strategy.

Each contributor should have a branch. Naming example: feat/<nickname>

About

A Telegram bot written in Rust that downloads videos and photo-slides from TikTok. Send a link, get the media file instantly.

Resources

License

Stars

Watchers

Forks