stackoverflow. I beginer python developter and need help. I want download foto on my serwer from different telegram chenals. Have htis code, but it download all media including video. How i can chenge code to download only photo? I've read the documentation, but don't found the answer. Thank you!
from telethon.sync import TelegramClient, events
from telethon.tl.functions.messages import GetDialogsRequest
from tqdm import tqdm
with TelegramClient('name', api_id, api_hash) as client:
result = client(GetDialogsRequest(
offset_date=None,
offset_id=0,
offset_peer="username",
limit=500,
hash=0,
))
title = 'Новинки Margaret❤'
for chat in result.chats:
print(chat)
if chat.title == title:
messages = client.get_messages(chat, limit=1000)
for message in tqdm(messages):
message.download_media('./' + title + '/') #I think the problem is right here.