Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tgtogd

一个依靠telegram bot的下载机器人,功能包括上传telegram的文件到google drive, 下载文件到google drive(链接以及使用yt-dlp下载视频)
修改自https://github.com/viperadnan-git/google-drive-telegram-bot;
修改点:

  • 更新Pyrogram版本以适配大文件下载
  • ytdl更新为yt-dlp
  • 修改为sqlite模式而非postgresql 本来最开始想改成本地json,但懒得改sql请求就算了
  • 修改为async异步,理论提升性能
  • Telegram下载文件名修改为时间+文件名,以解决同名文件下载的问题。
  • 更新认证方式,从urn:ietf:wg:oauth:2.0:oob更新为localhost 模式

参数

  • BOT_TOKEN - 与 BotFather 聊天获得(
  • APP_ID - 请在 my.telegram.org 上创建APP获得
  • API_HASH - 同上
  • SUDO_USERS - 具有SUDO USER权限的Telegram ID, 若有多个则用空格分开.
  • SUPPORT_CHAT_LINK - Telegram invite link.
  • DATABASE_URL - SQLite的文件位置(相对绝对路径皆可,以sqlite:开头).
  • DOWNLOAD_DIRECTORY - 下载文件的位置,相对绝对路径皆可. 必须以/结尾. (默认为 ./downloads/)
  • MAX_TASKS - 最大同时下载Telegram文件的数量,默认为4,不建议大于4

Bot命令支持:

/auth : 进行Googled Drive的验证,需要在填入ClientIDClientSecret之后运行,访问auth url之后将http://localhost/?code=的认证url直接发送给Bot即可完成验证;
/revoke: 取消Google Drive认证
/setfolder: 设置Google Drive上传文件夹目录,直接发送例如:/setfolder https://drive.google.com/drive/folders/*即可;
/ytdl: 使用yt-dlp进行视频等下载,发送如:/ytdl https://www.youtube.com/****即可;
/emptytrash:清空google drive垃圾箱

其他功能:

上传Telegram Files到Google Drive

直接转发文件给Bot即可, 同时下载参数为MAX_TASKS, 不建议大于4, 可能会触发Flood_wait.

下载普通链接到Google Drive

直接发送链接即可.

安装(照抄原版)

Configuration

There are two Ways for configuring this bot.

  1. Add values to Environment Variables. And add a ENV var to Anything to enable it.
  2. Add values in config.py. And make sure that no ENV environment variables existing.

Configuration Values

  • BOT_TOKEN - Get it by contacting to BotFather

  • APP_ID - Get it by creating app on my.telegram.org

  • API_HASH - Get it by creating app on my.telegram.org

  • SUDO_USERS - List of Telegram User ID of sudo users, seperated by space.

  • SUPPORT_CHAT_LINK - Telegram invite link of support chat.

  • DATABASE_URL - Postgres database url.

  • DOWNLOAD_DIRECTORY - Custom path for downloads. Must end with a forward / slash. (Default to ./downloads/)

  • Install required modules.

apt install -y git python3 ffmpeg libpq-dev python3-pip
  • Clone this git repository.
git clone https://github.com/Xiefengshang/tgtogd
  • Change Directory
cd tgtogd
  • Install requirements with pip3
pip3 install -r requirements.txt

Deploy

After modifying your config

python3 -m bot

Credits

About

一个依靠`telegram bot`的下载机器人,功能包括`Upload telegram files to google drive, `Use yt-dlp to download video and upload to google drive`

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages