Docker 搭建 Telegram 下载机器人

date
Apr 19, 2024
outer_link
slug
download-media-from-Telegram
status
Published
tags
tech
summary
记录一下用 tangyoha/telegram_media_downloader 来搭建下载 Telegram 的群组限制转发和下载的媒体文件。
type
Post
项目特点:
  • 批量下载群组内的媒体文件
  • 根据日期、大小、媒体类型等条件筛选下载
  • 使用代理运行(设置代理后可在国内的主机中运行)
 
正常运行这个项目的前置条件是能够正常访问到 Telegram 的服务器,我推荐将这个 Docker 容器运行在国外的 VPS 上以获得最好的使用体验。
 

安装并配置 rclone

 
rclone config
 
e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> n Enter name for new remote. name> home url> http://100.111.111.137:5244/dav
 

配置 config.yaml 文件:

api_hash: 2c7b9b8df8c5ff7e807b1132c93dbee2 api_id: 27580881 bot_token: 6868004573:AAHdtas-QMlj4fpPDGQ2oeFJdianVz1_mWU chat: - chat_id: -1001515760402 last_read_message_id: 90000 download_filter: file_size > 5GB # note we remove ids_to_retry to data.yaml ids_to_retry: [] media_types: - audio - document - photo - video - voice - animation #gif file_formats: audio: - all document: - pdf - epub video: - mp4 save_path: /tgdl/downloads file_path_prefix: - chat_title - media_datetime - caption upload_drive: # required enable_upload_file: true # required remote_dir: homealist:/hdd/Media/TG # required upload_adapter: rclone # option,when config upload_adapter rclone then this config are required rclone_path: /app/rclone/rclone # option before_upload_file_zip: False # option after_upload_file_delete: True hide_file_name: true file_name_prefix: - message_id - file_name - caption file_name_prefix_split: ' - ' max_download_task: 10 web_host: 0.0.0.0 web_port: 15000 language: ZH web_login_secret: 1234 allowed_user_ids: - 'me' - 'XXXXXXXX' date_format: '%Y_%m'

© YM.SI 2023 - 2025

Powered by Notion & Vercel