Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from kuaizi:master #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tg_channel_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
upload_file_set = True # set upload file to google drive
drive_id = '5FyJClXmsqNw0-Rz19' # google teamdrive id
drive_name = 'gc' # rclone drive name
max_num = 10 # 同时下载数量
max_num = 5 # 同时下载数量
# filter file name/文件名过滤
filter_list = ['你好,欢迎加入 Quantumu',
'\n']
filter_list = ['你好,欢迎加入 Quantumu', '\n']
# filter chat id /过滤某些频道不下载
blacklist = [1388464914,]
donwload_all_chat = False # 监控所有你加入的频道,收到的新消息如果包含媒体都会下载,默认关闭
filter_file_name = ['jpg', ]
#***********************************************************************************#

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
Expand Down Expand Up @@ -81,6 +81,9 @@ async def worker(name):
chat_title = queue_item[1]
entity = queue_item[2]
file_name = queue_item[3]
for filter_file in filter_file_name:
if file_name.endswith(filter_file):
return
dirname = validateTitle(f'{chat_title}({entity.id})')
datetime_dir_name = message.date.strftime("%Y年%m月")
file_save_path = os.path.join(save_path, dirname, datetime_dir_name)
Expand Down Expand Up @@ -197,7 +200,7 @@ async def handler(update):
continue
await queue.put((message, chat_title, entity, file_name))
last_msg_id = message.id
await bot.send_message(admin_id, f'{chat_title} 全部下载完成!最后消息ID为:{last_msg_id}')
await bot.send_message(admin_id, f'{chat_title} all message added to task queue, last message is:{last_msg_id}')


@events.register(events.NewMessage())
Expand Down