Introduction:

This is a project based on Dineshkarthik's work, supporting Telegram video/resource downloads, web viewing of download progress, bot command download, support for downloading from joined private groups with limited resources, and using speeds far greater than TG client limitations. It also supports uploading to cloud storage via Rclone.

Deployment Method:

Step One: Update Sources

Ubuntu/Debian:

apt update -y && apt upgrade -y    

Centos:

yum update -y && yum upgrade -y   

Step Two: Install and Configure Docker

Install Docker:

curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh ./get-docker.sh

Start Docker:

sudo systemctl start docker

Set Docker to start automatically at boot:

sudo systemctl enable docker

Step Two: Pull Docker Container

docker pull tangyoha/telegram_media_downloader:latest
mkdir -p ~/app && mkdir -p ~/app/log/ && cd ~/app
wget https://raw.githubusercontent.com/tangyoha/telegram_media_downloader/master/docker-compose.yaml -O docker-compose.yaml
wget https://raw.githubusercontent.com/tangyoha/telegram_media_downloader/master/config.yaml -O config.yaml
wget https://raw.githubusercontent.com/tangyoha/telegram_media_downloader/master/data.yaml -O data.yaml

Step Three: Configure Docker Container

nano config.yaml

Modify the following content:

  • api_hash - The api_hash you obtained from the Telegram application (obtainable at https://my.telegram.org/apps)
  • api_id - The api_id you obtained from the Telegram application (obtainable at https://my.telegram.org/apps)
  • bot_token - Your bot's credentials (obtainable at https://t.me/BotFather) (Optional, fill in to forward information to the bot for download)
  • chat - Multiple channels

    • chat_id - The ID of the chat/channel where you want to download media (obtainable at https://t.me/username_to_id_bot)
    • download_filter - Download filter, refer to How to use filters
    • last_read_message_id - If this is your first time reading the channel, set it to "0", or if you have already used this script to download media, there will be some numbers that will automatically update after the script is successfully executed. Do not change it.
  • last_read_message_id - If this is your first time reading the channel, set it to "0", or if you have already used this script to download media, there will be some numbers that will automatically update after the script is successfully executed. Do not change it.
    Example:

  • chat_id: telegram_chat_id
    last_read_message_id: 0
    download_filter: message_date >= 2022-12-01 00:00:00 and message_date <= 2023-01-17 00:00:00
  • chat_id: telegram_chat_id_2
    last_read_message_id: 0

  • ids_to_retry - Keep as is. The downloader script uses this to track all skipped downloads, so it can download them next time the script runs.
  • media_types - The media types you want to download, you can update the media types you want to download, it can be one or any available type.
  • file_formats - The file types to download for supported media types (“audio”, “document”, and “video”). Default format is “all”, downloading all files.
  • save_path - The root directory where you want to store downloaded files
  • file_path_prefix - Subfolders for storing files, the order of the list is not fixed and can be randomly combined

    • chat_title - Chat channel or group title, if not found, the chat_id from the config file
    • media_datetime - Publication time of the resource
    • media_type - Resource type, refer to media_types
  • disable_syslog - You can choose the types of logs to disable, refer to logging._nameToLevel
  • upload_drive - You can upload files to cloud storage

    • enable_upload_file - [Required] Enable file upload, default is false
    • remote_dir - [Required] Where you upload
    • upload_adapter - [Required] File upload adapter, can be rclone,aligo. If rclone, supports all rclone supported servers, if aligo, supports uploading to Ali Cloud Disk
    • rclone_path, if the upload_adapter is configured as rclone, it is required, rclone executable directory, refer to How to use rclone
    • before_upload_file_zip - Compress file before uploading, default is false
    • after_upload_file_delete - Delete file after successful upload, default is false
  • file_name_prefix - Custom file name, use the same as file_path_prefix

    • message_id - Message id
    • file_name - File name (may be empty)
    • caption - Message title (may be empty)
  • file_name_prefix_split - Custom file name separator, default is -
  • max_download_task - Maximum download task count, default is 5.
  • hide_file_name - Whether to hide web interface file name, default false
  • web_host - Web interface address (e.g. 127.0.0.1)
  • web_port - Web interface port (e.g. 5000)
  • language - Application language, default is English (EN), optional ZH (Chinese), RU, UA
  • web_login_secret - Web page login password, if not configured, no login is required to access the web page

    Step Four: Start Docker Container

    docker-compose run --rm telegram_media_downloader

    Enter your phone number and password
    Example format: +8612345678900

Related Links:

GitHub Address: https://github.com/tangyoha/telegram_media_downloader

Tag:Configure, Telegram Media Downloader, Download TG files

Original link:http://enblog.fuyiran.link/Technology/36.html

Copyright: All posts on this blog, unless otherwise stated, are published using theCC BY-NC-SA 4.0 license agreement. Please indicate the source for reprinting Fu Speaking (enblog.fuyiran.link)

Add a new comment.